- Display the media instance numbers and allow the user to set the active
one. This is based on NetBSD but unlike NetBSD this implementation prints the instance number for all media instances and doesn't skip it for the first one as I don't see a reason to suppress it except for the vague reason to preserve the output for single-instance configurations. - Fix some whitespace nits.
This commit is contained in:
parent
536c29257b
commit
25cab45155
@ -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
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user