netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes
@ 2015-08-31 13:59 Marius Tomaschewski
  2015-08-31 22:13 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Tomaschewski @ 2015-08-31 13:59 UTC (permalink / raw)
  To: netdev; +Cc: Marius Tomaschewski

The kernel is applying the RA managed/otherconf flags silently and
forgets to send ifinfo notify to inform about their change when the
router provides a zero reachable_time and retrans_timer as dnsmasq
and many routers send it, which just means unspecified by this router
and the host should continue using whatever value it is already using.
Userspace may monitor the ifinfo notifications to activate dhcpv6.

Signed-off-by: Marius Tomaschewski <mt@suse.de>

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index c53331c..99ea9dd 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1074,6 +1074,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	struct ndisc_options ndopts;
 	int optlen;
 	unsigned int pref = 0;
+	__u32 old_if_flags;
 
 	__u8 *opt = (__u8 *)(ra_msg + 1);
 
@@ -1144,6 +1145,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * Remember the managed/otherconf flags from most recently
 	 * received RA message (RFC 2462) -- yoshfuji
 	 */
+	old_if_flags = in6_dev->if_flags;
 	in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED |
 				IF_RA_OTHERCONF)) |
 				(ra_msg->icmph.icmp6_addrconf_managed ?
@@ -1151,6 +1153,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 				(ra_msg->icmph.icmp6_addrconf_other ?
 					IF_RA_OTHERCONF : 0);
 
+	if (old_if_flags != in6_dev->if_flags)
+		inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+
 	if (!in6_dev->cnf.accept_ra_defrtr) {
 		ND_PRINTK(2, info,
 			  "RA: %s, defrtr is false for dev: %s\n",
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes
  2015-08-31 13:59 [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes Marius Tomaschewski
@ 2015-08-31 22:13 ` David Miller
  2015-08-31 23:43   ` Marius Tomaschewski
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2015-08-31 22:13 UTC (permalink / raw)
  To: mt; +Cc: netdev

From: Marius Tomaschewski <mt@suse.de>
Date: Mon, 31 Aug 2015 15:59:22 +0200

> The kernel is applying the RA managed/otherconf flags silently and
> forgets to send ifinfo notify to inform about their change when the
> router provides a zero reachable_time and retrans_timer as dnsmasq
> and many routers send it, which just means unspecified by this router
> and the host should continue using whatever value it is already using.
> Userspace may monitor the ifinfo notifications to activate dhcpv6.
> 
> Signed-off-by: Marius Tomaschewski <mt@suse.de>

Applied, but more ideally this function should emit only a single
NEWLINK message rather than potentially 3.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes
  2015-08-31 22:13 ` David Miller
@ 2015-08-31 23:43   ` Marius Tomaschewski
  2015-08-31 23:50     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Tomaschewski @ 2015-08-31 23:43 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Am 01.09.2015 um 00:13 schrieb David Miller:
> From: Marius Tomaschewski <mt@suse.de>
> Date: Mon, 31 Aug 2015 15:59:22 +0200
> 
>> The kernel is applying the RA managed/otherconf flags silently and
>> forgets to send ifinfo notify to inform about their change when the
>> router provides a zero reachable_time and retrans_timer as dnsmasq
>> and many routers send it, which just means unspecified by this router
>> and the host should continue using whatever value it is already using.
>> Userspace may monitor the ifinfo notifications to activate dhcpv6.
>>
>> Signed-off-by: Marius Tomaschewski <mt@suse.de>
> 
> Applied, but more ideally this function should emit only a single
> NEWLINK message rather than potentially 3.

Yes, you're right of course.

I've attached a follow-up patch doing this. Please let me know if you
need it in a separate mail.

Gruesse / Regards,
 Marius Tomaschewski <mt@suse.de>, <mt@suse.com>
-- 
 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
 Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg),
 Maxfeldstraße 5, 90409 Nürnberg, Germany

[-- Attachment #2: 0002-ipv6-send-only-one-NEWLINK-when-RA-causes-changes.patch --]
[-- Type: text/x-patch, Size: 1622 bytes --]

>From b6b55b5383c9b89cfd5ad9b4584c044c6c8d3722 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 1 Sep 2015 01:40:57 +0200
Subject: [PATCH] ipv6: send only one NEWLINK when RA causes changes

Signed-off-by: Marius Tomaschewski <mt@suse.de>

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 99ea9dd..7baca60 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1075,6 +1075,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	int optlen;
 	unsigned int pref = 0;
 	__u32 old_if_flags;
+	int send_ifinfo_notify = 0;
 
 	__u8 *opt = (__u8 *)(ra_msg + 1);
 
@@ -1154,7 +1155,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 					IF_RA_OTHERCONF : 0);
 
 	if (old_if_flags != in6_dev->if_flags)
-		inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+		send_ifinfo_notify = 1;
 
 	if (!in6_dev->cnf.accept_ra_defrtr) {
 		ND_PRINTK(2, info,
@@ -1259,7 +1260,7 @@ skip_defrtr:
 				rtime = HZ/10;
 			NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
 			in6_dev->tstamp = jiffies;
-			inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+			send_ifinfo_notify = 1;
 		}
 
 		rtime = ntohl(ra_msg->reachable_time);
@@ -1276,11 +1277,17 @@ skip_defrtr:
 					      GC_STALETIME, 3 * rtime);
 				in6_dev->nd_parms->reachable_time = neigh_rand_reach_time(rtime);
 				in6_dev->tstamp = jiffies;
-				inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+				send_ifinfo_notify = 1;
 			}
 		}
 	}
 
+	/*
+	 *	Send a notify if RA changed managed/otherconf flags or timer settings
+	 */
+	if (send_ifinfo_notify)
+		inet6_ifinfo_notify(RTM_NEWLINK, in6_dev);
+
 skip_linkparms:
 
 	/*
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes
  2015-08-31 23:43   ` Marius Tomaschewski
@ 2015-08-31 23:50     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-08-31 23:50 UTC (permalink / raw)
  To: mt; +Cc: netdev

From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 1 Sep 2015 01:43:39 +0200

> I've attached a follow-up patch doing this. Please let me know if you
> need it in a separate mail.

I want it in a separate mail, and please use "bool" for the type.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-31 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-31 13:59 [PATCH] ipv6: send NEWLINK on RA managed/otherconf changes Marius Tomaschewski
2015-08-31 22:13 ` David Miller
2015-08-31 23:43   ` Marius Tomaschewski
2015-08-31 23:50     ` David Miller

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).