polypath-interface-monitor-linux: Skip "tentative" IPv6 local addrs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Oct 2014 19:50:50 +0000 (19:50 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Oct 2014 19:50:50 +0000 (19:50 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
polypath-interface-monitor-linux

index bce8436..0393382 100755 (executable)
@@ -61,7 +61,19 @@ for (;;) {
            while (<$addrh>) {
                print DEBUG "#$_";
                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";
                } else {
                    chomp;