Package: iproute Version: 20100519-3 Severity: normal Tags: patch # Summary
The "ip monitor" command does properly decode the "preferred" and "valid" lifetime records in router advertisements from netlink messages. # How to repeat On a host in a network with a running radvd, do ip monitor | grep preferr Optionally in a second shell to speed up things rdisc6 eth0 ## Expected behaviour Blocks of two lines repeating every few minutes: valid_lft 86400sec preferred_lft 14400sec prefix $PREFIX::/64 dev eth0 onlink autoconf valid 86400 preferred 14400 where the first line is the continuation line of an auto-configuration, and `$PREFIX` is the prefix configured in radvd. The "valid" and "preferred" numbers match. ## Observed behaviour First line as above, but then prefix $PREFIX::/64 dev eth0 onlink autoconf valid 14400 preferred 131084 ## Explanation The netlink packet in question is 0c 00 02 00 # len 12 octets, type PREFIX_CACHEINFO (2) 40 38 00 00 # preferred: 14400 = 0x00003840 80 51 01 00 # valid: 86400 = 0x00015180 iproute however does an of-by-one double word and picks * 131084 = 0x0002000c as preferred * 14400 = 0x00003840 as valid # How to fix diff --git a/ip/ipprefix.c b/ip/ipprefix.c index cb1f582..d8327be 100644 --- a/ip/ipprefix.c +++ b/ip/ipprefix.c @@ -92,7 +92,7 @@ int print_prefix(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if (tb[PREFIX_CACHEINFO]) { struct prefix_cacheinfo *pc; - pc = (struct prefix_cacheinfo *)tb[PREFIX_CACHEINFO]; + pc = (struct prefix_cacheinfo *)RTA_DATA(tb[PREFIX_CACHEINFO]); fprintf(fp, "valid %u ", pc->valid_time); fprintf(fp, "preferred %u ", pc->preferred_time); Appearently this bug still exists in Debian sid (20110629-1). Cheers, Christoph -- System Information: Debian Release: 6.0.2 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.39.3 (PREEMPT) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages iproute depends on: ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib ii libdb4.8 4.8.30-2 Berkeley v4.8 Database Libraries [ Versions of packages iproute recommends: ii libatm1 1:2.5.1-1.2 shared library for ATM (Asynchrono Versions of packages iproute suggests: pn iproute-doc <none> (no description available) -- no debconf information
signature.asc
Description: Digital signature