bin/88119: [patch] partial matching for ifconfig

bw at desync.com bw at desync.com
Fri Oct 28 16:40:22 PDT 2005


The following reply was made to PR bin/88119; it has been noted by GNATS.

From: bw at desync.com
To: Brooks Davis <brooks at one-eyed-alien.net>
Cc: freebsd-gnats-submit at 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 <stuff>" isn't:
 > 
 > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> 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.


More information about the freebsd-bugs mailing list