On 4/7/06, Darren Reed <[EMAIL PROTECTED]> wrote: > Mike Gerdts wrote: > >And in the spirit of grep options, be sure that -v inverts the > >selection. Presumably combining multiple terms would be good as well. > >
Since writing the above and reading what you wrote, I began to think that you may want to have a fine grained "not". In other words the following would give all interfaces that are up but without a v4 IP address (or v4 address set to 0.0.0.0?). # ifgrep flags up,!ipv4 > And also multiple matches for each term, so you could do: > > # ifgrep flag up,deprecated A certain part of me says this should be: # ifgrep -e flag '(up|deprecated)' The -e option enables regular expression matches for all comparisons. Becomes rather useful if you have zone names or IPMP groups that conform to some naming standard. # ifgrep -e zone 'web-.*-prod' > 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 Interesting. I'd like to see a ps-like -o argument here as well so that you can maintain the hierarchy but possibly add columns like zone name, ipmp group name, IP address, etc. > 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 Not sure I understand what :0 does, but yes, ifshow looks to be useful. > 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? I worry a bit about the particular names confusing those coming from a Linux background. However, if ifup and ifdown do what the Linux equivalents do, that could be good. This could pave the way for a new mechanism for configuring network information in a place other than /etc/hostname.*. Are SMF service properties the right place? For very basic interface configurations, I think that it would be easy to do but I worry that it could turn into an ugly mess once you get a few layers involved (trunk, vlan, ipmp, tunnel, ...) Then again, ifup could just take over the ugliness performed in the various SMF method scripts. If a sysadmin is trying to configure a new interface, it is really difficult to be sure that they follow the same logic that those scripts follow. My most recent battle with this was trying to get an interace to be plumbed with no IP address but not have it brought up. I took way too many reboots (more than zero) to ensure that this was working right. (Hint: if there is more than one line in /etc/hostname.<interface> it does not automatically set the "up" flag.) > Or should it be something like "ifset"? I think that ifset would be reasonable. However, for ifup, ifdown, and ifset perhaps it would make more sense to have a command that is analgous to zoneadm that has up, down, and set as subcommands. > 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.... /etc/hostname.* is way to cluttered for that one right now. > 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?" I was reading a recent ARC case (http://opensolaris.org/os/community/arc/caselog/2005/441/) where there was a rather firm statement about future ARC cases that are not CLIP compliant. As such, the following document is probably worth a read. http://opensolaris.org/os/community/arc/caselog/1999/645/clip.pdf I suspect that we would really be looking at command syntax like: ifgrep -z zone ifgrep -f flag ifgrep --zone danger ifgrep --flag flag ifgrep -e --flag '(up|ipv4)' > Mike, is this sort of functionality something you'd be interested > in helping make come to pass? I would be happy to have some involvement. I don't have many long continous blocks of time required to crank out all the code for a suite of commands in any short period of time, but could definitely find some time to help out. Mike -- Mike Gerdts http://mgerdts.blogspot.com/ _______________________________________________ networking-discuss mailing list [email protected]
