From: "Georg Kohmann (geokohma)" <geokohma@cisco.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"pablo@netfilter.org" <pablo@netfilter.org>,
"kadlec@netfilter.org" <kadlec@netfilter.org>,
"fw@strlen.de" <fw@strlen.de>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuznet@ms2.inr.ac.ru" <kuznet@ms2.inr.ac.ru>,
"yoshfuji@linux-ipv6.org" <yoshfuji@linux-ipv6.org>,
"netfilter-devel@vger.kernel.org"
<netfilter-devel@vger.kernel.org>,
"coreteam@netfilter.org" <coreteam@netfilter.org>
Subject: Re: [PATCH net v2] ipv6/netfilter: Discard first fragment not including all headers
Date: Fri, 6 Nov 2020 18:05:27 +0000 [thread overview]
Message-ID: <e5b033cd-8de1-8fe6-5da9-e997a0570db1@cisco.com> (raw)
In-Reply-To: <20201106085815.603de8d6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 06.11.2020 17:58, Jakub Kicinski wrote:
> On Fri, 6 Nov 2020 14:08:03 +0100 Georg Kohmann wrote:
>> diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
>> index c8cf1bb..e6173f5 100644
>> --- a/net/ipv6/reassembly.c
>> +++ b/net/ipv6/reassembly.c
>> @@ -325,7 +325,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
>> const struct ipv6hdr *hdr = ipv6_hdr(skb);
>> struct net *net = dev_net(skb_dst(skb)->dev);
>> __be16 frag_off;
>> - int iif, offset;
>> + int iif;
>> u8 nexthdr;
>>
>> if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
>> @@ -362,24 +362,11 @@ static int ipv6_frag_rcv(struct sk_buff *skb)
>> * the source of the fragment, with the Pointer field set to zero.
>> */
>> nexthdr = hdr->nexthdr;
>> - offset = ipv6_skip_exthdr(skb, skb_transport_offset(skb), &nexthdr, &frag_off);
>> - if (offset >= 0) {
>> - /* Check some common protocols' header */
>> - if (nexthdr == IPPROTO_TCP)
>> - offset += sizeof(struct tcphdr);
>> - else if (nexthdr == IPPROTO_UDP)
>> - offset += sizeof(struct udphdr);
>> - else if (nexthdr == IPPROTO_ICMPV6)
>> - offset += sizeof(struct icmp6hdr);
>> - else
>> - offset += 1;
>> -
>> - if (!(frag_off & htons(IP6_OFFSET)) && offset > skb->len) {
>> - __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
>> - IPSTATS_MIB_INHDRERRORS);
>> - icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
>> - return -1;
>> - }
>> + if (!ipv6_frag_validate(skb, skb_transport_offset(skb), &nexthdr)) {
>> + __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
>> + IPSTATS_MIB_INHDRERRORS);
>> + icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
>> + return -1;
>> }
> net/ipv6/reassembly.c: In function ‘ipv6_frag_rcv’:
> net/ipv6/reassembly.c:327:9: warning: unused variable ‘frag_off’ [-Wunused-variable]
> 327 | __be16 frag_off;
> | ^~~~~~~~
Thanks for telling me. I will fix it.
Georg
prev parent reply other threads:[~2020-11-06 18:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 13:08 [PATCH net v2] ipv6/netfilter: Discard first fragment not including all headers Georg Kohmann
2020-11-06 16:58 ` Jakub Kicinski
2020-11-06 18:05 ` Georg Kohmann (geokohma) [this message]
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=e5b033cd-8de1-8fe6-5da9-e997a0570db1@cisco.com \
--to=geokohma@cisco.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).