... but it doesn't, so those addresses are treated as local which is bad.

This problem doesn't exist with ipv6 and the patch is based on the solution
found there.


--- linux-2.4.32.orig/net/ipv4/devinet  2004-08-08 01:26:06.000000000 +0200
+++ linux-2.4.32/net/ipv4/devinet.c     2006-04-11 06:21:24.000000000 +0200
@@ -157,21 +157,29 @@
        return in_dev;
 }

-static void inetdev_destroy(struct in_device *in_dev)
+static void inetdev_destroy(struct in_device *in_dev, int how)
 {
        struct in_ifaddr *ifa;

        ASSERT_RTNL();

-       in_dev->dead = 1;
-
-       ip_mc_destroy_dev(in_dev);
+       if(how == 0)
+               ip_mc_down(in_dev);

        while ((ifa = in_dev->ifa_list) != NULL) {
                inet_del_ifa(in_dev, &in_dev->ifa_list, 0);
                inet_free_ifa(ifa);
        }

+       neigh_parms_release(&arp_tbl, in_dev->arp_parms);
+
+       if(how == 0)
+               return;
+
+       in_dev->dead = 1;
+
+       ip_mc_destroy_dev(in_dev);
+
 #ifdef CONFIG_SYSCTL
        devinet_sysctl_unregister(&in_dev->cnf);
 #endif
@@ -181,7 +189,6 @@
        write_unlock_bh(&inetdev_lock);


-       neigh_parms_release(&arp_tbl, in_dev->arp_parms);
        in_dev_put(in_dev);
 }

@@ -252,7 +259,7 @@
                inet_free_ifa(ifa1);

                if (in_dev->ifa_list == NULL)
-                       inetdev_destroy(in_dev);
+                       inetdev_destroy(in_dev, 1);
        }
 }

@@ -945,15 +952,13 @@
                }
                ip_mc_up(in_dev);
                break;
-       case NETDEV_DOWN:
-               ip_mc_down(in_dev);
-               break;
        case NETDEV_CHANGEMTU:
                if (dev->mtu >= 68)
                        break;
                /* MTU falled under 68, disable IP */
+       case NETDEV_DOWN:
        case NETDEV_UNREGISTER:
-               inetdev_destroy(in_dev);
+               inetdev_destroy(in_dev, event != NETDEV_DOWN);
                break;
        case NETDEV_CHANGENAME:
                /* Do not notify about label change, this event is
--- linux-2.6.16.2.orig/net/ipv4/devinet.c      2006-04-07 18:56:47.000000000 
+0200
+++ linux-2.6.16.2/net/ipv4/devinet.c   2006-04-11 06:50:27.000000000 +0200
@@ -182,7 +182,7 @@
        in_dev_put(idev);
 }

-static void inetdev_destroy(struct in_device *in_dev)
+static void inetdev_destroy(struct in_device *in_dev, int how)
 {
        struct in_ifaddr *ifa;
        struct net_device *dev;
@@ -190,18 +190,24 @@
        ASSERT_RTNL();

        dev = in_dev->dev;
-       if (dev == &loopback_dev)
-               return;
-
-       in_dev->dead = 1;

-       ip_mc_destroy_dev(in_dev);
+       if (how == 0)
+           ip_mc_down(in_dev);

        while ((ifa = in_dev->ifa_list) != NULL) {
                inet_del_ifa(in_dev, &in_dev->ifa_list, 0);
                inet_free_ifa(ifa);
        }

+       arp_ifdown(dev);
+
+       if (how == 0 || dev == &loopback_dev)
+               return;
+
+       in_dev->dead = 1;
+
+       ip_mc_destroy_dev(in_dev);
+
 #ifdef CONFIG_SYSCTL
        devinet_sysctl_unregister(&in_dev->cnf);
 #endif
@@ -212,7 +218,6 @@
        neigh_sysctl_unregister(in_dev->arp_parms);
 #endif
        neigh_parms_release(&arp_tbl, in_dev->arp_parms);
-       arp_ifdown(dev);

        call_rcu(&in_dev->rcu_head, in_dev_rcu_put);
 }
@@ -316,7 +321,7 @@
                inet_free_ifa(ifa1);

                if (!in_dev->ifa_list)
-                       inetdev_destroy(in_dev);
+                       inetdev_destroy(in_dev, 1);
        }
 }

@@ -1019,15 +1024,13 @@
                }
                ip_mc_up(in_dev);
                break;
-       case NETDEV_DOWN:
-               ip_mc_down(in_dev);
-               break;
        case NETDEV_CHANGEMTU:
                if (dev->mtu >= 68)
                        break;
                /* MTU falled under 68, disable IP */
+       case NETDEV_DOWN:
        case NETDEV_UNREGISTER:
-               inetdev_destroy(in_dev);
+               inetdev_destroy(in_dev, event != NETDEV_DOWN);
                break;
        case NETDEV_CHANGENAME:
                /* Do not notify about label change, this event is
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to