Skip to contentSkip to conversation

ipv6: change sysctl to behave more like in ipv4

PATCH In review Milos Vyletel 4 participants 12 messages Jun 10, 2014 – Jun 12, 2014

Subsystems (6)
lore
Share & tools
lore
#1 lore raw

PATCH 1/5 ipv6: align sysctl table creation code with ipv4

In reply to Milos Vyletel

Use ADDRCONF_SYSCTL* macros to define sysctl table. This is first step to align ipv6 and ipv4 sysctl code.

---
 net/ipv6/addrconf.c | 300 ++++++++++++----------------------------------------
 1 file changed, 66 insertions(+), 234 deletions(-)
net/ipv6/addrconf.c +66 -234
index 5667b30..dbacca4 100644
@@ -4917,6 +4917,27 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
 	return ret;
 }
 
+#define ADDRCONF_SYSCTL_ENTRY(name, var, mval, proc) \
+	{ \
+		.procname	= #name, \
+		.data		= (void *)&ipv6_devconf + \
+				offsetof(struct ipv6_devconf, var), \
+		.maxlen		= sizeof(int), \
+		.mode		= mval, \
+		.proc_handler	= proc, \
+	}
+
+#define ADDRCONF_SYSCTL_RW_ENTRY(name) \
+	ADDRCONF_SYSCTL_ENTRY(name, name, 0644, proc_dointvec)
+
+#define ADDRCONF_SYSCTL_RO_ENTRY(name) \
+	ADDRCONF_SYSCTL_ENTRY(name, name, 0444, proc_dointvec)
+
+#define ADDRCONF_SYSCTL_COMPLEX_ENTRY(name, proc) \
+	ADDRCONF_SYSCTL_ENTRY(name, name, 0644, proc)
+
+#define ADDRCONF_SYSCTL_CUSTOM_ENTRY(name, var, proc) \
+	ADDRCONF_SYSCTL_ENTRY(name, var, 0644, proc)
 
 static struct addrconf_sysctl_table
 {
@@ -4925,248 +4946,59 @@ static struct addrconf_sysctl_table
 } addrconf_sysctl __read_mostly = {
 	.sysctl_header = NULL,
 	.addrconf_vars = {
-		{
-			.procname	= "forwarding",
-			.data		= &ipv6_devconf.forwarding,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= addrconf_sysctl_forward,
-		},
-		{
-			.procname	= "hop_limit",
-			.data		= &ipv6_devconf.hop_limit,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "mtu",
-			.data		= &ipv6_devconf.mtu6,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "accept_ra",
-			.data		= &ipv6_devconf.accept_ra,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "accept_redirects",
-			.data		= &ipv6_devconf.accept_redirects,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "autoconf",
-			.data		= &ipv6_devconf.autoconf,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "dad_transmits",
-			.data		= &ipv6_devconf.dad_transmits,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "router_solicitations",
-			.data		= &ipv6_devconf.rtr_solicits,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "router_solicitation_interval",
-			.data		= &ipv6_devconf.rtr_solicit_interval,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec_jiffies,
-		},
-		{
-			.procname	= "router_solicitation_delay",
-			.data		= &ipv6_devconf.rtr_solicit_delay,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec_jiffies,
-		},
-		{
-			.procname	= "force_mld_version",
-			.data		= &ipv6_devconf.force_mld_version,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "mldv1_unsolicited_report_interval",
-			.data		=
-				&ipv6_devconf.mldv1_unsolicited_report_interval,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec_ms_jiffies,
-		},
-		{
-			.procname	= "mldv2_unsolicited_report_interval",
-			.data		=
-				&ipv6_devconf.mldv2_unsolicited_report_interval,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec_ms_jiffies,
-		},
-		{
-			.procname	= "use_tempaddr",
-			.data		= &ipv6_devconf.use_tempaddr,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "temp_valid_lft",
-			.data		= &ipv6_devconf.temp_valid_lft,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "temp_prefered_lft",
-			.data		= &ipv6_devconf.temp_prefered_lft,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "regen_max_retry",
-			.data		= &ipv6_devconf.regen_max_retry,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "max_desync_factor",
-			.data		= &ipv6_devconf.max_desync_factor,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "max_addresses",
-			.data		= &ipv6_devconf.max_addresses,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "accept_ra_defrtr",
-			.data		= &ipv6_devconf.accept_ra_defrtr,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "accept_ra_pinfo",
-			.data		= &ipv6_devconf.accept_ra_pinfo,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
+		ADDRCONF_SYSCTL_COMPLEX_ENTRY(forwarding,
+					      addrconf_sysctl_forward),
+		ADDRCONF_SYSCTL_RW_ENTRY(hop_limit),
+		ADDRCONF_SYSCTL_CUSTOM_ENTRY(mtu, mtu6, proc_dointvec),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_ra),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_redirects),
+		ADDRCONF_SYSCTL_RW_ENTRY(autoconf),
+		ADDRCONF_SYSCTL_RW_ENTRY(dad_transmits),
+		ADDRCONF_SYSCTL_CUSTOM_ENTRY(router_solicitations, rtr_solicits,
+					     proc_dointvec),
+		ADDRCONF_SYSCTL_CUSTOM_ENTRY(router_solicitation_interval,
+					     rtr_solicit_interval,
+					     proc_dointvec_jiffies),
+		ADDRCONF_SYSCTL_CUSTOM_ENTRY(router_solicitation_delay,
+					     rtr_solicit_delay,
+					     proc_dointvec_jiffies),
+		ADDRCONF_SYSCTL_RW_ENTRY(force_mld_version),
+		ADDRCONF_SYSCTL_COMPLEX_ENTRY(mldv1_unsolicited_report_interval,
+					      proc_dointvec_ms_jiffies),
+		ADDRCONF_SYSCTL_COMPLEX_ENTRY(mldv2_unsolicited_report_interval,
+					      proc_dointvec_ms_jiffies),
+		ADDRCONF_SYSCTL_RW_ENTRY(use_tempaddr),
+		ADDRCONF_SYSCTL_RW_ENTRY(temp_valid_lft),
+		ADDRCONF_SYSCTL_RW_ENTRY(temp_prefered_lft),
+		ADDRCONF_SYSCTL_RW_ENTRY(regen_max_retry),
+		ADDRCONF_SYSCTL_RW_ENTRY(max_desync_factor),
+		ADDRCONF_SYSCTL_RW_ENTRY(max_addresses),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_ra_defrtr),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_ra_pinfo),
 #ifdef CONFIG_IPV6_ROUTER_PREF
