From: David Ahern <dsahern@gmail.com>
To: Damir Mansurov <dnman@oktetlabs.ru>, netdev@vger.kernel.org
Cc: "Alexandra N. Kossovsky" <Alexandra.Kossovsky@oktetlabs.ru>
Subject: Re: The recvmsg() with IP_PKTINFO for local addresses returns various ipi_ifindex
Date: Sun, 12 Aug 2018 16:34:26 -0600 [thread overview]
Message-ID: <44b504ca-722c-552c-6813-5fad799941fd@gmail.com> (raw)
In-Reply-To: <e6e875ca-096f-924d-c1c6-f40339ae3a0c@oktetlabs.ru>
On 8/9/18 2:13 AM, Damir Mansurov wrote:
> Greetings,
>
> I use the IP_PKTINFO to detect ipi_ifindex from which the packet was
> arrived, it used to work for local addresses also.
>
> For local addresses ipi_ifindex always returned 1, but starting from
> Linux 4.14 ip_ifindex began to return various values.
>
> Example host configuration:
> 1: lo: 127.0.0.1
> 2: eth0: 192.168.3.45
> 3: eth1: 192.168.4.45
>
> I use sendto() with addresses {127.0.0.1, 192.168.3.45 and
> 192.168.4.45}, call recvmsg() and than use standard procedure to get
> ipi_ifindex, it shows results:
>
> | ipi_ifindex | ipi_ifindex
> sendto(address) | Linux ver < 4.14 | Linux ver >= 4.14
> ---------------------------------------------------------------
> 127.0.0.1 | 1 | 1
> ---------------------------------------------------------------
> 192.168.3.45 | 1 | 2
> ---------------------------------------------------------------
> 192.168.4.45 | 1 | 3
>
>
> It seems that this behavior depends from commit:
> net: ipv4: set orig_oif based on fib result for local traffic
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=839da4d98960bcc68e6b7b945b33ad3916ec1e92
>
>
> I believe that ipi_ifindex for local addresses should be 1.
> Is there a Bug for Linux >= 4.14 or is this a valid behavior?
The index should be the device with the address. It was reporting
loopback prior to the mentioned commit because loopback is used for
packet Tx which is an implementation detail for sending packets locally.
prev parent reply other threads:[~2018-08-13 1:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-09 8:13 The recvmsg() with IP_PKTINFO for local addresses returns various ipi_ifindex Damir Mansurov
2018-08-12 22:34 ` David Ahern [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=44b504ca-722c-552c-6813-5fad799941fd@gmail.com \
--to=dsahern@gmail.com \
--cc=Alexandra.Kossovsky@oktetlabs.ru \
--cc=dnman@oktetlabs.ru \
--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