Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets

2016-09-27 Thread Cyrill Gorcunov
On Tue, Sep 27, 2016 at 08:39:59AM -0700, Eric Dumazet wrote: ... > > + } > > + if (sk && !atomic_inc_not_zero(&sk->sk_refcnt)) > > + sk = NULL; > > Minor detail, but note that raw sockets do not use rcu (yet) > > Since you have read_lock(&hashinfo->lock), no writer can suddenly cha

Re: [PATCH v4] net: ip, diag -- Add diag interface for raw sockets

2016-09-27 Thread Eric Dumazet
On Tue, 2016-09-27 at 18:08 +0300, Cyrill Gorcunov wrote: > +static struct sock *raw_sock_get(struct net *net, const struct > inet_diag_req_v2 *r) > +{ > + struct raw_hashinfo *hashinfo = raw_get_hashinfo(r); > + struct sock *sk = NULL, *s; > + int slot; > + > + if (IS_ERR(hashinf

[PATCH v4] net: ip, diag -- Add diag interface for raw sockets

2016-09-27 Thread Cyrill Gorcunov
In criu we are actively using diag interface to collect sockets present in the system when dumping applications. And while for unix, tcp, udp[lite], packet, netlink it works as expected, the raw sockets do not have. Thus add it. v2: - add missing sock_put calls in raw_diag_dump_one (by eric.dumaz