Skip to contentSkip to conversation

net: Make AF_PACKET handle multiple network namespaces

PATCH Applied Denis V. Lunev 2 participants 2 messages Nov 15, 2007 – Nov 20, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/6 net: Make AF_PACKET handle multiple network namespaces

This is done by making packet_sklist_lock and packet_sklist per network namespace and adding an additional filter condition on received packets to ensure they came from the proper network namespace.

Changes from v1:
- prohibit to call inet_dgram_ops.ioctl in other than init_net

---
 include/net/net_namespace.h |    4 +
 net/packet/af_packet.c      |  131 ++++++++++++++++++++++++++++---------------
 2 files changed, 89 insertions(+), 46 deletions(-)
include/net/net_namespace.h +4 -0
index 90802a6..4d0d634 100644
@@ -32,6 +32,10 @@ struct net {
 	struct hlist_head	*dev_index_head;
 
 	struct sock 		*rtnl;			/* rtnetlink socket */
+
+	/* List of all packet sockets. */
+	rwlock_t		packet_sklist_lock;
+	struct hlist_head	packet_sklist;
 };
 
 #ifdef CONFIG_NET
net/packet/af_packet.c +85 -46

324 lines not on this page · raw message

Signature · 1 line
1.5.3.rc5
maintainer Applied
#1 lore raw

From: "Denis V. Lunev" <[email protected]>
Date: Thu, 15 Nov 2007 18:59:54 +0300

Quoted 10 lines

This is done by making packet_sklist_lock and packet_sklist per network namespace and adding an additional filter condition on received packets to ensure they came from the proper network namespace.

Changes from v1:
- prohibit to call inet_dgram_ops.ioctl in other than init_net

Applied.