Mike Gerdts wrote:

On 4/5/06, Darren Reed <[EMAIL PROTECTED]> wrote:

Program or suite of programs?

Should we try develop something for networking that has a similar
level of functionality to the tools for processes?  pkill, pgrep, etc.

So rather than doing "ifconfig -a4 up", you might do something like:
ifgrep inet | ipadm up


Now I see where you are going with this.  The ifgrep sounded kinda
hokey, but put into the context of pgrep et. al., I think I could grow
to like it.

In a previous message you suggested "ifconfig -a | ifgrep zone X".  I
think that the "ifconfig -a |" should be implied.  In other words, for
parallelism with the proc tools, it should be:

# ifgrep zone X
lo0:3
bge0:3

# ifgrep zone X | xargs ifconfig
lo0:3: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
       inet 127.0.0.1 netmask ff000000
       zone X
bge0:3: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
       inet 10.1.1.3 netmask ffffff00 broadcast 10.1.1.255
       zone X

Similarly, the following commands should work:

ifgrep mtu 1500
ifgrep inet $(getent hosts $(uname -n | awk '{print $1}'))
ifgrep ether 8:0:20:60:C0:DE

And maybe the following:

ifgrep flag up
ifgrep flag deprecated
ifgrep flag noxmit
ifgrep flag ipv4

And in the spirit of grep options, be sure that -v inverts the
selection.  Presumably combining multiple terms would be good as well.


And also multiple matches for each term, so you could do:

# ifgrep flag up,deprecated

meaning to show those that are either up or deprecated.
But what about both up and something else, like router?
Maybe:

# ifgrep flag up flag router

or

# ifgrep flag up+router,down-ipv4

...or is that getting too complex?  Especially if you were to do:

# ifgrep -v flag up+router,down-ipv4

As it would be the same as:

# ifgrep flag router-up,ipv4-down

With tunnels and IPMP devices and whatever else, is there room
for an "iftree" that might show you:

inet
 lo0
 hme0
   ipmp0
   tun0
 hme1
   ipmp0
 ipmp0
   tun1
inet6
 lo0
 hme0
 hme1

Rather than rely on ifconfig to dump out all of the interface's
output, why not an "ifshow", so I can do:

# ifgrep inet name :0 | xargs ifshow -o name,address,mask,state

and get as output:

NAME    ADDRESS     MASK            STATE
hme0    10.1.1.1    255.255.255.0   UP
ppp0    201.1.1.1   255.255.255.255 DOWN

A script might do:
nics=$(ifgrep inet)
for nicname in $nics; do
       addr=$(ifshow -h -o address $nicname)
       eval `echo nic_$nicname=$addr`
done

What about changing details of a network interface?
Are commands like "ifup" and "ifdown" useful?
Or should it be something like "ifset"?

The equivalent of "ifconfig -a up" might be:
# ifgrep | xargs ifset up

or to set the IP address of hme0:
# ifset address `cat /etc/hostname.hme0` hme0

hmmm, not sure about that one....

Just to round this out, the problem with using words as the option
names for the commands makes it hard to work out "when does the
list of options end?"

Mike, is this sort of functionality something you'd be interested
in helping make come to pass?

Darren

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to