OSDN Git Service

ipv6 addrconf: Fix route lifetime setting in corner case.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Mon, 19 May 2008 23:54:29 +0000 (16:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 May 2008 23:54:29 +0000 (16:54 -0700)
Because of arithmetic overflow avoidance, the actual lifetime setting
(vs the value given by RA) did not increase monotonically around
0x7fffffff/HZ.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c

index 12bba08..98aa50c 100644 (file)
@@ -475,7 +475,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
        lifetime = ntohl(rinfo->lifetime);
        if (lifetime == 0xffffffff) {
                /* infinity */
-       } else if (lifetime > 0x7fffffff/HZ) {
+       } else if (lifetime > 0x7fffffff/HZ - 1) {
                /* Avoid arithmetic overflow */
                lifetime = 0x7fffffff/HZ - 1;
        }