diff options
author | sam <sam@FreeBSD.org> | 2008-12-15 01:06:49 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2008-12-15 01:06:49 +0000 |
commit | 0e7403cc3fbe2bd327742c0e10ee2651f4dd97d5 (patch) | |
tree | ad561ad924a0ca2e7439c89b06f7948b39785edb /sbin/ifconfig/ifvlan.c | |
parent | 3b86465e4449e31272b0884fb6d13988bebd1bc4 (diff) | |
download | FreeBSD-src-0e7403cc3fbe2bd327742c0e10ee2651f4dd97d5.zip FreeBSD-src-0e7403cc3fbe2bd327742c0e10ee2651f4dd97d5.tar.gz |
o distinguish between adhoc and ahdemo modes
o do not require 1/2 and 1/4 rate channels be present in the
calibration list when doing a gsm regulatory change; the
existing 900MHz cards are not self-identifying so there is
no way (using the calibration channel list) to check
Diffstat (limited to 'sbin/ifconfig/ifvlan.c')
-rw-r--r-- | sbin/ifconfig/ifvlan.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c index 6742789..5a6d81c 100644 --- a/sbin/ifconfig/ifvlan.c +++ b/sbin/ifconfig/ifvlan.c @@ -119,10 +119,9 @@ vlan_set(int s, struct ifreq *ifr) } } -static -DECL_CMD_FUNC(setvlantag, val, d) +static void +getvlantag(const char *val) { - struct vlanreq vreq; u_long ul; char *endp; @@ -133,24 +132,42 @@ DECL_CMD_FUNC(setvlantag, val, d) /* check if the value can be represented in vlr_tag */ if (params.vlr_tag != ul) errx(1, "value for vlan out of range"); +} - if (getvlan(s, &ifr, &vreq) != -1) - vlan_set(s, &ifr); - else - clone_setcallback(vlan_create); +static +DECL_CMD_FUNC(setvlantag_clone, val, d) +{ + getvlantag(val); + clone_setcallback(vlan_create); } static -DECL_CMD_FUNC(setvlandev, val, d) +DECL_CMD_FUNC(setvlantag, val, d) { struct vlanreq vreq; + getvlantag(val); + if (getvlan(s, &ifr, &vreq) == -1) + errx(1, "no existing vlan"); + vlan_set(s, &ifr); +} + +static +DECL_CMD_FUNC(setvlandev_clone, val, d) +{ strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent)); + clone_setcallback(vlan_create); +} + +static +DECL_CMD_FUNC(setvlandev, val, d) +{ + struct vlanreq vreq; + strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent)); if (getvlan(s, &ifr, &vreq) != -1) - vlan_set(s, &ifr); - else - clone_setcallback(vlan_create); + errx(1, "no existing vlan"); + vlan_set(s, &ifr); } static @@ -172,8 +189,8 @@ DECL_CMD_FUNC(unsetvlandev, val, d) } static struct cmd vlan_cmds[] = { - DEF_CLONE_CMD_ARG("vlan", setvlantag), - DEF_CLONE_CMD_ARG("vlandev", setvlandev), + DEF_CLONE_CMD_ARG("vlan", setvlantag_clone), + DEF_CLONE_CMD_ARG("vlandev", setvlandev_clone), /* NB: non-clone cmds */ DEF_CMD_ARG("vlan", setvlantag), DEF_CMD_ARG("vlandev", setvlandev), |