[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrWS4_NOL_MZFX=hK+RDaYaVyq-danMU3DY6BZ98SN_5dQ@mail.gmail.com>
Date: Sun, 5 Feb 2017 12:19:16 -0800
From: Andy Lutomirski <luto@...capital.net>
To: David Ahern <dsa@...ulusnetworks.com>
Cc: Alexei Starovoitov <ast@...com>,
"David S . Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
Tejun Heo <tj@...nel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 net] bpf: add bpf_sk_netns_id() helper
On Sun, Feb 5, 2017 at 11:24 AM, David Ahern <dsa@...ulusnetworks.com> wrote:
> On 2/3/17 8:34 PM, Alexei Starovoitov wrote:
>> Therefore introduce 'u64 bpf_sk_netns_id(sk);' helper. It returns
>> unique value that identifies netns of given socket or dev_net(skb->dev)
>> The upper 32-bits of the return value contain device id where namespace
>> filesystem resides and lower 32-bits contain inode number within that filesystem.
>> It's the same as
>> struct stat st;
>> stat("/proc/pid/ns/net", &st);
>> return (st->st_dev << 32) | st->st_ino;
>>
> ...
>
>> can be considered a new feature, whereas for cgroup_sock
>> programs that modify sk->bound_dev_if (like 'ip vrf' does)
>> it's a bug fix, since 'ip vrf' needs to be netns aware.
>>
>
>
> LGTM.
>
> Reviewed-by: David Ahern <dsa@...ulusnetworks.com>
> Tested-by: David Ahern <dsa@...ulusnetworks.com>
>
> Updated patches for vrf in network namespaces are here:
> https://github.com/dsahern/iproute2 vrf/ip-vrf
>
>
> root@...ny-jessie2:~# ip vrf exec red bash
>
> root@...ny-jessie2:red:~# ping -c1 -w1 10.100.1.254
> PING 10.100.1.254 (10.100.1.254) 56(84) bytes of data.
> 64 bytes from 10.100.1.254: icmp_seq=1 ttl=64 time=0.230 ms
>
> --- 10.100.1.254 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 0.230/0.230/0.230/0.000 ms
>
> root@...ny-jessie2:red:~# unshare -n
>
> root@...ny-jessie2:red:~# ping -c1 -w1 10.100.1.254
> connect: Network is unreachable
>
>
> Andy: thank you for the feedback on the 'ip vrf' use case. I believe this kernel patch + my iproute2 patches address the issues mentioned so far. Specifically, the transcript above shows your concern about 'unshare -n' case is handled. In one of the many responses last night, you mentioned I have 'a somewhat kludgey fix that gets the "ip netns" case'. If you can elaborate on 'somewhat kludgey', I can fix those this week as well.
What I meant was: fixing it in iproute2 without kernel changes would
be kludgey and incomplete. You seem to have fixed it by depending on
this kernel patch.
--Andy
Powered by blists - more mailing lists