From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 28 23:40:22 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A856116A41F for ; Fri, 28 Oct 2005 23:40:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 671AE43D48 for ; Fri, 28 Oct 2005 23:40:20 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9SNeJui015040 for ; Fri, 28 Oct 2005 23:40:20 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j9SNeJp5015039; Fri, 28 Oct 2005 23:40:19 GMT (envelope-from gnats) Date: Fri, 28 Oct 2005 23:40:19 GMT Message-Id: <200510282340.j9SNeJp5015039@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: bw@desync.com Cc: Subject: Re: bin/88119: [patch] partial matching for ifconfig X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bw@desync.com List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Oct 2005 23:40:22 -0000 The following reply was made to PR bin/88119; it has been noted by GNATS. From: bw@desync.com To: Brooks Davis Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/88119: [patch] partial matching for ifconfig Date: Fri, 28 Oct 2005 19:26:58 -0400 On Fri, Oct 28, 2005 at 03:32:02PM -0700, Brooks Davis wrote: > The manpage entry is problematic in that "match" is poorly defined. I have changed the wording slightly. "Matching multiple interfaces" lends itself to a format such as "ifconfig if0,if1 up", in my opinion. > Also, "if (ifindex == 0)" should probably be "if (ifindex == 0 && argc > == 0)" so the result of "ifconfig l " isn't: > > lo0: flags=8049 mtu 16384 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 > inet 127.0.0.1 netmask 0xff000000 I guess you're right; that could be confusing. > Thinking about it more I find this to be a significant POLA violation. > It means you can no longer reliably test for interface existence with: > > if ifconfig $ifn > /dev/null 2>&1; then > ... True, fixed. > As such I believe a new flag is required. If you used strstr to > implement grep-like semantics, -g would be appropriate. I'm not sure > what flag would be best for prefix matching. IMO, -e with egrep regexps > would be best. Ideally, -l would be enhanced to support this filtering > as well. -l is for use in scripts. I see no benefit to partial matching in such a case. http://desync.com/~bw/ifconfig.partialmatch.revised2.diff > -- Brooks bw.