Skip to contentSkip to conversation

ipv6: handle the update of the NDISC_REDIRECT error code in icmpv6_err_convert

PATCH In review Duan Jiong 4 participants 5 messages Sep 18, 2013 – Sep 19, 2013

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv6: handle the update of the NDISC_REDIRECT error code in icmpv6_err_convert

From: Duan Jiong <[email protected]>

when dealing with redirect message in udpv6_err() and rawv6_err() the err shoud be assigned to 0, not EPROTO.

---
 net/ipv6/icmp.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/icmp.c +3 -0
index eef8d94..795f348 100644
@@ -977,6 +977,9 @@ int icmpv6_err_convert(u8 type, u8 code, int *err)
 	case ICMPV6_TIME_EXCEED:
 		*err = EHOSTUNREACH;
 		break;
+	case NDISC_REDIRECT:
+		*err = 0;
+		break;
 	}
 
 	return fatal;
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Duan Jiong <[email protected]>
Date: Wed, 18 Sep 2013 20:04:48 +0800

Quoted 6 lines

From: Duan Jiong <[email protected]>

when dealing with redirect message in udpv6_err() and rawv6_err() the err shoud be assigned to 0, not EPROTO.

No, you should fix this the same way you handled DCCP, but skipping the whole socket error setting path for NDISC_REDIRECT.

Clearing the socket error to zero is not correct, it means you will lose any existing error setting.

#2 lore raw
Quoted 8 lines · David Miller

From: Duan Jiong <[email protected]>
Date: Wed, 18 Sep 2013 20:04:48 +0800

Quoted 5 lines

From: Duan Jiong <[email protected]>

when dealing with redirect message in udpv6_err() and rawv6_err() the err shoud be assigned to 0, not EPROTO.

Quoted 7 lines
Quoted 1 line

No, you should fix this the same way you handled DCCP, but skipping the whole socket error setting path for NDISC_REDIRECT.

Clearing the socket error to zero is not correct, it means you will lose any existing error setting.

My reasoning when I proposed this change was that we should not stop appending ipv6 redirects to the raw and udp sockets error queues because userland could want to deal with them (and probably already does). Also, we need to notify poll of the appended error, hence we still needed a call to sk_err_report to fire up a POLL_ERR event. Because we don't know if the router sending the redirect actually dropped the packet I thought taht '0' would be the only sane choice. We currently report back EPROTO, IPv4 does report (rightfully) EHOSTUNREACH.

Perhaps we should stay with EPROTO?

I agree, all other error functions should return early after updating the routing table without reporting any error. Either they should not call into this function or ignore err == 0 (I prefer the first).

I know, it is a bit hacky but this was the most sane idea I came up with.

(I still have not reviewed this patch, just wanted to provide a bit of background that lead to this change.)

Greetings,

Hannes

#3 lore raw
In reply to David Miller
Quoted 11 lines · David Miller

From: Duan Jiong <[email protected]>
Date: Wed, 18 Sep 2013 20:04:48 +0800

Quoted 6 lines

From: Duan Jiong <[email protected]>

when dealing with redirect message in udpv6_err() and rawv6_err() the err shoud be assigned to 0, not EPROTO.

No, you should fix this the same way you handled DCCP, but skipping the whole socket error setting path for NDISC_REDIRECT.

Your meaning is that we should return directly after calling ip6_sk_redirect(), is that it?

Thanks,
Duan

Quoted 2 lines

Clearing the socket error to zero is not correct, it means you will lose any existing error setting.

maintainer
#4 lore raw

From: Duan Jiong <[email protected]>
Date: Thu, 19 Sep 2013 13:24:04 +0800

Quoted 9 lines
Quoted 8 lines · David Miller

From: Duan Jiong <[email protected]>
Date: Wed, 18 Sep 2013 20:04:48 +0800

Quoted 5 lines

From: Duan Jiong <[email protected]>

when dealing with redirect message in udpv6_err() and rawv6_err() the err shoud be assigned to 0, not EPROTO.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

No, you should fix this the same way you handled DCCP, but skipping the whole socket error setting path for NDISC_REDIRECT.

Your meaning is that we should return directly after calling ip6_sk_redirect(), is that it?

It depends upon whether udp/raw sockets are expected to receive redirect notifications this way, are they? You seem to believe so.