-		{
-			.procname	= "accept_ra_rtr_pref",
-			.data		= &ipv6_devconf.accept_ra_rtr_pref,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname	= "router_probe_interval",
-			.data		= &ipv6_devconf.rtr_probe_interval,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec_jiffies,
-		},
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_ra_rtr_pref),
+		ADDRCONF_SYSCTL_CUSTOM_ENTRY(router_probe_interval,
+					     rtr_probe_interval,
+					     proc_dointvec_jiffies),
 #ifdef CONFIG_IPV6_ROUTE_INFO
-		{
-			.procname	= "accept_ra_rt_info_max_plen",
-			.data		= &ipv6_devconf.accept_ra_rt_info_max_plen,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_ra_rt_info_max_plen),
 #endif
 #endif
-		{
-			.procname	= "proxy_ndp",
-			.data		= &ipv6_devconf.proxy_ndp,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= addrconf_sysctl_proxy_ndp,
-		},
-		{
-			.procname	= "accept_source_route",
-			.data		= &ipv6_devconf.accept_source_route,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
+		ADDRCONF_SYSCTL_COMPLEX_ENTRY(proxy_ndp,
+					      addrconf_sysctl_proxy_ndp),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_source_route),
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
-		{
-			.procname       = "optimistic_dad",
-			.data           = &ipv6_devconf.optimistic_dad,
-			.maxlen         = sizeof(int),
-			.mode           = 0644,
-			.proc_handler   = proc_dointvec,
-
-		},
+		ADDRCONF_SYSCTL_RW_ENTRY(optimistic_dad),
 #endif
 #ifdef CONFIG_IPV6_MROUTE
-		{
-			.procname	= "mc_forwarding",
-			.data		= &ipv6_devconf.mc_forwarding,
-			.maxlen		= sizeof(int),
-			.mode		= 0444,
-			.proc_handler	= proc_dointvec,
-		},
+		ADDRCONF_SYSCTL_RO_ENTRY(mc_forwarding),
 #endif
-		{
-			.procname	= "disable_ipv6",
-			.data		= &ipv6_devconf.disable_ipv6,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= addrconf_sysctl_disable,
-		},
-		{
-			.procname	= "accept_dad",
-			.data		= &ipv6_devconf.accept_dad,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec,
-		},
-		{
-			.procname       = "force_tllao",
-			.data           = &ipv6_devconf.force_tllao,
-			.maxlen         = sizeof(int),
-			.mode           = 0644,
-			.proc_handler   = proc_dointvec
-		},
-		{
-			.procname       = "ndisc_notify",
-			.data           = &ipv6_devconf.ndisc_notify,
-			.maxlen         = sizeof(int),
-			.mode           = 0644,
-			.proc_handler   = proc_dointvec
-		},
-		{
-			.procname	= "suppress_frag_ndisc",
-			.data		= &ipv6_devconf.suppress_frag_ndisc,
-			.maxlen		= sizeof(int),
-			.mode		= 0644,
-			.proc_handler	= proc_dointvec
-		},
+		ADDRCONF_SYSCTL_COMPLEX_ENTRY(disable_ipv6,
+					      addrconf_sysctl_disable),
+		ADDRCONF_SYSCTL_RW_ENTRY(accept_dad),
+		ADDRCONF_SYSCTL_RW_ENTRY(force_tllao),
+		ADDRCONF_SYSCTL_RW_ENTRY(ndisc_notify),
+		ADDRCONF_SYSCTL_RW_ENTRY(suppress_frag_ndisc),
 		{
 			/* sentinel */
 		}
Signature · 1 line
1.9.0
#2 lore raw

PATCH 2/5 ipv6: rename DEVCONF* to IPV6_DEVCONF* to align with ipv4

In reply to Milos Vyletel

Use IPV6_DEVCONF* name similar to the IPV4_DEVCONF* used in ipv4. Another step in aligning code.

---
 include/uapi/linux/ipv6.h | 68 +++++++++++++++++++++----------------------
 net/ipv6/addrconf.c       | 74 +++++++++++++++++++++++------------------------
 2 files changed, 71 insertions(+), 71 deletions(-)
