netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ICMPV6 param problem with new error code 3 for first fragment not having valid upper layer header
       [not found] ` <1F7D8CC5-832E-4057-B033-7CFFD00CC6FA@juniper.net>
@ 2020-05-12  5:48   ` Preethi Ramachandra
  0 siblings, 0 replies; only message in thread
From: Preethi Ramachandra @ 2020-05-12  5:48 UTC (permalink / raw)
  To: linux-net, yoshfuji, netdev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-12  5:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <A64D75CA-608F-4460-B618-A51AD755FD2C@juniper.net>
     [not found] ` <1F7D8CC5-832E-4057-B033-7CFFD00CC6FA@juniper.net>
2020-05-12  5:48   ` ICMPV6 param problem with new error code 3 for first fragment not having valid upper layer header Preethi Ramachandra

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).