lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 18 Sep 2013 12:55:13 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	aatteka@...ira.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net] ip: generate unique IP identificator if local
 fragmentation is allowed

From: Ansis Atteka <aatteka@...ira.com>
Date: Wed, 18 Sep 2013 09:50:31 -0700

> On Wed, Sep 18, 2013 at 9:20 AM, David Miller <davem@...emloft.net> wrote:
>> From: Ansis Atteka <aatteka@...ira.com>
>> Date: Tue, 17 Sep 2013 15:25:00 -0700
>>
>>> @@ -1317,6 +1317,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
>>>               ttl = ip_select_ttl(inet, &rt->dst);
>>>
>>>       iph = (struct iphdr *)skb->data;
>>> +
>>>       iph->version = 4;
>>>       iph->ihl = 5;
>>>       iph->tos = inet->tos;
>>> @@ -1324,7 +1325,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
>>>       iph->ttl = ttl;
>>>       iph->protocol = sk->sk_protocol;
>>>       ip_copy_addrs(iph, fl4);
>>> -     ip_select_ident(iph, &rt->dst, sk);
>>> +     ip_select_ident(skb, &rt->dst, sk);
>>>
>>>       if (opt) {
>>>               iph->ihl += opt->optlen>>2;
>>
>> This transformation is not equivalent.
>>
>> ip_select_ident() is going to use ip_hdr() which obtains the header
>> pointer via skb_network_header().
>>
>> But here, the code is using skb->data for this, which is different.
> 
> I dared to do that because three lines below ip_options_build() seems
> to be already doing the same thing, if IP options are present:
> 
> struct sk_buff *__ip_make_skb() {
>     ...
>     ip_select_ident(skb, &rt->dst, sk);
>     if (opt) {
>         iph->ihl += opt->optlen>>2;
>         ip_options_build(skb, opt, cork->addr, rt, 0);
>     }
> 
> and
> 
> void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
> __be32 daddr, struct rtable *rt, int is_frag) {
>     unsigned char *iph = skb_network_header(skb);
>     ....

Then change the first hunk to use ip_hdr() if you are so confident.

Having inconsistent calculations of the ip header pointer is just
asking for trouble.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