summaryrefslogtreecommitdiffstats
path: root/freebsd/sbin/ifconfig
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-04 11:33:00 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-04 15:28:21 +0100
commitaf5333e0a02b2295304d4e029b15ee15a4fe2b3a (patch)
treec5c43680d374f58b487eeeaf18fb7ec6b84ba074 /freebsd/sbin/ifconfig
parentBUS_SPACE(9): Use simple memory model for ARM (diff)
downloadrtems-libbsd-af5333e0a02b2295304d4e029b15ee15a4fe2b3a.tar.bz2
Update to FreeBSD 8.4
Diffstat (limited to 'freebsd/sbin/ifconfig')
-rw-r--r--freebsd/sbin/ifconfig/ifcarp.c24
-rw-r--r--freebsd/sbin/ifconfig/ifconfig.c4
-rw-r--r--freebsd/sbin/ifconfig/iflagg.c53
-rw-r--r--freebsd/sbin/ifconfig/ifmedia.c16
-rw-r--r--freebsd/sbin/ifconfig/ifvlan.c2
5 files changed, 92 insertions, 7 deletions
diff --git a/freebsd/sbin/ifconfig/ifcarp.c b/freebsd/sbin/ifconfig/ifcarp.c
index 96a6dcb9..2537d6be 100644
--- a/freebsd/sbin/ifconfig/ifcarp.c
+++ b/freebsd/sbin/ifconfig/ifcarp.c
@@ -57,6 +57,7 @@ void setcarp_advbase(const char *,int, int, const struct afswtch *rafp);
void setcarp_advskew(const char *, int, int, const struct afswtch *rafp);
void setcarp_passwd(const char *, int, int, const struct afswtch *rafp);
void setcarp_vhid(const char *, int, int, const struct afswtch *rafp);
+void setcarp_state(const char *, int, int, const struct afswtch *rafp);
void
carp_status(int s)
@@ -175,11 +176,34 @@ setcarp_advbase(const char *val, int d, int s, const struct afswtch *afp)
return;
}
+void setcarp_state(const char *val, int d, int s, const struct afswtch *afp)
+{
+ struct carpreq carpr;
+ int i;
+
+ bzero((char *)&carpr, sizeof(struct carpreq));
+ ifr.ifr_data = (caddr_t)&carpr;
+
+ if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1)
+ err(1, "SIOCGVH");
+
+ for (i = 0; i <= CARP_MAXSTATE; i++) {
+ if (!strcasecmp(val, carp_states[i])) {
+ carpr.carpr_state = i;
+ break;
+ }
+ }
+
+ if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1)
+ err(1, "SIOCSVH");
+}
+
static struct cmd carp_cmds[] = {
DEF_CMD_ARG("advbase", setcarp_advbase),
DEF_CMD_ARG("advskew", setcarp_advskew),
DEF_CMD_ARG("pass", setcarp_passwd),
DEF_CMD_ARG("vhid", setcarp_vhid),
+ DEF_CMD_ARG("state", setcarp_state),
};
static struct afswtch af_carp = {
.af_name = "af_carp",
diff --git a/freebsd/sbin/ifconfig/ifconfig.c b/freebsd/sbin/ifconfig/ifconfig.c
index b80d880f..0d658856 100644
--- a/freebsd/sbin/ifconfig/ifconfig.c
+++ b/freebsd/sbin/ifconfig/ifconfig.c
@@ -363,6 +363,8 @@ main(int argc, char *argv[])
}
cp = ifa->ifa_name;
+ if ((ifa->ifa_flags & IFF_CANTCONFIG) != 0)
+ continue;
if (downonly && (ifa->ifa_flags & IFF_UP) != 0)
continue;
if (uponly && (ifa->ifa_flags & IFF_UP) == 0)
@@ -925,7 +927,7 @@ unsetifdescr(const char *val, int value, int s, const struct afswtch *afp)
#define IFCAPBITS \
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
-"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE"
+"\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP"
/*
* Print the status of the interface. If an address family was
diff --git a/freebsd/sbin/ifconfig/iflagg.c b/freebsd/sbin/ifconfig/iflagg.c
index 16862e85..8a98f8a9 100644
--- a/freebsd/sbin/ifconfig/iflagg.c
+++ b/freebsd/sbin/ifconfig/iflagg.c
@@ -81,6 +81,36 @@ setlaggproto(const char *val, int d, int s, const struct afswtch *afp)
err(1, "SIOCSLAGG");
}
+static void
+setlagghash(const char *val, int d, int s, const struct afswtch *afp)
+{
+ struct lagg_reqflags rf;
+ char *str, *tmp, *tok;
+
+
+ rf.rf_flags = 0;
+ str = tmp = strdup(val);
+ while ((tok = strsep(&tmp, ",")) != NULL) {
+ if (strcmp(tok, "l2") == 0)
+ rf.rf_flags |= LAGG_F_HASHL2;
+ else if (strcmp(tok, "l3") == 0)
+ rf.rf_flags |= LAGG_F_HASHL3;
+ else if (strcmp(tok, "l4") == 0)
+ rf.rf_flags |= LAGG_F_HASHL4;
+ else {
+ free(str);
+ errx(1, "Invalid lagghash option: %s", tok);
+ }
+ }
+ free(str);
+ if (rf.rf_flags == 0)
+ errx(1, "No lagghash options supplied");
+
+ strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+ if (ioctl(s, SIOCSLAGGHASH, &rf))
+ err(1, "SIOCSLAGGHASH");
+}
+
static char *
lacp_format_mac(const uint8_t *mac, char *buf, size_t buflen)
{
@@ -115,6 +145,7 @@ lagg_status(int s)
struct lagg_protos lpr[] = LAGG_PROTOS;
struct lagg_reqport rp, rpbuf[LAGG_MAX_PORTS];
struct lagg_reqall ra;
+ struct lagg_reqflags rf;
struct lacp_opreq *lp;
const char *proto = "<unknown>";
int i, isport = 0;
@@ -132,6 +163,10 @@ lagg_status(int s)
ra.ra_size = sizeof(rpbuf);
ra.ra_port = rpbuf;
+ strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname));
+ if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0)
+ rf.rf_flags = 0;
+
if (ioctl(s, SIOCGLAGG, &ra) == 0) {
lp = (struct lacp_opreq *)&ra.ra_lacpreq;
@@ -143,6 +178,23 @@ lagg_status(int s)
}
printf("\tlaggproto %s", proto);
+ if (rf.rf_flags & LAGG_F_HASHMASK) {
+ const char *sep = "";
+
+ printf(" lagghash ");
+ if (rf.rf_flags & LAGG_F_HASHL2) {
+ printf("%sl2", sep);
+ sep = ",";
+ }
+ if (rf.rf_flags & LAGG_F_HASHL3) {
+ printf("%sl3", sep);
+ sep = ",";
+ }
+ if (rf.rf_flags & LAGG_F_HASHL4) {
+ printf("%sl4", sep);
+ sep = ",";
+ }
+ }
if (isport)
printf(" laggdev %s", rp.rp_ifname);
putchar('\n');
@@ -174,6 +226,7 @@ static struct cmd lagg_cmds[] = {
DEF_CMD_ARG("laggport", setlaggport),
DEF_CMD_ARG("-laggport", unsetlaggport),
DEF_CMD_ARG("laggproto", setlaggproto),
+ DEF_CMD_ARG("lagghash", setlagghash),
};
static struct afswtch af_lagg = {
.af_name = "af_lagg",
diff --git a/freebsd/sbin/ifconfig/ifmedia.c b/freebsd/sbin/ifconfig/ifmedia.c
index aa262568..f827c357 100644
--- a/freebsd/sbin/ifconfig/ifmedia.c
+++ b/freebsd/sbin/ifconfig/ifmedia.c
@@ -284,13 +284,9 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp)
subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) |
+ ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
- if ((ifr.ifr_media & IFM_TMASK) == 0) {
- ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK);
- }
-
ifmr->ifm_current = ifr.ifr_media;
callback_register(setifmediacallback, (void *)ifmr);
}
@@ -437,6 +433,9 @@ static const struct ifmedia_description ifm_subtype_shared_aliases[] =
static const struct ifmedia_description ifm_shared_option_descriptions[] =
IFM_SHARED_OPTION_DESCRIPTIONS;
+static struct ifmedia_description ifm_shared_option_aliases[] =
+ IFM_SHARED_OPTION_ALIASES;
+
struct ifmedia_type_to_subtype {
struct {
const struct ifmedia_description *desc;
@@ -445,7 +444,7 @@ struct ifmedia_type_to_subtype {
struct {
const struct ifmedia_description *desc;
int alias;
- } options[3];
+ } options[4];
struct {
const struct ifmedia_description *desc;
int alias;
@@ -464,6 +463,7 @@ static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ethernet_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -481,6 +481,7 @@ static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_tokenring_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -498,6 +499,7 @@ static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_fddi_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -515,6 +517,7 @@ static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_ieee80211_option_descriptions[0], 0 },
{ NULL, 0 },
},
@@ -534,6 +537,7 @@ static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
},
{
{ &ifm_shared_option_descriptions[0], 0 },
+ { &ifm_shared_option_aliases[0], 1 },
{ &ifm_subtype_atm_option_descriptions[0], 0 },
{ NULL, 0 },
},
diff --git a/freebsd/sbin/ifconfig/ifvlan.c b/freebsd/sbin/ifconfig/ifvlan.c
index e745df82..b1c808c7 100644
--- a/freebsd/sbin/ifconfig/ifvlan.c
+++ b/freebsd/sbin/ifconfig/ifvlan.c
@@ -183,6 +183,8 @@ static struct cmd vlan_cmds[] = {
DEF_CMD("-vlanhwfilter", -IFCAP_VLAN_HWFILTER, setifcap),
DEF_CMD("-vlanhwtso", -IFCAP_VLAN_HWTSO, setifcap),
DEF_CMD("vlanhwtso", IFCAP_VLAN_HWTSO, setifcap),
+ DEF_CMD("vlanhwcsum", IFCAP_VLAN_HWCSUM, setifcap),
+ DEF_CMD("-vlanhwcsum", -IFCAP_VLAN_HWCSUM, setifcap),
};
static struct afswtch af_vlan = {
.af_name = "af_vlan",