include/uapi/linux/ipv6.h +34 -34
index 593b0e3..715559a 100644
@@ -130,40 +130,40 @@ struct ipv6hdr {
 
 /* index values for the variables in ipv6_devconf */
 enum {
-	DEVCONF_FORWARDING = 0,
-	DEVCONF_HOPLIMIT,
-	DEVCONF_MTU6,
-	DEVCONF_ACCEPT_RA,
-	DEVCONF_ACCEPT_REDIRECTS,
-	DEVCONF_AUTOCONF,
-	DEVCONF_DAD_TRANSMITS,
-	DEVCONF_RTR_SOLICITS,
-	DEVCONF_RTR_SOLICIT_INTERVAL,
-	DEVCONF_RTR_SOLICIT_DELAY,
-	DEVCONF_USE_TEMPADDR,
-	DEVCONF_TEMP_VALID_LFT,
-	DEVCONF_TEMP_PREFERED_LFT,
-	DEVCONF_REGEN_MAX_RETRY,
-	DEVCONF_MAX_DESYNC_FACTOR,
-	DEVCONF_MAX_ADDRESSES,
-	DEVCONF_FORCE_MLD_VERSION,
-	DEVCONF_ACCEPT_RA_DEFRTR,
-	DEVCONF_ACCEPT_RA_PINFO,
-	DEVCONF_ACCEPT_RA_RTR_PREF,
-	DEVCONF_RTR_PROBE_INTERVAL,
-	DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
-	DEVCONF_PROXY_NDP,
-	DEVCONF_OPTIMISTIC_DAD,
-	DEVCONF_ACCEPT_SOURCE_ROUTE,
-	DEVCONF_MC_FORWARDING,
-	DEVCONF_DISABLE_IPV6,
-	DEVCONF_ACCEPT_DAD,
-	DEVCONF_FORCE_TLLAO,
-	DEVCONF_NDISC_NOTIFY,
-	DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
-	DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
-	DEVCONF_SUPPRESS_FRAG_NDISC,
-	DEVCONF_MAX
+	IPV6_DEVCONF_FORWARDING = 0,
+	IPV6_DEVCONF_HOPLIMIT,
+	IPV6_DEVCONF_MTU6,
+	IPV6_DEVCONF_ACCEPT_RA,
+	IPV6_DEVCONF_ACCEPT_REDIRECTS,
+	IPV6_DEVCONF_AUTOCONF,
+	IPV6_DEVCONF_DAD_TRANSMITS,
+	IPV6_DEVCONF_RTR_SOLICITS,
+	IPV6_DEVCONF_RTR_SOLICIT_INTERVAL,
+	IPV6_DEVCONF_RTR_SOLICIT_DELAY,
+	IPV6_DEVCONF_USE_TEMPADDR,
+	IPV6_DEVCONF_TEMP_VALID_LFT,
+	IPV6_DEVCONF_TEMP_PREFERED_LFT,
+	IPV6_DEVCONF_REGEN_MAX_RETRY,
+	IPV6_DEVCONF_MAX_DESYNC_FACTOR,
+	IPV6_DEVCONF_MAX_ADDRESSES,
+	IPV6_DEVCONF_FORCE_MLD_VERSION,
+	IPV6_DEVCONF_ACCEPT_RA_DEFRTR,
+	IPV6_DEVCONF_ACCEPT_RA_PINFO,
+	IPV6_DEVCONF_ACCEPT_RA_RTR_PREF,
+	IPV6_DEVCONF_RTR_PROBE_INTERVAL,
+	IPV6_DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
+	IPV6_DEVCONF_PROXY_NDP,
+	IPV6_DEVCONF_OPTIMISTIC_DAD,
+	IPV6_DEVCONF_ACCEPT_SOURCE_ROUTE,
+	IPV6_DEVCONF_MC_FORWARDING,
+	IPV6_DEVCONF_DISABLE_IPV6,
+	IPV6_DEVCONF_ACCEPT_DAD,
+	IPV6_DEVCONF_FORCE_TLLAO,
+	IPV6_DEVCONF_NDISC_NOTIFY,
+	IPV6_DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
+	IPV6_DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
+	IPV6_DEVCONF_SUPPRESS_FRAG_NDISC,
+	IPV6_DEVCONF_MAX
 };
 
 
net/ipv6/addrconf.c +37 -37

113 lines not on this page · raw message

Signature · 1 line
1.9.0
#3 lore raw

PATCH 3/5 ipv6: consider net.ipv6.conf.all sysctls when making decisions

In reply to Milos Vyletel

As it is right now net.ipv6.conf.all.* are mostly ignored and instead we're only making decisions based on interface specific settings. These settings are coppied from net.ipv6.conf.default and changing either all or default settings have no effect.

This patch changes ipv6 code to look more like the one in ipv4 world. It will introduce new macros (IN6_DEV_{AND,OR,MAX}CONF) that will take settings in net.ipv6.conf.all into account when making decisions.

Furthermore code is now almost identical to the ipv4 one. ipv6_devconf no longer defines each entry but instead uses array of IPV6_DEVCONF_MAX size to store all data to simplify access to these data from macros.

Each sysctl tunable has it's own macro defined and they use one of the IN6_DEV_{AND,OR,MAX}CONF with the exception of IN6_DEV_FORWARD which returns device specific setting. They are defined as:

IN6_DEV_ANDCONF
IN6_DEV_AUTOCONF
IN6_DEV_MFORWARD
IN6_DEV_ACCEPT_REDIRECTS
IN6_DEV_ACCEPT_RA_DEFRTR
IN6_DEV_ACCEPT_RA_PINFO
IN6_DEV_ACCEPT_RA_RTR_PREF
IN6_DEV_NDISC_NOTIFY
IN6_DEV_SUPPRESS_FRAG_NDISC
IN6_DEV_FORCE_TLLAO

IN6_DEV_ORCONF
IN6_DEV_DISABLE_IPV6
IN6_DEV_PROXY_NDP

IN6_DEV_MAXCONF

	IN6_DEV_HOPLIMIT
	IN6_DEV_MTU
	IN6_DEV_RTR_SOLICITS
	IN6_DEV_RTR_SOLICIT_INTERVAL
	IN6_DEV_RTR_SOLICIT_DELAY
	IN6_DEV_USE_TEMPADDR
	IN6_DEV_ACCEPT_RA
	IN6_DEV_ACCEPT_RA_RT_INFO_MAX_PLEN
	IN6_DEV_ACCEPT_SOURCE_ROUTE
	IN6_DEV_RTR_PROBE_INTERVAL
	IN6_DEV_REGEN_MAX_RETRY
	IN6_DEV_TEMP_VALID_LFT
	IN6_DEV_TEMP_PREFERED_LFT
	IN6_DEV_MAX_DESYNC_FACTOR
	IN6_DEV_MAX_ADDRESSES
	IN6_DEV_ACCEPT_DAD
	IN6_DEV_OPTIMISTIC_DAD
	IN6_DEV_DAD_TRANSMITS

All places which were using accesing these settings directly from ipv6_devconf stuct were updated to use these new macros.

---
 drivers/net/usb/cdc_mbim.c |   2 +-
 drivers/net/vxlan.c        |   2 +-
 include/linux/ipv6.h       |  44 +----
 include/net/addrconf.h     |   4 +-
 include/net/ipv6.h         |  98 +++++++++-
 net/ipv6/addrconf.c        | 466 ++++++++++++++++++++++-----------------------
 net/ipv6/anycast.c         |   4 +-
 net/ipv6/exthdrs.c         |   8 +-
 net/ipv6/ip6_input.c       |   4 +-
 net/ipv6/ip6_output.c      |   9 +-
 net/ipv6/ip6mr.c           |   8 +-
 net/ipv6/ipv6_sockglue.c   |   2 +-
 net/ipv6/mcast.c           |  31 +--
 net/ipv6/ndisc.c           |  41 ++--
 net/ipv6/output_core.c     |   4 +-
 net/ipv6/route.c           |  13 +-
 16 files changed, 379 insertions(+), 361 deletions(-)
drivers/net/usb/cdc_mbim.c +1 -1
index 5ee7a1d..deb21de 100644
@@ -338,7 +338,7 @@ static void do_neigh_solicit(struct usbnet *dev, u8 *buf, u16 tci)
 	in6_dev = in6_dev_get(netdev);
 	if (!in6_dev)
 		goto out;
-	is_router = !!in6_dev->cnf.forwarding;
+	is_router = !!IN6_DEV_FORWARD(in6_dev);
 	in6_dev_put(in6_dev);
 
 	/* ipv6_stub != NULL if in6_dev_get returned an inet6_dev */
drivers/net/vxlan.c +1 -1
index 4e2caaf..38d4029 100644
@@ -2633,7 +2633,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 #if IS_ENABLED(CONFIG_IPV6)
 		if (use_ipv6) {
 			struct inet6_dev *idev = __in6_dev_get(lowerdev);
-			if (idev && idev->cnf.disable_ipv6) {
+			if (idev && IN6_DEV_DISABLE_IPV6(idev)) {
 				pr_info("IPv6 is disabled via sysctl\n");
 				return -EPERM;
 			}
include/linux/ipv6.h +2 -42

50 lines not on this page · raw message

include/net/addrconf.h +2 -2
index f679877..7eb463e 100644
@@ -8,8 +8,8 @@
 
 #define TEMP_VALID_LIFETIME		(7*86400)
 #define TEMP_PREFERRED_LIFETIME		(86400)
-#define REGEN_MAX_RETRY			(3)
-#define MAX_DESYNC_FACTOR		(600)
+#define _REGEN_MAX_RETRY		(3)
+#define _MAX_DESYNC_FACTOR		(600)
 
 #define ADDR_CHECK_FREQUENCY		(120*HZ)
 
include/net/ipv6.h +96 -2

109 lines not on this page · raw message

net/ipv6/addrconf.c +223 -243

843 lines not on this page · raw message

net/ipv6/anycast.c +2 -2
index 2101832..4a9beac 100644
@@ -61,7 +61,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
 	struct inet6_dev *idev;
 	struct ipv6_ac_socklist *pac;
 	struct net *net = sock_net(sk);
-	int	ishost = !net->ipv6.devconf_all->forwarding;
+	int	ishost = !IPV6_DEVCONF_ALL(net, FORWARDING);
 	int	err = 0;
 
 	if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
@@ -110,7 +110,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
 		goto error;
 	}
 	/* reset ishost, now that we have a specific device */
-	ishost = !idev->cnf.forwarding;
+	ishost = !IN6_DEV_FORWARD(idev);
 
 	pac->acl_ifindex = dev->ifindex;
 
net/ipv6/exthdrs.c +2 -6
index 8d67900..9fcf463 100644
@@ -295,16 +295,12 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb)
 	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct in6_addr *addr = NULL;
 	struct in6_addr daddr;
-	struct inet6_dev *idev;
 	int n, i;
 	struct ipv6_rt_hdr *hdr;
 	struct rt0_hdr *rthdr;
 	struct net *net = dev_net(skb->dev);
-	int accept_source_route = net->ipv6.devconf_all->accept_source_route;
-
-	idev = __in6_dev_get(skb->dev);
-	if (idev && accept_source_route > idev->cnf.accept_source_route)
-		accept_source_route = idev->cnf.accept_source_route;
+	int accept_source_route =
+		IN6_DEV_ACCEPT_SOURCE_ROUTE(__in6_dev_get(skb->dev));
 
 	if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
 	    !pskb_may_pull(skb, (skb_transport_offset(skb) +
net/ipv6/ip6_input.c +2 -2
index 51d54dc..67345a4 100644
@@ -81,7 +81,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
 	IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_IN, skb->len);
 
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL ||
-	    !idev || unlikely(idev->cnf.disable_ipv6)) {
+	    !idev || IN6_DEV_DISABLE_IPV6(idev)) {
 		IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INDISCARDS);
 		goto drop;
 	}
