also sprach Andrew Shadura <bugzi...@tut.by> [2013.04.23.1256 +0200]:
> The question is how to detect this properly. Does `ip monitor` give
> any information about that?

Yes, as far as I can tell, ip monitor does only issue an event when
DAD completes.

If I run

  ip -6 a a 2001:a60:f10a:0:22cf:30ff:fe2a:7c07/64 dev lan

I see immediately from ip monitor the route it adds:

  2001:a60:f10a::/64 dev lan  proto kernel  metric 256

but it takes 2 seconds for the following to be printed:

  4: lan    inet6 2001:a60:f10a:0:22cf:30ff:fe2a:7c07/64 scope global
         valid_lft forever preferred_lft forever
  local 2001:a60:f10a:0:22cf:30ff:fe2a:7c07 via :: dev lo table local  proto 
none  metric 0

checking with `watch -n 0.1`, I can confirm that this coincides with
the removal of the 'tentative' flag.

So all you need is a read loop on ip monitor's output like so:

  ip monitor address | while read n iface proto address rest; do
    [ $iface = $IFACE ] && [ ${address%/*} = $IF_ADDRESS ] && break;
  done

This works in a hook (up at the end of the stanza), but it's ugly
(it causes ip-monitor to be killed with SIGPIPE).

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
"never attribute to malice what can be
 adequately explained by incompetence."
                                                       -- mark twain

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

Reply via email to