[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can we kill net-tools, please?



Lars Wirzenius writes ("Re: Can we kill net-tools, please?"):
> I find ip's output hard to read. I have to take time to visually parse
> it every time, I can't just skim it. The ip -o output seems parseable,
> but no easily extensible (I'd prefer something like YAML instead).

ip's output is certainly not easy to parse.

		 if (m{^\d+\:\s*(\S+)\s+$afstr\s+([0-9a-z.:]+)(?:/\d+)?\s}) {
 +                   my $rhs=$'; #';
		     my $outline = "$ip $1 $2";
 +                   # "ip -o addr show" has a ridiculous output format.  In
 +                   # particular, it mixes output keywords which introduce
 +                   # values with ones which don't, and there seems to be
 +                   # no way to tell without knowing all the possible
 +                   # keywords.  We hope that before the \ there is nothing
 +                   # which contains arbitrary text (specifically, which
 +                   # might be `tentative' other than to specify IPv6
 +                   # tentativeness).  We have to do this for IPv6 only
 +                   # because in the IPv4 output, the interface name
 +                   # appears here!
 +                   next if $ip==6 && $rhs=~m{[^\\]* tentative\s};
		     $reported{$outline} .= "y";

from

http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=blob;f=polypath-interface-monitor-linux;h=0bb9b7e54100cb8eed7d7aae30385a3cba623487;hb=HEAD#l79

-- 
Ian Jackson <ijackson@chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.


Reply to: