From owner-freebsd-current@FreeBSD.ORG Thu Sep 29 16:23:18 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 89A6816A41F for ; Thu, 29 Sep 2005 16:23:18 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from mx1.h3q.net (manticore.shapeshifter.se [212.37.5.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id E2B1043D49 for ; Thu, 29 Sep 2005 16:23:17 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from localhost (localhost [127.0.0.1]) by mx1.h3q.net (Postfix) with ESMTP id 7C9111A74D; Thu, 29 Sep 2005 18:23:13 +0200 (CEST) Received: from mx1.h3q.net ([127.0.0.1]) by localhost (manticore.shapeshifter.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 94191-09; Thu, 29 Sep 2005 18:23:11 +0200 (CEST) Received: from [192.168.0.87] (h4n2fls31o270.telia.com [217.208.199.4]) by mx1.h3q.net (Postfix) with ESMTP id 664E91A743; Thu, 29 Sep 2005 18:23:11 +0200 (CEST) Message-ID: <433C14EE.6010105@shapeshifter.se> Date: Thu, 29 Sep 2005 18:23:10 +0200 From: Fredrik Lindberg User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050928) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yar Tikhiy References: <20050922104104.GA13539@comp.chem.msu.su> <20050925213741.GG15981@odin.ac.hmc.edu> <20050928110413.GE86457@comp.chem.msu.su> In-Reply-To: <20050928110413.GE86457@comp.chem.msu.su> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: at mail.hamnpolare.net Cc: freebsd-current@freebsd.org Subject: Re: "ifconfig -vlandev" syntax X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2005 16:23:18 -0000 Yar Tikhiy wrote: > On Sun, Sep 25, 2005 at 02:37:41PM -0700, Brooks Davis wrote: > >>On Thu, Sep 22, 2005 at 02:41:05PM +0400, Yar Tikhiy wrote: >> >>>As our ifconfig(8) is growing more options for special interface >>>types, inconsistencies sneak into their syntax. In particular, >>>-vlandev takes a useless argument (vlan(4) cannot attach to more >>>than one parent anyway) while, e.g., -carpdev doesn't need one. >>>Personally, I like the latter since having to type unneeded words >>>on the command line annoys me. Do you think that making -vlandev >>>need no arguments in CURRENT would break many existing things? >> >>I agree the argument is useless. Unfortunatly, it's going to be hard to >>deprecate the old syntax so we may need to keep it around. > > > Alas, there doesn't seem to exist an easy way to support both > syntaxes in the ifconfig(8) parameter parser. Perhaps we can > survive the pain of syntax change in CURRENT only, with a > heads-up message sent, release notes updated, etc? I wonder > if many people use "ifconfig -vlandev XXX" in automated tools. > Why not use something simple such as the following (maybe even without that printf(). root@genesis> ./ifconfig vlan0 create root@genesis> ./ifconfig vlan0 vlan 1 vlandev em0 root@genesis> ./ifconfig vlan0 -vlandev root@genesis> ./ifconfig vlan0 vlan 1 vlandev em0 root@genesis> ./ifconfig vlan0 -vlandev em0 Passing interface to -vlandev is deprecated. Index: ifvlan.c =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/ifvlan.c,v retrieving revision 1.7 diff -u -r1.7 ifvlan.c --- ifvlan.c 31 Dec 2004 19:46:27 -0000 1.7 +++ ifvlan.c 29 Sep 2005 16:19:32 -0000 @@ -130,6 +130,9 @@ { struct vlanreq vreq; + if (val != NULL) + fprintf(stderr, "Passing interface to -vlandev is deprecated.\n"); + bzero((char *)&vreq, sizeof(struct vlanreq)); ifr.ifr_data = (caddr_t)&vreq; @@ -148,7 +151,7 @@ static struct cmd vlan_cmds[] = { DEF_CMD_ARG("vlan", setvlantag), DEF_CMD_ARG("vlandev", setvlandev), - DEF_CMD_ARG("-vlandev", unsetvlandev), + DEF_CMD_OPTARG("-vlandev", unsetvlandev), DEF_CMD("vlanmtu", IFCAP_VLAN_MTU, setifcap), DEF_CMD("-vlanmtu", -IFCAP_VLAN_MTU, setifcap), DEF_CMD("vlanhwtag", IFCAP_VLAN_HWTAGGING, setifcap),