All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks
@ 2016-08-07  9:12 Xin Long
  2016-08-12 15:43 ` Phil Sutter
  2016-08-18 21:54 ` Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: Xin Long @ 2016-08-07  9:12 UTC (permalink / raw)
  To: network dev, stephen, phil

Prior to this patch, If one route entry's RTA_PREFSRC and RTA_GATEWAY
both were NULL, it was supposed to be restored ONLY as a local address.

But as it didn't check tb[RTA_PREFSRC] when restoring local networks,
rtattr_cmp would return a success if it was NULL, this route entry would
be restored again as a local network.

This patch is to add tb[RTA_PREFSRC] check when restoring local networks.

Fixes: 74af8dd9620e ("ip route: restore route entries in correct order")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index c52294d..3da23af 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1813,7 +1813,7 @@ static int restore_handler(const struct sockaddr_nl *nl,
 	if (!prio && !tb[RTA_GATEWAY] && (!tb[RTA_PREFSRC] ||
 	    !rtattr_cmp(tb[RTA_PREFSRC], tb[RTA_DST])))
 		goto restore;
-	else if (prio == 1 && !tb[RTA_GATEWAY] &&
+	else if (prio == 1 && !tb[RTA_GATEWAY] && tb[RTA_PREFSRC] &&
 		 rtattr_cmp(tb[RTA_PREFSRC], tb[RTA_DST]))
 		goto restore;
 	else if (prio == 2 && tb[RTA_GATEWAY])
-- 
2.1.0

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

* Re: [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks
  2016-08-07  9:12 [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks Xin Long
@ 2016-08-12 15:43 ` Phil Sutter
  2016-08-17  3:32   ` Xin Long
  2016-08-18 21:54 ` Stephen Hemminger
  1 sibling, 1 reply; 5+ messages in thread
From: Phil Sutter @ 2016-08-12 15:43 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, stephen

On Sun, Aug 07, 2016 at 05:12:30PM +0800, Xin Long wrote:
> Prior to this patch, If one route entry's RTA_PREFSRC and RTA_GATEWAY
> both were NULL, it was supposed to be restored ONLY as a local address.
> 
> But as it didn't check tb[RTA_PREFSRC] when restoring local networks,
> rtattr_cmp would return a success if it was NULL, this route entry would
> be restored again as a local network.
> 
> This patch is to add tb[RTA_PREFSRC] check when restoring local networks.
> 
> Fixes: 74af8dd9620e ("ip route: restore route entries in correct order")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Tested-by: Phil Sutter <phil@nwl.cc>

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

* Re: [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks
  2016-08-12 15:43 ` Phil Sutter
@ 2016-08-17  3:32   ` Xin Long
  2016-08-17 20:54     ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Long @ 2016-08-17  3:32 UTC (permalink / raw)
  To: Phil Sutter, Xin Long, network dev, Stephen Hemminger

Hi, Stephen

any update on this ?

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

* Re: [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks
  2016-08-17  3:32   ` Xin Long
@ 2016-08-17 20:54     ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2016-08-17 20:54 UTC (permalink / raw)
  To: Xin Long; +Cc: Phil Sutter, network dev

On Wed, 17 Aug 2016 11:32:53 +0800
Xin Long <lucien.xin@gmail.com> wrote:

> Hi, Stephen
> 
> any update on this ?

Was waiting long enough to get a comment or two.

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

* Re: [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks
  2016-08-07  9:12 [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks Xin Long
  2016-08-12 15:43 ` Phil Sutter
@ 2016-08-18 21:54 ` Stephen Hemminger
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2016-08-18 21:54 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, phil

On Sun,  7 Aug 2016 17:12:30 +0800
Xin Long <lucien.xin@gmail.com> wrote:

> Prior to this patch, If one route entry's RTA_PREFSRC and RTA_GATEWAY
> both were NULL, it was supposed to be restored ONLY as a local address.
> 
> But as it didn't check tb[RTA_PREFSRC] when restoring local networks,
> rtattr_cmp would return a success if it was NULL, this route entry would
> be restored again as a local network.
> 
> This patch is to add tb[RTA_PREFSRC] check when restoring local networks.
> 
> Fixes: 74af8dd9620e ("ip route: restore route entries in correct order")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied

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

end of thread, other threads:[~2016-08-19  2:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-07  9:12 [PATCH iproute2] ip route: restore_handler should check tb[RTA_PREFSRC] for local networks Xin Long
2016-08-12 15:43 ` Phil Sutter
2016-08-17  3:32   ` Xin Long
2016-08-17 20:54     ` Stephen Hemminger
2016-08-18 21:54 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.