Comments

With this patch, a netlink message is sent each time a packet socket is created
or deleted.
The framework is generic, so it's easy to add the notification for other kind of
sockets.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
This patch was sent the first time in a serie of 5 patches, but was not
included with the last version of this serie. Hence, I resend it as v3,
after a rebase on net-next.
I'm not sure if this patch was acceptable or not (from a security point of
view). Note that BPF filters and uid are not put in the messsage, because
user_ns is unknown.
v3: rebase it on net-next
export the symbol __sock_diag_notify (af_packet can be compiled as a
module)
v2: add sock_diag_notify_del() to avoid confusion of the meaning of the second
arg of __sock_diag_notify()
include/linux/sock_diag.h | 4 ++++
include/uapi/linux/sock_diag.h | 13 ++++++++++++-
net/core/sock_diag.c | 42 ++++++++++++++++++++++++++++++++++++++++++
net/packet/af_packet.c | 4 ++++
net/packet/diag.c | 30 +++++++++++++++++++++++++-----
5 files changed, 87 insertions(+), 6 deletions(-)

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Fri, 17 May 2013 16:25:38 +0200
> With this patch, a netlink message is sent each time a packet socket> is created or deleted. The framework is generic, so it's easy to> add the notification for other kind of sockets.>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Just curious what you want to use this for.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Le 20/05/2013 08:29, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>> Date: Fri, 17 May 2013 16:25:38 +0200>>> With this patch, a netlink message is sent each time a packet socket>> is created or deleted. The framework is generic, so it's easy to>> add the notification for other kind of sockets.>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>>> Just curious what you want to use this for.
Some HW (custom FPGA, ASICs, NPUs) are able to offload packet captures, so it is
required to notify them.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 21 May 2013 17:14:50 +0200
> Le 20/05/2013 08:29, David Miller a écrit :>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>>> Date: Fri, 17 May 2013 16:25:38 +0200>>>>> With this patch, a netlink message is sent each time a packet socket>>> is created or deleted. The framework is generic, so it's easy to>>> add the notification for other kind of sockets.>>>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>>>>> Just curious what you want to use this for.> Some HW (custom FPGA, ASICs, NPUs) are able to offload packet> captures, so it is required to notify them.
I don't even want to hear about this until you have patches ready
to submit to fully support such a facility.
I'm not applying this patch, sorry.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Le 21/05/2013 20:43, David Miller a écrit :
> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>> Date: Tue, 21 May 2013 17:14:50 +0200>>> Le 20/05/2013 08:29, David Miller a écrit :>>> From: Nicolas Dichtel <nicolas.dichtel@6wind.com>>>> Date: Fri, 17 May 2013 16:25:38 +0200>>>>>>> With this patch, a netlink message is sent each time a packet socket>>>> is created or deleted. The framework is generic, so it's easy to>>>> add the notification for other kind of sockets.>>>>>>>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>>>>>>> Just curious what you want to use this for.>> Some HW (custom FPGA, ASICs, NPUs) are able to offload packet>> captures, so it is required to notify them.>> I don't even want to hear about this until you have patches ready> to submit to fully support such a facility.
Not sure to understand what you're expecting. In our case, configuration is done
by a daemon, hence there is no other kernel patch to support this.
Note that this patch is still a complete feature, it allows to monitor AF_PACKET
socket.
With a patched iproute2:
$ ss -ap0e -M
Netid State Recv-Q Send-Q
Local Address:Port
Peer Address:Port
p_dgr UNCONN 0 0
*:*
* users:(("tcpdump",8630,3)) ino=29477 uid=0 sk=f53fbc00
del p_dgr UNCONN 0 0
*:*
* users:(("tcpdump",8630,3)) ino=29477 uid=0 sk=f53fbc00
Will you accept the patch if I integrate the example in the commit log?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html