From 0e7403cc3fbe2bd327742c0e10ee2651f4dd97d5 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 15 Dec 2008 01:06:49 +0000 Subject: 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 --- sbin/ifconfig/ifvlan.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'sbin/ifconfig/ifvlan.c') 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), -- cgit v1.1