From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: yoshfuji@linux-ipv6.org, netdev@vger.kernel.org
Subject: Re: [RFC] IPV6 address management
Date: Thu, 8 Jan 2009 12:12:20 -0800 [thread overview]
Message-ID: <20090108121220.789325a6@extreme> (raw)
In-Reply-To: <20090108.112420.102641584.davem@davemloft.net>
What about this?
If it works (still testing), I'll submit it.
---
Documentation/networking/ip-sysctl.txt | 8 ++++++
include/linux/ipv6.h | 2 +
net/ipv6/addrconf.c | 38 +++++++++++++++++++++-----------
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index e2b2894..fa05b06 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -937,6 +937,14 @@ dad_transmits - INTEGER
The amount of Duplicate Address Detection probes to send.
Default: 1
+delete_address_ifdown - BOOLEAN
+ Delete all addresses on device down
+ Default: TRUE
+
+ When network device is disabled:
+ FALSE - only delete temporary addresses (similar to IPV4)
+ TRUE - delete all addresses
+
forwarding - BOOLEAN
Configure interface-specific Host/Router behaviour.
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 641e026..b2d219a 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -166,6 +166,7 @@ struct ipv6_devconf {
#endif
__s32 disable_ipv6;
__s32 accept_dad;
+ __s32 delete_address_ifdown;
void *sysctl;
};
#endif
@@ -200,6 +201,7 @@ enum {
DEVCONF_MC_FORWARDING,
DEVCONF_DISABLE_IPV6,
DEVCONF_ACCEPT_DAD,
+ DEVCONF_DELETE_ADDRESS_IFDOWN,
DEVCONF_MAX
};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2635fa2..9133c20 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -186,6 +186,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
.accept_source_route = 0, /* we do not accept RH0 by default. */
.disable_ipv6 = 0,
.accept_dad = 1,
+ .delete_address_ifdown = 1,
};
static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -220,6 +221,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
.accept_source_route = 0, /* we do not accept RH0 by default. */
.disable_ipv6 = 0,
.accept_dad = 1,
+ .delete_address_ifdown = 1,
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
@@ -2673,19 +2675,20 @@ static int addrconf_ifdown(struct net_device *dev, int how)
write_lock_bh(&idev->lock);
}
#endif
- while ((ifa = idev->addr_list) != NULL) {
- idev->addr_list = ifa->if_next;
- ifa->if_next = NULL;
- ifa->dead = 1;
- addrconf_del_timer(ifa);
- write_unlock_bh(&idev->lock);
-
- __ipv6_ifa_notify(RTM_DELADDR, ifa);
- atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa);
- in6_ifa_put(ifa);
-
- write_lock_bh(&idev->lock);
- }
+ if (idev->cnf.delete_address_ifdown)
+ while ((ifa = idev->addr_list) != NULL) {
+ idev->addr_list = ifa->if_next;
+ ifa->if_next = NULL;
+ ifa->dead = 1;
+ addrconf_del_timer(ifa);
+ write_unlock_bh(&idev->lock);
+
+ __ipv6_ifa_notify(RTM_DELADDR, ifa);
+ atomic_notifier_call_chain(&inet6addr_chain,
+ NETDEV_DOWN, ifa);
+ in6_ifa_put(ifa);
+ write_lock_bh(&idev->lock);
+ }
write_unlock_bh(&idev->lock);
/* Step 5: Discard multicast list */
@@ -3693,6 +3696,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
#endif
array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6;
array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad;
+ array[DEVCONF_DELETE_ADDRESS_IFDOWN] = cnf->delete_address_ifdown;
}
static inline size_t inet6_if_nlmsg_size(void)
@@ -4268,6 +4272,14 @@ static struct addrconf_sysctl_table
.proc_handler = &proc_dointvec,
},
{
+ .ctl_name = CTL_UNNUMBERED,
+ .procname = "delete_address_ifdown",
+ .data = &ipv6_devconf.delete_address_ifdown,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
.ctl_name = 0, /* sentinel */
}
},
--
1.5.6.3
next prev parent reply other threads:[~2009-01-08 20:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-08 17:34 [RFC] IPV6 address management Stephen Hemminger
2009-01-08 19:24 ` David Miller
2009-01-08 20:12 ` Stephen Hemminger [this message]
2009-01-08 20:58 ` David Miller
2009-01-08 21:11 ` Ben Greear
2009-01-08 21:44 ` Stephen Hemminger
2009-01-08 21:51 ` David Miller
2009-01-08 21:56 ` Stephen Hemminger
2009-01-08 21:58 ` David Miller
2009-01-08 22:01 ` Stephen Hemminger
2009-01-08 22:03 ` David Miller
2009-01-08 22:56 ` Stephen Hemminger
2009-01-09 1:14 ` [PATCH] ipv6: address preservation on link down Stephen Hemminger
2009-01-09 8:02 ` Rémi Denis-Courmont
2009-01-09 17:31 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090108121220.789325a6@extreme \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).