Skip to contentSkip to conversation

ipv6: Don't reduce hop limit for an interface

PATCH In review Chas Williams III 2 participants 4 messages Apr 28, 2015 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: Don't reduce hop limit for an interface

Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a

From: "D.S. Ljungmark" <[email protected]>

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, "Parameter Spoofing"

Quoted 8 lines

1. The attacker includes a Current Hop Limit of one or another small number which the attacker knows will cause legitimate packets to be dropped before they reach their destination.

As an example, one possible approach to mitigate this threat is to ignore very small hop limits. The nodes could implement a configurable minimum hop limit, and ignore attempts to set it below said limit.

---
 net/ipv6/ndisc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/ipv6/ndisc.c +8 -1
index 09a22f4..bcd6518 100644
@@ -1193,7 +1193,14 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	if (rt)
 		rt6_set_expires(rt, jiffies + (HZ * lifetime));
 	if (ra_msg->icmph.icmp6_hop_limit) {
-		in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
+		/* Only set hop_limit on the interface if it is higher than
+		 * the current hop_limit.
+		 */
+		if (in6_dev->cnf.hop_limit < ra_msg->icmph.icmp6_hop_limit) {
+			in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit;
+		} else {
+			ND_PRINTK(2, warn, "RA: Got route advertisement with lower hop_limit than current\n");
+		}
 		if (rt)
 			dst_metric_set(&rt->dst, RTAX_HOPLIMIT,
 				       ra_msg->icmph.icmp6_hop_limit);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · Chas Williams III

Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a

From: "D.S. Ljungmark" <[email protected]>

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, "Parameter Spoofing"

Quoted 8 lines

1. The attacker includes a Current Hop Limit of one or another small number which the attacker knows will cause legitimate packets to be dropped before they reach their destination.

As an example, one possible approach to mitigate this threat is to ignore very small hop limits. The nodes could implement a configurable minimum hop limit, and ignore attempts to set it below said limit.

Quoted 6 lines
---
 net/ipv6/ndisc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Why have you sent this, when your name isn't on the commit at all?

What do you want done with this?

Have you read Documentation/stable_kernel_rules.txt?

confused,

greg k-h

#2 lore raw
Quoted 27 lines · Greg KH
Quoted 17 lines · Chas Williams III

Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a

From: "D.S. Ljungmark" <[email protected]>

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, "Parameter Spoofing"

Quoted 8 lines

1. The attacker includes a Current Hop Limit of one or another small number which the attacker knows will cause legitimate packets to be dropped before they reach their destination.

As an example, one possible approach to mitigate this threat is to ignore very small hop limits. The nodes could implement a configurable minimum hop limit, and ignore attempts to set it below said limit.

Quoted 6 lines
---
 net/ipv6/ndisc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Why have you sent this, when your name isn't on the commit at all?

Quoted 7 lines

What do you want done with this?

Have you read Documentation/stable_kernel_rules.txt?

confused,

greg k-h

I didn't write the patch so my name isn't on it but I would like it applied to the 3.14.y stable kernel. I was trying to follow Option #2 from the documentation -- I guess I didn't get it right.

#3 lore raw
Quoted 32 lines · Chas Williams III
Quoted 31 lines · Greg KH
Quoted 17 lines · Chas Williams III

Upstream commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a

From: "D.S. Ljungmark" <[email protected]>

A local route may have a lower hop_limit set than global routes do.

RFC 3756, Section 4.2.7, "Parameter Spoofing"

Quoted 8 lines

1. The attacker includes a Current Hop Limit of one or another small number which the attacker knows will cause legitimate packets to be dropped before they reach their destination.

As an example, one possible approach to mitigate this threat is to ignore very small hop limits. The nodes could implement a configurable minimum hop limit, and ignore attempts to set it below said limit.

Quoted 6 lines
---
 net/ipv6/ndisc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Why have you sent this, when your name isn't on the commit at all?

What do you want done with this?

Have you read Documentation/stable_kernel_rules.txt?

Quoted 7 lines
Quoted 3 lines

confused,

greg k-h

I didn't write the patch so my name isn't on it but I would like it applied to the 3.14.y stable kernel. I was trying to follow Option #2 from the documentation -- I guess I didn't get it right.

Read the section above Option 1 for networking patches, the workflow there is different.

thanks,

greg k-h