All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] ipv6: fix the check when handle RA
@ 2014-07-10  8:29 roy.qing.li
  2014-07-10  9:26 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2014-07-10  8:29 UTC (permalink / raw)
  To: netdev; +Cc: greearb

From: Li RongQing <roy.qing.li@gmail.com>

d9333196572(ipv6:  Allow accepting RA from local IP addresses.) made
ndisc_router_discovery to skip to handle RA when accept_ra_from_local
is 0 and saddr of packet is not the device address, in fact, this
condition should be handled

Fixes: d9333196572(ipv6:  Allow accepting RA from local IP addresses.)
Cc: Ben Greear <greearb@candelatech.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv6/ndisc.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index a845e3d..e70e805 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1152,8 +1152,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * accept_ra_from_local is set to true.
 	 */
 	if (!(in6_dev->cnf.accept_ra_from_local ||
-	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
-			    NULL, 0))) {
+	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
+			     NULL, 0))) {
 		ND_PRINTK(2, info,
 			  "RA from local address detected on dev: %s: default router ignored\n",
 			  skb->dev->name);
@@ -1295,8 +1295,8 @@ skip_linkparms:
 
 #ifdef CONFIG_IPV6_ROUTE_INFO
 	if (!(in6_dev->cnf.accept_ra_from_local ||
-	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
-			    NULL, 0))) {
+	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
+			     NULL, 0))) {
 		ND_PRINTK(2, info,
 			  "RA from local address detected on dev: %s: router info ignored.\n",
 			  skb->dev->name);
-- 
1.7.10.4

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

* Re: [RFC][PATCH] ipv6: fix the check when handle RA
  2014-07-10  8:29 [RFC][PATCH] ipv6: fix the check when handle RA roy.qing.li
@ 2014-07-10  9:26 ` Hannes Frederic Sowa
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Frederic Sowa @ 2014-07-10  9:26 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev, greearb

Hi,

On Do, 2014-07-10 at 16:29 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> d9333196572(ipv6:  Allow accepting RA from local IP addresses.) made
> ndisc_router_discovery to skip to handle RA when accept_ra_from_local
> is 0 and saddr of packet is not the device address, in fact, this
> condition should be handled
> 
> Fixes: d9333196572(ipv6:  Allow accepting RA from local IP addresses.)
> Cc: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
>  net/ipv6/ndisc.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index a845e3d..e70e805 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -1152,8 +1152,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>  	 * accept_ra_from_local is set to true.
>  	 */
>  	if (!(in6_dev->cnf.accept_ra_from_local ||
> -	      ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
> -			    NULL, 0))) {
> +	      !ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
> +			     NULL, 0))) {

Uh!

Instead of double negotiation can you please write

if (!in6_dev->cnf.accept_ra_from_local &&
    ipv6_chk_addr(...)) {
	printk(...);
	goto skip;
}

Thanks for fixing this, good catch!

Thanks,
Hannes

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

end of thread, other threads:[~2014-07-10  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-10  8:29 [RFC][PATCH] ipv6: fix the check when handle RA roy.qing.li
2014-07-10  9:26 ` Hannes Frederic Sowa

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.