@@ -296,7 +296,7 @@ int ip6_mc_input(struct sk_buff *skb)
 	/*
 	 *      IPv6 multicast router mode is now supported ;)
 	 */
-	if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
+	if (IN6_DEV_MFORWARD(__in6_dev_get(skb->dev)) &&
 	    !(ipv6_addr_type(&hdr->daddr) &
 	      (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) &&
 	    likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
net/ipv6/ip6_output.c +4 -5
index cb9df0e..db05c4c 100644
@@ -136,7 +136,7 @@ int ip6_output(struct sock *sk, struct sk_buff *skb)
 {
 	struct net_device *dev = skb_dst(skb)->dev;
 	struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
-	if (unlikely(idev->cnf.disable_ipv6)) {
+	if (IN6_DEV_DISABLE_IPV6(idev)) {
 		IP6_INC_STATS(dev_net(dev), idev,
 			      IPSTATS_MIB_OUTDISCARDS);
 		kfree_skb(skb);
@@ -336,7 +336,7 @@ static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
 	rcu_read_lock();
 	idev = __in6_dev_get(dst->dev);
 	if (idev)
-		mtu = idev->cnf.mtu6;
+		mtu = IN6_DEV_MTU(idev);
 	rcu_read_unlock();
 
 	return mtu;
@@ -368,7 +368,7 @@ int ip6_forward(struct sk_buff *skb)
 	struct net *net = dev_net(dst->dev);
 	u32 mtu;
 
-	if (net->ipv6.devconf_all->forwarding == 0)
+	if (IPV6_DEVCONF_ALL(net, FORWARDING) == 0)
 		goto error;
 
 	if (skb->pkt_type != PACKET_HOST)
@@ -417,8 +417,7 @@ int ip6_forward(struct sk_buff *skb)
 		return -ETIMEDOUT;
 	}
 
-	/* XXX: idev->cnf.proxy_ndp? */
-	if (net->ipv6.devconf_all->proxy_ndp &&
+	if (IN6_DEV_PROXY_NDP(ip6_dst_idev(dst)) &&
 	    pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) {
 		int proxied = ip6_forward_proxy_check(skb);
 		if (proxied > 0)
net/ipv6/ip6mr.c +4 -4
index 8250474..2722e24 100644
@@ -816,7 +816,7 @@ static int mif6_delete(struct mr6_table *mrt, int vifi, struct list_head *head)
 
 	in6_dev = __in6_dev_get(dev);
 	if (in6_dev) {
-		in6_dev->cnf.mc_forwarding--;
+		IN6_DEV_MFORWARD_DEC(in6_dev);
 		inet6_netconf_notify_devconf(dev_net(dev),
 					     NETCONFA_MC_FORWARDING,
 					     dev->ifindex, &in6_dev->cnf);
@@ -974,7 +974,7 @@ static int mif6_add(struct net *net, struct mr6_table *mrt,
 
 	in6_dev = __in6_dev_get(dev);
 	if (in6_dev) {
-		in6_dev->cnf.mc_forwarding++;
+		IN6_DEV_MFORWARD_INC(in6_dev);
 		inet6_netconf_notify_devconf(dev_net(dev),
 					     NETCONFA_MC_FORWARDING,
 					     dev->ifindex, &in6_dev->cnf);
@@ -1587,7 +1587,7 @@ static int ip6mr_sk_init(struct mr6_table *mrt, struct sock *sk)
 	write_lock_bh(&mrt_lock);
 	if (likely(mrt->mroute6_sk == NULL)) {
 		mrt->mroute6_sk = sk;
-		net->ipv6.devconf_all->mc_forwarding++;
+		IPV6_DEVCONF_ALL(net, MC_FORWARDING)++;
 		inet6_netconf_notify_devconf(net, NETCONFA_MC_FORWARDING,
 					     NETCONFA_IFINDEX_ALL,
 					     net->ipv6.devconf_all);
@@ -1612,7 +1612,7 @@ int ip6mr_sk_done(struct sock *sk)
 		if (sk == mrt->mroute6_sk) {
 			write_lock_bh(&mrt_lock);
 			mrt->mroute6_sk = NULL;
-			net->ipv6.devconf_all->mc_forwarding--;
+			IPV6_DEVCONF_ALL(net, MC_FORWARDING)--;
 			inet6_netconf_notify_devconf(net,
 						     NETCONFA_MC_FORWARDING,
 						     NETCONFA_IFINDEX_ALL,
net/ipv6/ipv6_sockglue.c +1 -1
index edb58af..d91f501 100644
@@ -1188,7 +1188,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
 		}
 
 		if (val < 0)
-			val = sock_net(sk)->ipv6.devconf_all->hop_limit;
+			val = IPV6_DEVCONF_ALL(sock_net(sk), HOPLIMIT);
 		break;
 	}
 
net/ipv6/mcast.c +9 -22
index 08b367c..cd49bb5 100644
@@ -95,7 +95,7 @@ static void mld_ifc_event(struct inet6_dev *idev);
 static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *pmc);
 static void mld_del_delrec(struct inet6_dev *idev, const struct in6_addr *addr);
 static void mld_clear_delrec(struct inet6_dev *idev);
-static bool mld_in_v1_mode(const struct inet6_dev *idev);
+static bool mld_in_v1_mode(struct inet6_dev *idev);
 static int sf_setstate(struct ifmcaddr6 *pmc);
 static void sf_markstate(struct ifmcaddr6 *pmc);
 static void ip6_mc_clear_src(struct ifmcaddr6 *pmc);
@@ -136,9 +136,9 @@ static int unsolicited_report_interval(struct inet6_dev *idev)
 	int iv;
 
 	if (mld_in_v1_mode(idev))
-		iv = idev->cnf.mldv1_unsolicited_report_interval;
+		iv = IN6_DEV_CONF_GET(idev, MLDV1_UNSOLICITED_REPORT_INTERVAL);
 	else
-		iv = idev->cnf.mldv2_unsolicited_report_interval;
+		iv = IN6_DEV_CONF_GET(idev, MLDV2_UNSOLICITED_REPORT_INTERVAL);
 
 	return iv > 0 ? iv : 1;
 }
@@ -1129,30 +1129,17 @@ static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs,
 	return true;
 }
 
-static int mld_force_mld_version(const struct inet6_dev *idev)
+static bool mld_in_v2_mode_only(struct inet6_dev *idev)
 {
-	/* Normally, both are 0 here. If enforcement to a particular is
-	 * being used, individual device enforcement will have a lower
-	 * precedence over 'all' device (.../conf/all/force_mld_version).
-	 */
-
-	if (dev_net(idev->dev)->ipv6.devconf_all->force_mld_version != 0)
-		return dev_net(idev->dev)->ipv6.devconf_all->force_mld_version;
-	else
-		return idev->cnf.force_mld_version;
-}
-
-static bool mld_in_v2_mode_only(const struct inet6_dev *idev)
-{
-	return mld_force_mld_version(idev) == 2;
+	return IN6_DEV_FORCE_MLD_VERSION(idev) == 2;
 }
 
-static bool mld_in_v1_mode_only(const struct inet6_dev *idev)
+static bool mld_in_v1_mode_only(struct inet6_dev *idev)
 {
-	return mld_force_mld_version(idev) == 1;
+	return IN6_DEV_FORCE_MLD_VERSION(idev) == 1;
 }
 
-static bool mld_in_v1_mode(const struct inet6_dev *idev)
+static bool mld_in_v1_mode(struct inet6_dev *idev)
 {
 	if (mld_in_v2_mode_only(idev))
 		return false;
@@ -2527,7 +2514,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev)
 	 */
 	__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allnodes);
 
-	if (idev->cnf.forwarding)
+	if (IN6_DEV_FORWARD(idev))
 		__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allrouters);
 
 	write_lock_bh(&idev->lock);
net/ipv6/ndisc.c +21 -20

133 lines not on this page · raw message

net/ipv6/output_core.c +2 -2
index ffa0293..f86ffd4 100644
@@ -60,9 +60,9 @@ int ip6_dst_hoplimit(struct dst_entry *dst)
 		rcu_read_lock();
 		idev = __in6_dev_get(dev);
 		if (idev)
-			hoplimit = idev->cnf.hop_limit;
+			hoplimit = IN6_DEV_HOPLIMIT(idev);
 		else
-			hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
+			hoplimit = IPV6_DEVCONF_ALL(dev_net(dev), HOPLIMIT);
 		rcu_read_unlock();
 	}
 	return hoplimit;
net/ipv6/route.c +7 -6
index f23fbd2..0459cf9 100644
@@ -525,7 +525,8 @@ static void rt6_probe(struct rt6_info *rt)
 	}
 
 	if (!neigh ||
-	    time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) {
+	    time_after(jiffies, neigh->updated +
+				IN6_DEV_RTR_PROBE_INTERVAL(rt->rt6i_idev))) {
 		struct __rt6_probe_work *work;
 
 		work = kmalloc(sizeof(*work), GFP_ATOMIC);
@@ -922,7 +923,7 @@ static struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
 	int strict = 0;
 	int attempts = 3;
 	int err;
-	int reachable = net->ipv6.devconf_all->forwarding ? 0 : RT6_LOOKUP_F_REACHABLE;
+	int reachable = IPV6_DEVCONF_ALL(net, FORWARDING) ? 0 : RT6_LOOKUP_F_REACHABLE;
 
 	strict |= flags & RT6_LOOKUP_F_IFACE;
 
@@ -1347,7 +1348,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
 	rcu_read_lock();
 	idev = __in6_dev_get(dst->dev);
 	if (idev)
-		mtu = idev->cnf.mtu6;
+		mtu = IN6_DEV_MTU(idev);
 	rcu_read_unlock();
 
 out:
@@ -1790,7 +1791,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
 	in6_dev = __in6_dev_get(skb->dev);
 	if (!in6_dev)
 		return;
-	if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_redirects)
+	if (IN6_DEV_FORWARD(in6_dev) || !IN6_DEV_ACCEPT_REDIRECTS(in6_dev))
 		return;
 
 	/* RFC2461 8.1:
@@ -2031,7 +2032,7 @@ restart:
 	read_lock_bh(&table->tb6_lock);
 	for (rt = table->tb6_root.leaf; rt; rt = rt->dst.rt6_next) {
 		if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF) &&
-		    (!rt->rt6i_idev || rt->rt6i_idev->cnf.accept_ra != 2)) {
+		    (!rt->rt6i_idev || IN6_DEV_ACCEPT_RA(rt->rt6i_idev) != 2)) {
 			dst_hold(&rt->dst);
 			read_unlock_bh(&table->tb6_lock);
 			ip6_del_rt(rt);
@@ -2321,7 +2322,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
 	    !dst_metric_locked(&rt->dst, RTAX_MTU) &&
 	    (dst_mtu(&rt->dst) >= arg->mtu ||
 	     (dst_mtu(&rt->dst) < arg->mtu &&
-	      dst_mtu(&rt->dst) == idev->cnf.mtu6))) {
+	      dst_mtu(&rt->dst) == IN6_DEV_MTU(idev)))) {
 		dst_metric_set(&rt->dst, RTAX_MTU, arg->mtu);
 	}
 	return 0;
Signature · 1 line
1.9.0
#11 lore raw

PATCH 5/5 ipv6: copy default config values to interfaces

In reply to Milos Vyletel

Propagate changes to default sysctl values to all interfaces if they were not previously configured and interface was not up before. This is usually only true during boot when we apply /etc/sysctl.conf values before network is brought up.

---
 include/linux/ipv6.h |  2 ++
 include/net/ipv6.h   |  6 ++++++
 net/ipv6/addrconf.c  | 39 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 45 insertions(+), 2 deletions(-)
include/linux/ipv6.h +2 -0
index fe8d38d..e356905 100644
@@ -1,6 +1,7 @@
 #ifndef _IPV6_H
 #define _IPV6_H
 
+#include <linux/bitmap.h>
 #include <uapi/linux/ipv6.h>
 
 #define ipv6_optlen(p)  (((p)->hdrlen+1) << 3)
@@ -11,6 +12,7 @@
 struct ipv6_devconf {
 	void	*sysctl;
 	__s32	data[IPV6_DEVCONF_MAX];
+	DECLARE_BITMAP(state, IPV6_DEVCONF_MAX);
 };
 
 struct ipv6_params {
include/net/ipv6.h +6 -0
index 1ee39a5..eb4e911 100644
@@ -302,9 +302,15 @@ static inline int ipv6_devconf_get(struct inet6_dev *idev, int index)
 static inline void ipv6_devconf_set(struct inet6_dev *idev, int index,
 				    int val)
 {
+	set_bit(index, idev->cnf.state);
 	idev->cnf.data[index] = val;
 }
 
+static inline void ipv6_devconf_setall(struct inet6_dev *idev)
+{
+	bitmap_fill(idev->cnf.state, IPV6_DEVCONF_MAX);
+}
+
 #define IN6_DEV_CONF_GET(idev, attr) \
 	ipv6_devconf_get((idev), IPV6_DEVCONF_ ## attr)
 #define IN6_DEV_CONF_SET(idev, attr, val) \
net/ipv6/addrconf.c +37 -2
index 5b1b578..5218978 100644
@@ -40,6 +40,7 @@
 
 #define pr_fmt(fmt) "IPv6: " fmt
 
+#include <linux/bitmap.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -852,6 +853,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
 		goto out;
 	}
 
+	ipv6_devconf_setall(idev);
 	neigh_parms_data_state_setall(idev->nd_parms);
 
 	ifa->addr = *addr;
@@ -4897,6 +4899,39 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
 	return ret;
 }
 
+static void addrconf_copy_dflt_conf(struct net *net, int i)
+{
+	struct net_device *dev;
+
+	rcu_read_lock();
+	for_each_netdev_rcu(net, dev) {
+		struct inet6_dev *idev = __in6_dev_get(dev);
+
+		if (idev && !test_bit(i, idev->cnf.state))
+			idev->cnf.data[i] = net->ipv6.devconf_dflt->data[i];
+	}
+	rcu_read_unlock();
+}
+
+static int addrconf_sysctl_proc(struct ctl_table *ctl, int write,
+				void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+	int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
+
+	if (write) {
+		struct ipv6_devconf *cnf = ctl->extra1;
+		struct net *net = ctl->extra2;
+		int i = (int *)ctl->data - cnf->data;
+
+		set_bit(i, cnf->state);
+
+		if (cnf == net->ipv6.devconf_dflt)
+			addrconf_copy_dflt_conf(net, i);
+	}
+
+	return ret;
+}
+
 #define ADDRCONF_SYSCTL_ENTRY(attr, name, mval, proc) \
 	{ \
 		.procname	= #name, \
@@ -4909,10 +4944,10 @@ int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,
 	}
 
 #define ADDRCONF_SYSCTL_RW_ENTRY(attr, name) \
-	ADDRCONF_SYSCTL_ENTRY(attr, name, 0644, proc_dointvec)
+	ADDRCONF_SYSCTL_ENTRY(attr, name, 0644, addrconf_sysctl_proc)
 
 #define ADDRCONF_SYSCTL_RO_ENTRY(attr, name) \
-	ADDRCONF_SYSCTL_ENTRY(attr, name, 0444, proc_dointvec)
+	ADDRCONF_SYSCTL_ENTRY(attr, name, 0444, addrconf_sysctl_proc)
 
 #define ADDRCONF_SYSCTL_COMPLEX_ENTRY(attr, name, proc) \
 	ADDRCONF_SYSCTL_ENTRY(attr, name, 0644, proc)
Signature · 1 line
1.9.0
#0 lore raw

cover ipv6: change sysctl to behave more like in ipv4

This patch series changes how we treat net.sysctl.conf.all settings in a same way it is done in ipv4. It is followup to my original patch submission at
http://patchwork.ozlabs.org/patch/350346/ where Cong and David suggested that it should mimic IPv4 behaviour.

Furthermore code was aligned to look more like ipv4 does to make the maintanance easier. List of patches and diffstat is below. Hopefully they are not too long. If that's the case I can split them some more.

ipv6: align sysctl table creation code with ipv4
ipv6: rename DEVCONF* to IPV6_DEVCONF* to align
ipv6: consider net.ipv6.conf.all sysctls when
Documentation: update ipv6 part of
ipv6: copy default config values to interfaces

 Documentation/networking/ip-sysctl.txt |  48 ++-
 drivers/net/usb/cdc_mbim.c             |   2 +-
 drivers/net/vxlan.c                    |   2 +-
 include/linux/ipv6.h                   |  44 +--
 include/net/addrconf.h                 |   4 +-
 include/net/ipv6.h                     |  98 ++++-
 include/uapi/linux/ipv6.h              |  68 ++--
 net/ipv6/addrconf.c                    | 666 ++++++++++++---------------------
 net/ipv6/anycast.c                     |   4 +-
 net/ipv6/exthdrs.c                     |   8 +-
 net/ipv6/ip6_input.c                   |   4 +-
 net/ipv6/ip6_output.c                  |   9 +-
 net/ipv6/ip6mr.c                       |   8 +-
 net/ipv6/ipv6_sockglue.c               |   2 +-
 net/ipv6/mcast.c                       |  31 +-
 net/ipv6/ndisc.c                       |  41 +-
 net/ipv6/output_core.c                 |   4 +-
 net/ipv6/route.c                       |  13 +-
 18 files changed, 472 insertions(+), 584 deletions(-)
#10 lore raw

PATCH 4/5 Documentation: update ipv6 part of networking/ip-sysctl.txt

Documentation was updated with details how net.ipv6.conf.all settings are used and how they affect current behaviour and interface-specific settings.

---
 Documentation/networking/ip-sysctl.txt | 48 ++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 5 deletions(-)
Documentation/networking/ip-sysctl.txt +43 -5
index ab42c95..f0406ff 100644
@@ -1159,13 +1159,51 @@ ip6frag_secret_interval - INTEGER
 	Default: 600
 
 conf/default/*:
-	Change the interface-specific default settings.
+	Change the interface-specific default settings. These settings are
+	applied to all interfaces that have not been up and that did not have
+	this settings set previously. This is usually only during boot before
+	network is set up when sysctl settings are applied.
 
 
 conf/all/*:
-	Change all the interface-specific settings.
-
-	[XXX:  Other special features than forwarding?]
+	Change all the interface-specific settings. Different settings have
+	different effect. There are three different groups based on how they
+	treat conf/all vs interface-specific settings. These groups are
+
+	Both conf/all and interface must enable this feature (andconf)
+		- accept_ra_defrtr
+		- accept_ra_pinfo
+		- accept_ra_rtr_pref
+		- accept_redirects
+		- autoconf
+		- force_tllao
+		- mforward
+		- ndisc_notify
+		- suppress_frag_ndisc
+
+	Either conf/all or interface must enable this feature (orconf)
+		- disable_ipv6
+		- proxy_ndp
+
+	Maximum value of conf/all or interface will be used (maxconf)
+		- accept_dad
+		- accept_ra
+		- accept_ra_rt_info_max_plen
+		- accept_source_route
+		- dad_transmits
+		- hop_limit
+		- max_addresses
+		- max_desync_factor
+		- mtu
+		- optimistic_dad
+		- regen_max_retry
+		- router_probe_interval
+		- router_solicitation_delay
+		- router_solicitation_interval
+		- router_solicitations
+		- temp_prefered_lft
+		- temp_valid_lft
+		- use_tempaddr
 
 conf/all/forwarding - BOOLEAN
 	Enable global IPv6 forwarding between all interfaces.
@@ -1414,7 +1452,7 @@ force_mld_version - INTEGER
 	1 - Enforce to use MLD version 1
 	2 - Enforce to use MLD version 2
 
-suppress_frag_ndisc - INTEGER
+suppress_frag_ndisc - BOOLEAN
 	Control RFC 6980 (Security Implications of IPv6 Fragmentation
 	with IPv6 Neighbor Discovery) behavior:
 	1 - (default) discard fragmented neighbor discovery packets
Signature · 1 line
1.9.0
#4 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

In reply to Milos Vyletel
Quoted 4 lines · On Tue, 10 Jun 2014 12:19:11 -0400 Milos Vyletel <[email protected]>…

As it is right now net.ipv6.conf.all.* are mostly ignored and instead we're only making decisions based on interface specific settings. These settings are coppied from net.ipv6.conf.default and changing either all or default settings have no effect.

Although this is the right idea conceptually, it risks creating unhappy users because it changes the semantics of the API. This will probably break somebody's configuration.

#8 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

In reply to Milos Vyletel

Hello,

Quoted 4 lines

IN6_DEV_MAXCONF

	IN6_DEV_HOPLIMIT
	IN6_DEV_MTU

I'm a little bit surprise to set the MTU as the maximum of all/dev value. Since the default for "all" is IPV6_MIN_MTU, it is probably harmless, but it could be a little bit surprising for administrators.

Quoted 1 line

IN6_DEV_USE_TEMPADDR

For this one, the default is zero, except for point-to-point and loopback, with -1. I didn't see any difference between 0 and -1 in the current kernel code, but if I missed something, it could be a little problem.

#9 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

Quoted 11 lines

Hello,

Quoted 4 lines

IN6_DEV_MAXCONF

      IN6_DEV_HOPLIMIT
      IN6_DEV_MTU

I'm a little bit surprise to set the MTU as the maximum of all/dev value. Since the default for "all" is IPV6_MIN_MTU, it is probably harmless, but it could be a little bit surprising for administrators.

Quoted 6 lines
Quoted 1 line

IN6_DEV_USE_TEMPADDR

For this one, the default is zero, except for point-to-point and loopback, with -1. I didn't see any difference between 0 and -1 in the current kernel code, but if I missed something, it could be a little problem.

Hi,

these are both valid points. It does not make too much sense to get max value for MTU and I'd say we should either get min or simply get interface setting and don't change the current behavior for this particular one.

use_tempaddr will have special treatment too since it can range from:
use_tempaddr - INTEGER
Preference for Privacy Extensions (RFC3041).
<= 0 : disable Privacy Extensions
== 1 : enable Privacy Extensions, but prefer public
addresses over temporary addresses.
> 1 : enable Privacy Extensions and prefer temporary
addresses over public addresses.
Default: 0 (for most devices)
-1 (for point-to-point devices and loopback devices)

Milos

#5 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

In reply to Stephen Hemminger
Quoted 11 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 10 Jun 2014 12:19:11 -0400 Milos Vyletel <[email protected]>…

As it is right now net.ipv6.conf.all.* are mostly ignored and instead we're only making decisions based on interface specific settings. These settings are coppied from net.ipv6.conf.default and changing either all or default settings have no effect.

Although this is the right idea conceptually, it risks creating unhappy users because it changes the semantics of the API. This will probably break somebody's configuration.

You're right but in this case I feel we are moving in the right direction. While the
behavior will change in some cases this change is only adding well known ipv4 behavior for ipv6 sysctls. In fact documentation briefly mentioned that net.ipv6.conf.all.* should change all the interface-specific settings but that was
not the case until now.

Milos

maintainer
#6 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

From: Milos Vyletel <[email protected]>
Date: Tue, 10 Jun 2014 13:49:35 -0400

Quoted 14 lines
Quoted 11 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 10 Jun 2014 12:19:11 -0400 Milos Vyletel <[email protected]>…

As it is right now net.ipv6.conf.all.* are mostly ignored and instead we're only making decisions based on interface specific settings. These settings are coppied from net.ipv6.conf.default and changing either all or default settings have no effect.

Although this is the right idea conceptually, it risks creating unhappy users because it changes the semantics of the API. This will probably break somebody's configuration.

Quoted 7 lines

You're right but in this case I feel we are moving in the right direction. While the
behavior will change in some cases this change is only adding well known ipv4 behavior for ipv6 sysctls. In fact documentation briefly mentioned that net.ipv6.conf.all.* should change all the interface-specific settings but that was
not the case until now.

You can't just break things on people, no matter how much you think the current behavior is "poorly designed", "inconsistent with other areas of the networking", etc. None of those things matter if you have to break things on people to "fix" it.

I'm not applying this series, sorry.

#7 lore raw

Re: [patch net-next 3/5] ipv6: consider net.ipv6.conf.all sysctls when making decisions

David,

my words may have been poorly chosen. Last thing I want is to break things...

What I meant to say is that this changes the behavior of conf.all.* sysctls from no-op to be part of decision along with interface specific ones. Default settings still work the same way unless conf.all.* was manually modified by user (for example setting conf.all.accept_ra_defrtr=0 did not stop kernel from setting default router before but it would with this change).

If this is not desired functionality I'm fine with it not being applied. However if that's the case I suggest removing conf.all.* altogether since it's no-op and pretty confusing for users (myself included).

Milos

Quoted 31 lines · David Miller

From: Milos Vyletel <[email protected]>
Date: Tue, 10 Jun 2014 13:49:35 -0400

Quoted 14 lines
Quoted 11 lines · Stephen Hemminger
Quoted 4 lines · On Tue, 10 Jun 2014 12:19:11 -0400 Milos Vyletel <[email protected]>…

As it is right now net.ipv6.conf.all.* are mostly ignored and instead we're only making decisions based on interface specific settings. These settings are coppied from net.ipv6.conf.default and changing either all or default settings have no effect.

Although this is the right idea conceptually, it risks creating unhappy users because it changes the semantics of the API. This will probably break somebody's configuration.

Quoted 7 lines

You're right but in this case I feel we are moving in the right direction. While the
behavior will change in some cases this change is only adding well known ipv4 behavior for ipv6 sysctls. In fact documentation briefly mentioned that net.ipv6.conf.all.* should change all the interface-specific settings but that was
not the case until now.

You can't just break things on people, no matter how much you think the current behavior is "poorly designed", "inconsistent with other areas of the networking", etc. None of those things matter if you have to break things on people to "fix" it.

I'm not applying this series, sorry.