On Mon, Dec 20, 2004 at 08:55:02AM -0500, jamal wrote: > Didnt boot ;-> > A small silly magic number i missed. Now boots - but doesnt mean it > works. And i dont have much time to spare chasing it. Due to a customer having again trouble with this issue, I was forced to actually spend some time testing it (and merging it to a current kernel). At least in my simple tests, it worked like a charm :) I've changed your wording 'ALIAS' to the (as I think) more apropriate 'SECONDARY', and did some minor cosmetic changes to make it apply against 2.6.12-rc2. Dave, would you consider adding this patch to your tree? Signed-off-by: Harald Welte <laforge@xxxxxxxxxxxx> -- - Harald Welte <laforge@xxxxxxxxxxxx> http://gnumonks.org/ ============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
diff -Nru --exclude-from=/sunbeam/home/laforge/scripts/dontdiff linux-2.6.12-rc2/include/linux/inetdevice.h linux-2.6.12-rc2-propag/include/linux/inetdevice.h --- linux-2.6.12-rc2/include/linux/inetdevice.h 2005-03-02 08:38:13.000000000 +0100 +++ linux-2.6.12-rc2-propag/include/linux/inetdevice.h 2005-04-12 10:21:45.000000000 +0200 @@ -29,6 +29,7 @@ int no_xfrm; int no_policy; int force_igmp_version; + int promote_secondaries; void *sysctl; }; @@ -71,6 +72,7 @@ #define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) #define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag) #define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id) +#define IN_DEV_PROMOTE_SECONDARIES(in_dev) (ipv4_devconf.promote_secondaries || (in_dev)->cnf.promote_secondaries) #define IN_DEV_RX_REDIRECTS(in_dev) \ ((IN_DEV_FORWARD(in_dev) && \ diff -Nru --exclude-from=/sunbeam/home/laforge/scripts/dontdiff linux-2.6.12-rc2/include/linux/sysctl.h linux-2.6.12-rc2-propag/include/linux/sysctl.h --- linux-2.6.12-rc2/include/linux/sysctl.h 2005-04-09 12:59:20.000000000 +0200 +++ linux-2.6.12-rc2-propag/include/linux/sysctl.h 2005-04-12 10:18:38.000000000 +0200 @@ -399,6 +399,7 @@ NET_IPV4_CONF_FORCE_IGMP_VERSION=17, NET_IPV4_CONF_ARP_ANNOUNCE=18, NET_IPV4_CONF_ARP_IGNORE=19, + NET_IPV4_CONF_PROMOTE_SECONDARIES=20, __NET_IPV4_CONF_MAX }; diff -Nru --exclude-from=/sunbeam/home/laforge/scripts/dontdiff linux-2.6.12-rc2/net/ipv4/devinet.c linux-2.6.12-rc2-propag/net/ipv4/devinet.c --- linux-2.6.12-rc2/net/ipv4/devinet.c 2005-04-09 12:59:21.000000000 +0200 +++ linux-2.6.12-rc2-propag/net/ipv4/devinet.c 2005-04-12 10:19:53.000000000 +0200 @@ -233,11 +233,14 @@ static void inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, int destroy) { + struct in_ifaddr *promote = NULL; struct in_ifaddr *ifa1 = *ifap; ASSERT_RTNL(); - /* 1. Deleting primary ifaddr forces deletion all secondaries */ + /* 1. Deleting primary ifaddr forces deletion all secondaries + * unless alias promotion is set + **/ if (!(ifa1->ifa_flags & IFA_F_SECONDARY)) { struct in_ifaddr *ifa; @@ -251,11 +254,16 @@ continue; } - *ifap1 = ifa->ifa_next; + if (!IN_DEV_PROMOTE_SECONDARIES(in_dev)) { + *ifap1 = ifa->ifa_next; - rtmsg_ifa(RTM_DELADDR, ifa); - notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa); - inet_free_ifa(ifa); + rtmsg_ifa(RTM_DELADDR, ifa); + notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa); + inet_free_ifa(ifa); + } else { + promote = ifa; + break; + } } } @@ -281,6 +289,13 @@ if (!in_dev->ifa_list) inetdev_destroy(in_dev); } + + if (promote && IN_DEV_PROMOTE_SECONDARIES(in_dev)) { + /* not sure if we should send a delete notify first? */ + promote->ifa_flags &= ~IFA_F_SECONDARY; + rtmsg_ifa(RTM_NEWADDR, promote); + notifier_call_chain(&inetaddr_chain, NETDEV_UP, promote); + } } static int inet_insert_ifa(struct in_ifaddr *ifa) @@ -1383,6 +1398,15 @@ .proc_handler = &ipv4_doint_and_flush, .strategy = &ipv4_doint_and_flush_strategy, }, + { + .ctl_name = NET_IPV4_CONF_PROMOTE_SECONDARIES, + .procname = "promote_secondaries", + .data = &ipv4_devconf.promote_secondaries, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &ipv4_doint_and_flush, + .strategy = &ipv4_doint_and_flush_strategy, + }, }, .devinet_dev = { {
Attachment:
pgpWLgR2VPBdg.pgp
Description: PGP signature