From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: Gerrit Renker <gerrit@erg.abdn.ac.uk>, netdev@vger.kernel.org
Subject: Re: [RFC] sctp/tcp: Question -- ICMPv4 length check (not) redundant?
Date: Fri, 25 Jul 2008 22:15:33 -0400 [thread overview]
Message-ID: <488A88C5.1070105@hp.com> (raw)
In-Reply-To: <20080725152059.GA4656@gerrit.erg.abdn.ac.uk>
Gerrit Renker wrote:
> I wonder if the two pieces of code as marked by the patch below still
> serve a purpose.
>
> From grepping through the net/ code it seems they are both redundant.
>
> This is on the basis that
>
> * the v6 counterparts of these handlers ({tcp,sctp}_v6_err) do not have
> this payload-length check;
>
> * icmp_unreach() in net/ipv4/icmp.c already has this test:
>
> /* Checkin full IP header plus 8 bytes of protocol to
> * avoid additional coding at protocol handlers.
> */
> if (!pskb_may_pull(skb, iph->ihl * 4 + 8))
> goto out;
>
> * a similar test is implemented by icmpv6_notify() in net/ipv6/icmp.c;
>
> * this type of test seems to be absent in all of the following handlers:
> - tcp_v6_err() - sctp_v6_err()
> - __udp4_lib_err() - __udp6_lib_err()
> - ah4_err() - ah6_err()
> - esp4_err() - esp6_err()
> - xfrm_tunnel_err() - xfrm6_tunnel_err()
> - tunnel4_err() - tunnel6_err() - tunnel64_err()
> - ipip_err() - ipip6_err()
> - ip4ip6_err() - ip6ip6_err()
> - ipcomp4_err() - ipcomp6_err()
>
> ---------------------------------------------------------------------------
> The following two are the exceptions in question.
> The question is whether there is a reason for the code marked below.
> ---------------------------------------------------------------------------
>
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -344,11 +344,6 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
> int err;
> struct net *net = dev_net(skb->dev);
>
> - if (skb->len < (iph->ihl << 2) + 8) {
> - ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
> - return;
> - }
> -
> sk = inet_lookup(net, &tcp_hashinfo, iph->daddr, th->dest,
> iph->saddr, th->source, inet_iif(skb));
> if (!sk) {
> --- a/net/sctp/input.c
> +++ b/net/sctp/input.c
> @@ -534,11 +534,6 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
> sk_buff_data_t saveip, savesctp;
> int err;
>
> - if (skb->len < ihlen + 8) {
> - ICMP_INC_STATS_BH(&init_net, ICMP_MIB_INERRORS);
> - return;
> - }
> -
> /* Fix up skb to look at the embedded net header. */
> saveip = skb->network_header;
> savesctp = skb->transport_header;
This one looks useless. Thanks for noticing. I'll remove it.
-vlad
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2008-07-26 2:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 15:20 [RFC] sctp/tcp: Question -- ICMPv4 length check (not) redundant? Gerrit Renker
2008-07-26 2:15 ` Vlad Yasevich [this message]
2008-07-26 4:38 ` David Miller
2008-07-26 7:03 ` Gerrit Renker
2008-07-26 7:36 ` David Miller
2008-07-26 8:10 ` Gerrit Renker
2008-07-27 4:48 ` Herbert Xu
2008-07-27 4:51 ` Herbert Xu
2008-07-28 11:25 ` Gerrit Renker
2008-07-28 13:08 ` Herbert Xu
2008-07-28 13:14 ` Vlad Yasevich
2008-07-28 17:08 ` Gerrit Renker
2008-07-28 17:27 ` Vlad Yasevich
2008-07-28 17:44 ` Gerrit Renker
2008-07-28 18:09 ` Vlad Yasevich
2008-07-30 10:19 ` David Miller
2008-07-30 12:49 ` Vlad Yasevich
2008-07-29 1:56 ` Herbert Xu
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=488A88C5.1070105@hp.com \
--to=vladislav.yasevich@hp.com \
--cc=gerrit@erg.abdn.ac.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.