Skip to content

Commit d5d8760

Browse files
shorman-netronomedavem330
authored andcommitted
sit: correct IP protocol used in ipip6_err
Since 32b8a8e ("sit: add IPv4 over IPv4 support") ipip6_err() may be called for packets whose IP protocol is IPPROTO_IPIP as well as those whose IP protocol is IPPROTO_IPV6. In the case of IPPROTO_IPIP packets the correct protocol value is not passed to ipv4_update_pmtu() or ipv4_redirect(). This patch resolves this problem by using the IP protocol of the packet rather than a hard-coded value. This appears to be consistent with the usage of the protocol of a packet by icmp_socket_deliver() the caller of ipip6_err(). I was able to exercise the redirect case by using a setup where an ICMP redirect was received for the destination of the encapsulated packet. However, it appears that although incorrect the protocol field is not used in this case and thus no problem manifests. On inspection it does not appear that a problem will manifest in the fragmentation needed/update pmtu case either. In short I believe this is a cosmetic fix. None the less, the use of IPPROTO_IPV6 seems wrong and confusing. Reviewed-by: Dinan Gunawardena <dinan.gunawardena@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a547224 commit d5d8760

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv6/sit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,13 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
560560

561561
if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
562562
ipv4_update_pmtu(skb, dev_net(skb->dev), info,
563-
t->parms.link, 0, IPPROTO_IPV6, 0);
563+
t->parms.link, 0, iph->protocol, 0);
564564
err = 0;
565565
goto out;
566566
}
567567
if (type == ICMP_REDIRECT) {
568568
ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0,
569-
IPPROTO_IPV6, 0);
569+
iph->protocol, 0);
570570
err = 0;
571571
goto out;
572572
}

0 commit comments

Comments
 (0)