summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/ifconfig/ifconfig.89
-rw-r--r--sbin/ifconfig/ifmedia.c26
2 files changed, 32 insertions, 3 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 7309965..17b16b8 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd November 27, 2006
+.Dd January 20, 2007
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -342,6 +342,11 @@ this directive is used to select between 802.11a
and 802.11g
.Pq Cm 11g
operating modes.
+.It Cm inst Ar minst , Cm instance Ar minst
+Set the media instance to
+.Ar minst .
+This is useful for devices which have multiple physical layer interfaces
+.Pq PHYs .
.It Cm name Ar name
Set the interface name to
.Ar name .
@@ -1294,7 +1299,7 @@ Allow
to automatically detect edge status.
This is the default for all interfaces added to a bridge.
.It Cm -autoedge Ar interface
-Disable automatic edge status on
+Disable automatic edge status on
.Ar interface .
.It Cm ptp Ar interface
Set the
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index c768895..df5b23e 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -248,7 +248,6 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp)
{
struct ifmediareq *ifmr;
int subtype;
-
ifmr = getifmediastate(s);
@@ -314,6 +313,24 @@ domediaopt(const char *val, int clear, int s)
callback_register(setifmediacallback, (void *)ifmr);
}
+static void
+setmediainst(const char *val, int d, int s, const struct afswtch *afp)
+{
+ struct ifmediareq *ifmr;
+ int inst;
+
+ ifmr = getifmediastate(s);
+
+ inst = atoi(val);
+ if (inst < 0 || inst > IFM_INST_MAX)
+ errx(1, "invalid media instance: %s", val);
+
+ strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ ifr.ifr_media = (ifmr->ifm_current & ~IFM_IMASK) | inst << IFM_ISHIFT;
+
+ ifmr->ifm_current = ifr.ifr_media;
+ callback_register(setifmediacallback, (void *)ifmr);
+}
static void
setmediamode(const char *val, int d, int s, const struct afswtch *afp)
@@ -721,6 +738,9 @@ print_media_word(int ifmw, int print_toptype)
}
}
printf("%s", seen_option ? ">" : "");
+
+ if (print_toptype)
+ printf(" instance %d", IFM_INST(ifmw));
}
static void
@@ -767,6 +787,8 @@ print_media_word_ifconfig(int ifmw)
}
}
}
+
+ printf(" instance %d", IFM_INST(ifmw));
}
/**********************************************************************
@@ -778,6 +800,8 @@ static struct cmd media_cmds[] = {
DEF_CMD_ARG("mode", setmediamode),
DEF_CMD_ARG("mediaopt", setmediaopt),
DEF_CMD_ARG("-mediaopt",unsetmediaopt),
+ DEF_CMD_ARG("inst", setmediainst),
+ DEF_CMD_ARG("instance", setmediainst),
};
static struct afswtch af_media = {
.af_name = "af_media",
OpenPOWER on IntegriCloud