From owner-svn-src-all@FreeBSD.ORG Mon Dec 15 01:44:23 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB7561065670; Mon, 15 Dec 2008 01:44:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97B888FC12; Mon, 15 Dec 2008 01:44:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF1iNXB080603; Mon, 15 Dec 2008 01:44:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF1iN6v080602; Mon, 15 Dec 2008 01:44:23 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200812150144.mBF1iN6v080602@svn.freebsd.org> From: Sam Leffler Date: Mon, 15 Dec 2008 01:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186108 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Dec 2008 01:44:23 -0000 Author: sam Date: Mon Dec 15 01:44:23 2008 New Revision: 186108 URL: http://svn.freebsd.org/changeset/base/186108 Log: back out unintended change Modified: head/sbin/ifconfig/ifvlan.c Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Mon Dec 15 01:26:33 2008 (r186107) +++ head/sbin/ifconfig/ifvlan.c Mon Dec 15 01:44:23 2008 (r186108) @@ -119,9 +119,10 @@ vlan_set(int s, struct ifreq *ifr) } } -static void -getvlantag(const char *val) +static +DECL_CMD_FUNC(setvlantag, val, d) { + struct vlanreq vreq; u_long ul; char *endp; @@ -132,31 +133,11 @@ getvlantag(const char *val) /* check if the value can be represented in vlr_tag */ if (params.vlr_tag != ul) errx(1, "value for vlan out of range"); -} - -static -DECL_CMD_FUNC(setvlantag_clone, val, d) -{ - getvlantag(val); - clone_setcallback(vlan_create); -} - -static -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); + if (getvlan(s, &ifr, &vreq) != -1) + vlan_set(s, &ifr); + else + clone_setcallback(vlan_create); } static @@ -165,9 +146,11 @@ DECL_CMD_FUNC(setvlandev, val, d) struct vlanreq vreq; strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent)); + if (getvlan(s, &ifr, &vreq) != -1) - errx(1, "no existing vlan"); - vlan_set(s, &ifr); + vlan_set(s, &ifr); + else + clone_setcallback(vlan_create); } static @@ -189,8 +172,8 @@ DECL_CMD_FUNC(unsetvlandev, val, d) } static struct cmd vlan_cmds[] = { - DEF_CLONE_CMD_ARG("vlan", setvlantag_clone), - DEF_CLONE_CMD_ARG("vlandev", setvlandev_clone), + DEF_CLONE_CMD_ARG("vlan", setvlantag), + DEF_CLONE_CMD_ARG("vlandev", setvlandev), /* NB: non-clone cmds */ DEF_CMD_ARG("vlan", setvlantag), DEF_CMD_ARG("vlandev", setvlandev),