Subject: Re: [RFC net-next 4/4] net: ipv6: Initial support for VRFs

From: David Ahern <[email-masked]>
Date: Mon, 21 Sep 2015 18:18:07 -0600

On 9/21/15 6:08 PM, Tom Herbert wrote:
>> diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
>> index 9aadd57808a5..11980ee57507 100644
>> --- a/net/ipv6/datagram.c
>> +++ b/net/ipv6/datagram.c
>> @@ -142,6 +142,10 @@ static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int a
>>                          err = -EINVAL;
>>                          goto out;
>>                  }
>> +       } else if (sk->sk_bound_dev_if &&
>> +                  netif_index_is_l3_master(sock_net(sk),
>
> I suppose I have the same issues with this that were put in the IPv4
> code path. Core IPv6 code should not care about any specific network
> interfaces other than maybe loopback. Generalizing VPF to be l3m
> doesn't really address this point. Have you looked at abstracting more
> of this into the ndo functions (i.e. for source address selection) or
> routing lookup?

Socket binding to an interface makes the socket layer care somewhat 
about references to a device. For this case and the ipv4 version the 
flag needs to be set here because of what the connect function means for 
datagram sockets. Once you go down a layer (to L3/routing) there is no 
proper place to add this flag to the lookups.