From: Simon Horman <simon.horman@netronome.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] sit: correct IP protocol used in ipip6_err
Date: Thu, 16 Jun 2016 17:10:11 +0900 [thread overview]
Message-ID: <20160616081009.GA32730@vergenet.net> (raw)
In-Reply-To: <1466064379-32355-1-git-send-email-simon.horman@netronome.com>
On Thu, Jun 16, 2016 at 05:06:19PM +0900, Simon Horman wrote:
> Since 32b8a8e59c9c ("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>
Apologies for not making this more obvious, this is a "net-next" patch.
> ---
> net/ipv6/sit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index d9f2bd6ef72d..f4356bb13f4b 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -560,13 +560,13 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
>
> if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) {
> ipv4_update_pmtu(skb, dev_net(skb->dev), info,
> - t->parms.link, 0, IPPROTO_IPV6, 0);
> + t->parms.link, 0, iph->protocol, 0);
> err = 0;
> goto out;
> }
> if (type == ICMP_REDIRECT) {
> ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0,
> - IPPROTO_IPV6, 0);
> + iph->protocol, 0);
> err = 0;
> goto out;
> }
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-06-16 8:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 8:06 [PATCH] sit: correct IP protocol used in ipip6_err Simon Horman
2016-06-16 8:10 ` Simon Horman [this message]
2016-06-16 8:23 ` YOSHIFUJI Hideaki
2016-06-16 8:34 ` Simon Horman
2016-06-17 0:11 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160616081009.GA32730@vergenet.net \
--to=simon.horman@netronome.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).