Fix handling of IPv6 RH with 0 segments left
Subsystems (3)
PATCH 1/1 Fix handling of IPv6 RH with 0 segments left
Fix handling of IPv6 Routing Headers with zero segments left. In that case, we should ignore the extension header and continue with the next one, rather than return a Paramater Problem.
This is more consistent with RFC2461 (§4.4) and
draft-ietf-ipv6-deprecate-rh0.
Signed-off-by Rémi Denis-Courmont <[email protected]>
--- net/ipv6/exthdrs.c | 45 +++++++++++++++++++-------------------------- 1 files changed, 19 insertions(+), 26 deletions(-)
net/ipv6/exthdrs.c +19 -26
@@ -398,32 +398,6 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp) hdr = (struct ipv6_rt_hdr *)skb_transport_header (skb); -switch (hdr->type) { -#ifdef CONFIG_IPV6_MIP6 -case IPV6_SRCRT_TYPE_2 : -break ; -#endif -case IPV6_SRCRT_TYPE_0 : -if (accept_source_route >0 ) -break ; -kfree_skb (skb); -return -1 ; -default : -IP6_INC_STATS_BH (ip6_dst_idev (skb->dst), -IPSTATS_MIB_INHDRERRORS ); -icmpv6_param_prob (skb,ICMPV6_HDR_FIELD , - (&hdr->type) -skb_network_header (skb)); -return -1 ; - } - -if (ipv6_addr_is_multicast (&ipv6_hdr (skb)->daddr) || - skb->pkt_type !=PACKET_HOST ) { -IP6_INC_STATS_BH (ip6_dst_idev (skb->dst), -IPSTATS_MIB_INADDRERRORS ); -kfree_skb (skb); -return -1 ; - } - looped_back:if (hdr->segments_left ==0 ) {switch (hdr->type) {
@@ -454,6 +428,11 @@ looped_back:switch (hdr->type) {case IPV6_SRCRT_TYPE_0 : +/* Silently discard RH0 by default */ +if (accept_source_route <=0 ) { +kfree_skb (skb); +return -1 ; + }if (hdr->hdrlen &0x01 ) {IP6_INC_STATS_BH (ip6_dst_idev (skb->dst),IPSTATS_MIB_INHDRERRORS );
@@ -474,6 +453,20 @@ looped_back: }break ;#endif +default : +IP6_INC_STATS_BH (ip6_dst_idev (skb->dst), +IPSTATS_MIB_INHDRERRORS ); +icmpv6_param_prob (skb,ICMPV6_HDR_FIELD , + (&hdr->type) -skb_network_header (skb)); +return -1 ; + } + +if (ipv6_addr_is_multicast (&ipv6_hdr (skb)->daddr) || + skb->pkt_type !=PACKET_HOST ) { +IP6_INC_STATS_BH (ip6_dst_idev (skb->dst), +IPSTATS_MIB_INADDRERRORS ); +kfree_skb (skb); +return -1 ; }/*
Signature · 6 lines
1.5.2.3 -- Rémi Denis-Courmont http://www.remlab.net/
In article <[email protected]> (at Sat, 7 Jul 2007 17:34:59 +0300), Rémi Denis-Courmont <[email protected]> says:
Quoted 3 lines
Fix handling of IPv6 Routing Headers with zero segments left. In that case, we should ignore the extension header and continue with the next one, rather than return a Paramater Problem.
Remi, patch is already available.
--yoshfuji