[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f106ad99-c0a3-346c-f01f-d6e48ab4b628@huawei.com>
Date:   Wed, 17 Apr 2019 10:22:21 +0800
From:   linmiaohe <linmiaohe@...wei.com>
To:     David Ahern <dsa@...ulusnetworks.com>, <shrijeet@...il.com>,
        <davem@...emloft.net>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
CC:     Mingfangsen <mingfangsen@...wei.com>
Subject: Re: some trouble when using vrf
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.
Powered by blists - more mailing lists
 
