]> git.neil.brown.name Git - history.git/commitdiff
[IPV6] ignore on-link information without on-link flag set
authorHideaki Yoshifuji <yoshfuji@linux-ipv6.org>
Sun, 6 Jul 2003 13:34:40 +0000 (23:34 +1000)
committerHideaki Yoshifuji <yoshfuji@linux-ipv6.org>
Sun, 6 Jul 2003 13:34:40 +0000 (23:34 +1000)
On-link flag == 0 in RA message does not mean that the
prefix is off-link. It simply means the prefix
does not talk about on-link information.

net/ipv6/addrconf.c

index 15a9ce7a3cc1e2d0dcdf5fa60b3fafba033a9a2d..af6a297f3e3f3635e03bc4f8abb9d6a11926e546 100644 (file)
@@ -1299,7 +1299,6 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
 void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
 {
        struct prefix_info *pinfo;
-       struct rt6_info *rt;
        __u32 valid_lft;
        __u32 prefered_lft;
        int addr_type;
@@ -1355,23 +1354,26 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
        else
                rt_expires = jiffies + valid_lft * HZ;
 
-       rt = rt6_lookup(&pinfo->prefix, NULL, dev->ifindex, 1);
-
-       if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
-               if (rt->rt6i_flags&RTF_EXPIRES) {
-                       if (pinfo->onlink == 0 || valid_lft == 0) {
-                               ip6_del_rt(rt, NULL, NULL);
-                               rt = NULL;
-                       } else {
-                               rt->rt6i_expires = rt_expires;
+       if (pinfo->onlink) {
+               struct rt6_info *rt;
+               rt = rt6_lookup(&pinfo->prefix, NULL, dev->ifindex, 1);
+
+               if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
+                       if (rt->rt6i_flags&RTF_EXPIRES) {
+                               if (valid_lft == 0) {
+                                       ip6_del_rt(rt, NULL, NULL);
+                                       rt = NULL;
+                               } else {
+                                       rt->rt6i_expires = rt_expires;
+                               }
                        }
+               } else if (valid_lft) {
+                       addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
+                                             dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES);
                }
-       } else if (pinfo->onlink && valid_lft) {
-               addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
-                                     dev, rt_expires, RTF_ADDRCONF|RTF_EXPIRES);
+               if (rt)
+                       dst_release(&rt->u.dst);
        }
-       if (rt)
-               dst_release(&rt->u.dst);
 
        /* Try to figure out our local address for this prefix */