netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harsha Chenji <cjkernel@gmail.com>
To: netdev@vger.kernel.org
Subject: ipv4 ID calculation
Date: Mon, 18 Sep 2017 20:43:05 -0400	[thread overview]
Message-ID: <CAMB9WxJpwdZ2gFygTdWZmpLoCG0A79ReCbts-phpT76JfTPHsQ@mail.gmail.com> (raw)

Hi all,

Where is the ID field of the IPv4 header created when the DF flag is
set? I am looking at ip_build_and_send_pkt. The code seems to have
changed in 4.4-rc1:

if (ip_dont_fragment(sk, &rt->dst)) {
    iph->frag_off = htons(IP_DF);
    iph->id = 0;
} else {
    iph->frag_off = 0;
    __ip_select_ident(net, iph, 1);
}

old code (executed irrespective of DF or not):

    ip_select_ident(sock_net(sk), skb, sk);

The code in Stevens is basically iph->id = htons(ip_ident++) and now
it seems to be calculated based on a hash + lookup table.

So where is the id of 0 overwritten when DF is set? Didn't find any
info in the docs.

P.S. - is this the right mailing list for these kind of questions?

Thanks!

             reply	other threads:[~2017-09-19  0:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  0:43 Harsha Chenji [this message]
2017-09-20 21:15 ` ipv4 ID calculation Stephen Hemminger

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=CAMB9WxJpwdZ2gFygTdWZmpLoCG0A79ReCbts-phpT76JfTPHsQ@mail.gmail.com \
    --to=cjkernel@gmail.com \
    --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 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).