Skip to contentSkip to conversation

IPv6: Fail with appropriate error code when sending RH0

PATCH Superseded Shan Wei 1 participant 2 messages Jun 27, 2008 – Jul 19, 2008

Subsystems (3)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

PATCH 1/1 IPv6: Fail with appropriate error code when sending RH0

When sending IPv6 packet with RH0(Type 0 Routing Header), return EINVAL instead of EPERM.

---
 net/ipv6/ipv6_sockglue.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/ipv6/ipv6_sockglue.c +4 -1
index 86e28a7..0101d4f 100644
@@ -377,12 +377,15 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 				break;
 #endif
 			default:
+				retv = -EINVAL;
 				goto sticky_done;
 			}
 
 			if ((rthdr->hdrlen & 1) ||
-			    (rthdr->hdrlen >> 1) != rthdr->segments_left)
+			    (rthdr->hdrlen >> 1) != rthdr->segments_left) {
+				retv = -EINVAL;
 				goto sticky_done;
+			}
 		}
 
 		retv = 0;
Signature · 1 line
1.5.4.4 
author
#1 lore raw
Quoted 8 lines · Shan Wei

When sending IPv6 packet with RH0(Type 0 Routing Header), return EINVAL instead of EPERM.

---
 net/ipv6/ipv6_sockglue.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Yoshifuji-san, please take a look at this patch.