From: linmiaohe <linmiaohe@huawei.com>
To: David Ahern <dsa@cumulusnetworks.com>, <shrijeet@gmail.com>,
<davem@davemloft.net>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Mingfangsen <mingfangsen@huawei.com>
Subject: Re: some trouble when using vrf
Date: Wed, 17 Apr 2019 10:22:21 +0800 [thread overview]
Message-ID: <f106ad99-c0a3-346c-f01f-d6e48ab4b628@huawei.com> (raw)
In-Reply-To: <e4aa6621-8d9b-8d69-0562-610bae347ad3@cumulusnetworks.com>
On 2019/4/16 23:20, David Ahern wrote:
> On 4/16/19 5:26 AM, linmiaohe wrote:
>> ...
>> bind(sock_fd, (struct sockaddr *)&addr_serv, sizeof(addr_serv));
>> ...
>> ret = setsockopt(sock_fd, SOL_SOCKET, SO_BINDTODEVICE, bind_dev, strlen(bind_dev)+1);
>> ...
>> This code snipet doesn't work if the ip address of addr_serv is not in default vrf. And
>> "Cannot assign requested address" will occurs.
>
> Applications must bind to the device first and then bind to the local
> address. As I recall this applies regardless of whether it is a VRF or
> other.
>
>
It should be, but unfortunately some applications break this.
>>
>> 2.When I run a udp server in default vrf and set net.ipv4.udp_l3mdev_accept=1,
>> it's supposed to work accorss VRFs.
>
> UDP applications can use cmsg with IP_PKTINFO to send the reply out the
> same device as the request was received. An app can also track the
> relationship of the enslaved device to a VRF to use a VRF based lookup
> to send a response. Choices.
>
>
UDP applications using cmsg with IP_PKTINFO is really a good idea.
>>
>> Thanks a lot if you can help me fix these. Have a nice day.
>>
> .
>
Thanks a lot for your advice.
next prev parent reply other threads:[~2019-04-17 2:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 11:26 linmiaohe
2019-04-16 12:11 ` Mike Manning
2019-04-16 14:16 ` linmiaohe
2019-04-16 15:20 ` David Ahern
2019-04-17 2:22 ` linmiaohe [this message]
2019-04-17 4:56 ` David Ahern
2019-04-17 6:52 ` linmiaohe
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=f106ad99-c0a3-346c-f01f-d6e48ab4b628@huawei.com \
--to=linmiaohe@huawei.com \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingfangsen@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=shrijeet@gmail.com \
/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
all inboxes | Powered by JetHome®