netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Preethi Ramachandra <preethir@juniper.net>
To: "linux-net@vger.kernel.org" <linux-net@vger.kernel.org>,
	"yoshfuji@linux-ipv6.org" <yoshfuji@linux-ipv6.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: ICMPV6 param problem with new error code 3 for first fragment not having valid upper layer header
Date: Tue, 12 May 2020 05:48:06 +0000	[thread overview]
Message-ID: <F4B5B339-1E36-47E8-9AB9-EE4EF4362F7E@juniper.net> (raw)
In-Reply-To: <1F7D8CC5-832E-4057-B033-7CFFD00CC6FA@juniper.net>

As per is_ineligible implementation in net/ipv6/icmp.c. If the incoming icmp is an error or is truncated, responses will not be sent out.
RFC8200 and RFC 7112 states the following:

        “If the first fragment does not include all headers through an
         Upper-Layer header, then that fragment should be discarded and
         an ICMP Parameter Problem, Code 3, message should be sent to
         the source of the fragment, with the Pointer field set to zero.”

In IPV6 TC’s derived from latest RFC 8200 https://www.ipv6ready.org/docs/Core_Conformance_5_0_0.pdf - TC 1.3.6, there is a possibility of next header set to 58(NEXTHDR_ICMP) but there is no ICMP header in first fragment. Second fragment has ICMP header. In this case RFC expects to discard the first fragment and send ICMPV6 param problem with new error code 3. I don’t see this being implemented in latest linux upstream code. Is it ok to change is_ineligible in linux for this specific case?

Linux source code:

/*
* Figure out, may we reply to this packet with icmp error.
*
* We do not reply, if:
*              - it was icmp error message.
*              - it is truncated, so that it is known, that protocol is ICMPV6
*                (i.e. in the middle of some exthdr)
*
*              --ANK (980726)
*/

static bool is_ineligible(const struct sk_buff *skb)
{
                int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
                int len = skb->len - ptr;
                __u8 nexthdr = ipv6_hdr(skb)->nexthdr;
                __be16 frag_off;

                if (len < 0)
                                return true;

                ptr = ipv6_skip_exthdr(skb, ptr, &nexthdr, &frag_off);
                if (ptr < 0)
                                return false;
                if (nexthdr == IPPROTO_ICMPV6) {
                                u8 _type, *tp;
                                tp = skb_header_pointer(skb,
                                                ptr+offsetof(struct icmp6hdr, icmp6_type),
                                                sizeof(_type), &_type);
                                if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
                                                return true;
                }
                return false;
}

Thanks,
Preethi



Juniper Business Use Only

           reply	other threads:[~2020-05-12  5:48 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1F7D8CC5-832E-4057-B033-7CFFD00CC6FA@juniper.net>]

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=F4B5B339-1E36-47E8-9AB9-EE4EF4362F7E@juniper.net \
    --to=preethir@juniper.net \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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).