Skip to contentSkip to conversation

net: raw: do not report ICMP redirects to user space

PATCH Applied Duan Jiong 2 participants 2 messages Sep 20, 2013 – Sep 24, 2013

Subsystems (2)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 net: raw: do not report ICMP redirects to user space

From: Duan Jiong <[email protected]>

Redirect isn't an error condition, it should leave the error handler without touching the socket.

---
 net/ipv4/raw.c | 4 +++-
 net/ipv6/raw.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
net/ipv4/raw.c +3 -1
index bfec521..193db03 100644
@@ -218,8 +218,10 @@ static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
 
 	if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)
 		ipv4_sk_update_pmtu(skb, sk, info);
-	else if (type == ICMP_REDIRECT)
+	else if (type == ICMP_REDIRECT) {
 		ipv4_sk_redirect(skb, sk);
+		return;
+	}
 
 	/* Report error on raw socket, if:
 	   1. User requested ip_recverr.
net/ipv6/raw.c +3 -1
index 58916bb..a4ed241 100644
@@ -335,8 +335,10 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
 		ip6_sk_update_pmtu(skb, sk, info);
 		harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
 	}
-	if (type == NDISC_REDIRECT)
+	if (type == NDISC_REDIRECT) {
 		ip6_sk_redirect(skb, sk);
+		return;
+	}
 	if (np->recverr) {
 		u8 *payload = skb->data;
 		if (!inet->hdrincl)
Signature · 1 line
1.8.3.1