Commit ce046c56 authored by David S. Miller's avatar David S. Miller

Merge branch 'ipv6_stable_privacy_address'

Hannes Frederic Sowa says:

====================
ipv6: RFC7217 stable privacy addresses implementation

this is an implementation of basic support for RFC7217 stable privacy
addresses. Please review and consider for net-next.

v2:
* Correct references to RFC 7212 -> RFC 7217 in documentation patch (thanks, Eric!)
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7f163d07 9f0761c1
...@@ -1220,6 +1220,17 @@ anycast_src_echo_reply - BOOLEAN ...@@ -1220,6 +1220,17 @@ anycast_src_echo_reply - BOOLEAN
FALSE: disabled FALSE: disabled
Default: FALSE Default: FALSE
idgen_delay - INTEGER
Controls the delay in seconds after which time to retry
privacy stable address generation if a DAD conflict is
detected.
Default: 1 (as specified in RFC7217)
idgen_retries - INTEGER
Controls the number of retries to generate a stable privacy
address if a DAD conflict is detected.
Default: 3 (as specified in RFC7217)
mld_qrv - INTEGER mld_qrv - INTEGER
Controls the MLD query robustness variable (see RFC3810 9.1). Controls the MLD query robustness variable (see RFC3810 9.1).
Default: 2 (as specified by RFC3810 9.1) Default: 2 (as specified by RFC3810 9.1)
...@@ -1540,6 +1551,20 @@ use_optimistic - BOOLEAN ...@@ -1540,6 +1551,20 @@ use_optimistic - BOOLEAN
0: disabled (default) 0: disabled (default)
1: enabled 1: enabled
stable_secret - IPv6 address
This IPv6 address will be used as a secret to generate IPv6
addresses for link-local addresses and autoconfigured
ones. All addresses generated after setting this secret will
be stable privacy ones by default. This can be changed via the
addrgenmode ip-link. conf/default/stable_secret is used as the
secret for the namespace, the interface specific ones can
overwrite that. Writes to conf/all/stable_secret are refused.
It is recommended to generate this secret during installation
of a system and keep it stable after that.
By default the stable secret is unset.
icmp/*: icmp/*:
ratelimit - INTEGER ratelimit - INTEGER
Limit the maximal rates for sending ICMPv6 packets. Limit the maximal rates for sending ICMPv6 packets.
......
...@@ -53,6 +53,10 @@ struct ipv6_devconf { ...@@ -53,6 +53,10 @@ struct ipv6_devconf {
__s32 ndisc_notify; __s32 ndisc_notify;
__s32 suppress_frag_ndisc; __s32 suppress_frag_ndisc;
__s32 accept_ra_mtu; __s32 accept_ra_mtu;
struct ipv6_stable_secret {
bool initialized;
struct in6_addr secret;
} stable_secret;
void *sysctl; void *sysctl;
}; };
......
...@@ -47,12 +47,12 @@ struct inet6_ifaddr { ...@@ -47,12 +47,12 @@ struct inet6_ifaddr {
__u32 prefered_lft; __u32 prefered_lft;
atomic_t refcnt; atomic_t refcnt;
spinlock_t lock; spinlock_t lock;
spinlock_t state_lock;
int state; int state;
__u32 flags; __u32 flags;
__u8 dad_probes; __u8 dad_probes;
__u8 stable_privacy_retry;
__u16 scope; __u16 scope;
......
...@@ -32,6 +32,8 @@ struct netns_sysctl_ipv6 { ...@@ -32,6 +32,8 @@ struct netns_sysctl_ipv6 {
int icmpv6_time; int icmpv6_time;
int anycast_src_echo_reply; int anycast_src_echo_reply;
int fwmark_reflect; int fwmark_reflect;
int idgen_retries;
int idgen_delay;
}; };
struct netns_ipv6 { struct netns_ipv6 {
......
...@@ -51,6 +51,7 @@ enum { ...@@ -51,6 +51,7 @@ enum {
#define IFA_F_MANAGETEMPADDR 0x100 #define IFA_F_MANAGETEMPADDR 0x100
#define IFA_F_NOPREFIXROUTE 0x200 #define IFA_F_NOPREFIXROUTE 0x200
#define IFA_F_MCAUTOJOIN 0x400 #define IFA_F_MCAUTOJOIN 0x400
#define IFA_F_STABLE_PRIVACY 0x800
struct ifa_cacheinfo { struct ifa_cacheinfo {
__u32 ifa_prefered; __u32 ifa_prefered;
......
...@@ -216,6 +216,7 @@ enum { ...@@ -216,6 +216,7 @@ enum {
enum in6_addr_gen_mode { enum in6_addr_gen_mode {
IN6_ADDR_GEN_MODE_EUI64, IN6_ADDR_GEN_MODE_EUI64,
IN6_ADDR_GEN_MODE_NONE, IN6_ADDR_GEN_MODE_NONE,
IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
}; };
/* Bridge section */ /* Bridge section */
......
...@@ -170,6 +170,7 @@ enum { ...@@ -170,6 +170,7 @@ enum {
DEVCONF_ACCEPT_RA_FROM_LOCAL, DEVCONF_ACCEPT_RA_FROM_LOCAL,
DEVCONF_USE_OPTIMISTIC, DEVCONF_USE_OPTIMISTIC,
DEVCONF_ACCEPT_RA_MTU, DEVCONF_ACCEPT_RA_MTU,
DEVCONF_STABLE_SECRET,
DEVCONF_MAX DEVCONF_MAX
}; };
......
...@@ -198,3 +198,4 @@ void sha_init(__u32 *buf) ...@@ -198,3 +198,4 @@ void sha_init(__u32 *buf)
buf[3] = 0x10325476; buf[3] = 0x10325476;
buf[4] = 0xc3d2e1f0; buf[4] = 0xc3d2e1f0;
} }
EXPORT_SYMBOL(sha_init);
This diff is collapsed.
...@@ -766,6 +766,8 @@ static int __net_init inet6_net_init(struct net *net) ...@@ -766,6 +766,8 @@ static int __net_init inet6_net_init(struct net *net)
net->ipv6.sysctl.icmpv6_time = 1*HZ; net->ipv6.sysctl.icmpv6_time = 1*HZ;
net->ipv6.sysctl.flowlabel_consistency = 1; net->ipv6.sysctl.flowlabel_consistency = 1;
net->ipv6.sysctl.auto_flowlabels = 0; net->ipv6.sysctl.auto_flowlabels = 0;
net->ipv6.sysctl.idgen_retries = 3;
net->ipv6.sysctl.idgen_delay = 1 * HZ;
atomic_set(&net->ipv6.fib6_sernum, 1); atomic_set(&net->ipv6.fib6_sernum, 1);
err = ipv6_init_mibs(net); err = ipv6_init_mibs(net);
......
...@@ -54,6 +54,20 @@ static struct ctl_table ipv6_table_template[] = { ...@@ -54,6 +54,20 @@ static struct ctl_table ipv6_table_template[] = {
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dointvec
}, },
{
.procname = "idgen_retries",
.data = &init_net.ipv6.sysctl.idgen_retries,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
{
.procname = "idgen_delay",
.data = &init_net.ipv6.sysctl.idgen_delay,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_jiffies,
},
{ } { }
}; };
...@@ -93,6 +107,8 @@ static int __net_init ipv6_sysctl_net_init(struct net *net) ...@@ -93,6 +107,8 @@ static int __net_init ipv6_sysctl_net_init(struct net *net)
ipv6_table[2].data = &net->ipv6.sysctl.flowlabel_consistency; ipv6_table[2].data = &net->ipv6.sysctl.flowlabel_consistency;
ipv6_table[3].data = &net->ipv6.sysctl.auto_flowlabels; ipv6_table[3].data = &net->ipv6.sysctl.auto_flowlabels;
ipv6_table[4].data = &net->ipv6.sysctl.fwmark_reflect; ipv6_table[4].data = &net->ipv6.sysctl.fwmark_reflect;
ipv6_table[5].data = &net->ipv6.sysctl.idgen_retries;
ipv6_table[6].data = &net->ipv6.sysctl.idgen_delay;
ipv6_route_table = ipv6_route_sysctl_init(net); ipv6_route_table = ipv6_route_sysctl_init(net);
if (!ipv6_route_table) if (!ipv6_route_table)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment