Skip to contentSkip to conversation

net: support multiple independant multicast routing instances

RFC PATCH In review [email protected] 2 participants 21 messages Apr 11, 2010 – Apr 13, 2010

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

cover net: support multiple independant multicast routing instances

The following patches add support for multiple independant multicast routing instances. This can be useful to seperate traffic when building a multicast router that is serving multiple independant networks. Patch 09 contains a more detailed description of this feature in the changelog.

The patchset consists of the following parts:

- Patch 01 and 02 consolidate a small amount of code in the different fib_rules users.

- Patch 03 decouples fib_rules family values from real address families to allow using them in code that is not a seperate address family without increasing AF_MAX/NPROTO.

- Patch 04 moves the raw_sock/raw_sk() definitions from icmp.h to raw.h since they will also be used by ipmr in a following patch.

- Patch 05-08 contain some preparatory work and cleanup for supporting multiple multicast routing instances.

- Patch 09 contains the actual changes to support multiple multicast routing instances.

These patches have been tested using pimd by myself and using xorp by Ben Greear.

Comments welcome.

#1 lore raw

RFC PATCH 1/9 net: fib_rules: consolidate IPv4 and DECnet ->default_pref() functions.

From: Patrick McHardy <[email protected]>

Both functions are equivalent, consolidate them since a following patch needs a third implementation for multicast routing.

---
 include/net/fib_rules.h |    1 +
 net/core/fib_rules.c    |   18 ++++++++++++++++++
 net/decnet/dn_rules.c   |   19 +------------------
 net/ipv4/fib_rules.c    |   19 +------------------
 4 files changed, 21 insertions(+), 36 deletions(-)
include/net/fib_rules.h +1 -0
index c07ac96..665b9fe 100644
@@ -113,4 +113,5 @@ extern int			fib_rules_lookup(struct fib_rules_ops *,
 extern int			fib_default_rule_add(struct fib_rules_ops *,
 						     u32 pref, u32 table,
 						     u32 flags);
+extern u32			fib_default_rule_pref(struct fib_rules_ops *ops);
 #endif
net/core/fib_rules.c +18 -0
index 2ff3489..ca8215a 100644
@@ -38,6 +38,24 @@ int fib_default_rule_add(struct fib_rules_ops *ops,
 }
 EXPORT_SYMBOL(fib_default_rule_add);
 
+u32 fib_default_rule_pref(struct fib_rules_ops *ops)
+{
+	struct list_head *pos;
+	struct fib_rule *rule;
+
+	if (!list_empty(&ops->rules_list)) {
+		pos = ops->rules_list.next;
+		if (pos->next != &ops->rules_list) {
+			rule = list_entry(pos->next, struct fib_rule, list);
+			if (rule->pref)
+				return rule->pref - 1;
+		}
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(fib_default_rule_pref);
+
 static void notify_rule_change(int event, struct fib_rule *rule,
 			       struct fib_rules_ops *ops, struct nlmsghdr *nlh,
 			       u32 pid);
net/decnet/dn_rules.c +1 -18
index 7466c54..2d14093 100644
@@ -212,23 +212,6 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 
-static u32 dn_fib_rule_default_pref(struct fib_rules_ops *ops)
-{
-	struct list_head *pos;
-	struct fib_rule *rule;
-
-	if (!list_empty(&dn_fib_rules_ops->rules_list)) {
-		pos = dn_fib_rules_ops->rules_list.next;
-		if (pos->next != &dn_fib_rules_ops->rules_list) {
-			rule = list_entry(pos->next, struct fib_rule, list);
-			if (rule->pref)
-				return rule->pref - 1;
-		}
-	}
-
-	return 0;
-}
-
 static void dn_fib_rule_flush_cache(struct fib_rules_ops *ops)
 {
 	dn_rt_cache_flush(-1);
@@ -243,7 +226,7 @@ static struct fib_rules_ops dn_fib_rules_ops_template = {
 	.configure	= dn_fib_rule_configure,
 	.compare	= dn_fib_rule_compare,
 	.fill		= dn_fib_rule_fill,
-	.default_pref	= dn_fib_rule_default_pref,
+	.default_pref	= fib_default_rule_pref,
 	.flush_cache	= dn_fib_rule_flush_cache,
 	.nlgroup	= RTNLGRP_DECnet_RULE,
 	.policy		= dn_fib_rule_policy,
net/ipv4/fib_rules.c +1 -18
index ca2d07b..73b6784 100644
@@ -234,23 +234,6 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 
-static u32 fib4_rule_default_pref(struct fib_rules_ops *ops)
-{
-	struct list_head *pos;
-	struct fib_rule *rule;
-
-	if (!list_empty(&ops->rules_list)) {
-		pos = ops->rules_list.next;
-		if (pos->next != &ops->rules_list) {
-			rule = list_entry(pos->next, struct fib_rule, list);
-			if (rule->pref)
-				return rule->pref - 1;
-		}
-	}
-
-	return 0;
-}
-
 static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
 {
 	return nla_total_size(4) /* dst */
@@ -272,7 +255,7 @@ static struct fib_rules_ops fib4_rules_ops_template = {
 	.configure	= fib4_rule_configure,
 	.compare	= fib4_rule_compare,
 	.fill		= fib4_rule_fill,
-	.default_pref	= fib4_rule_default_pref,
+	.default_pref	= fib_default_rule_pref,
 	.nlmsg_payload	= fib4_rule_nlmsg_payload,
 	.flush_cache	= fib4_rule_flush_cache,
 	.nlgroup	= RTNLGRP_IPV4_RULE,
Signature · 1 line
1.7.0.4
#3 lore raw

RFC PATCH 2/9 net: fib_rules: set family in fib_rule_hdr centrally

In reply to [email protected]

From: Patrick McHardy <[email protected]>

All fib_rules implementations need to set the family in their ->fill() functions. Since the value is available to the generic fib_nl_fill_rule() function, set it there.

---
 net/core/fib_rules.c  |    1 +
 net/decnet/dn_rules.c |    1 -
 net/ipv4/fib_rules.c  |    1 -
 net/ipv6/fib6_rules.c |    1 -
 4 files changed, 1 insertions(+), 3 deletions(-)
net/core/fib_rules.c +1 -0
index ca8215a..9ac60ec 100644
@@ -534,6 +534,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
 		return -EMSGSIZE;
 
 	frh = nlmsg_data(nlh);
+	frh->family = ops->family;
 	frh->table = rule->table;
 	NLA_PUT_U32(skb, FRA_TABLE, rule->table);
 	frh->res1 = 0;
net/decnet/dn_rules.c +0 -1
index 2d14093..1c8cc6d 100644
@@ -196,7 +196,6 @@ static int dn_fib_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
 {
 	struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
 
-	frh->family = AF_DECnet;
 	frh->dst_len = r->dst_len;
 	frh->src_len = r->src_len;
 	frh->tos = 0;
net/ipv4/fib_rules.c +0 -1
index 73b6784..a18355e 100644
@@ -213,7 +213,6 @@ static int fib4_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
 {
 	struct fib4_rule *rule4 = (struct fib4_rule *) rule;
 
-	frh->family = AF_INET;
 	frh->dst_len = rule4->dst_len;
 	frh->src_len = rule4->src_len;
 	frh->tos = rule4->tos;
net/ipv6/fib6_rules.c +0 -1
index 5e463c4..92b2b7f 100644
@@ -208,7 +208,6 @@ static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb,
 {
 	struct fib6_rule *rule6 = (struct fib6_rule *) rule;
 
-	frh->family = AF_INET6;
 	frh->dst_len = rule6->dst.plen;
 	frh->src_len = rule6->src.plen;
 	frh->tos = rule6->tclass;
Signature · 1 line
1.7.0.4
#5 lore raw

RFC PATCH 3/9 net: fib_rules: decouple address families from real address families

In reply to [email protected]

From: Patrick McHardy <[email protected]>

Decouple the address family values used for fib_rules from the real address families in socket.h. This allows to use fib_rules for code that is not a real address family without increasing AF_MAX/NPROTO.

Values up to 127 are reserved for real address families and map directly to the corresponding AF value, values starting from 128 are for other uses. rtnetlink is changed to invoke the AF_UNSPEC dumpit/doit handlers for these families.

---
 include/linux/fib_rules.h |    7 +++++++
 net/core/rtnetlink.c      |   15 ++++++++++-----
 net/decnet/dn_rules.c     |    2 +-
 net/ipv4/fib_rules.c      |    2 +-
 net/ipv6/fib6_rules.c     |    2 +-
 5 files changed, 20 insertions(+), 8 deletions(-)
include/linux/fib_rules.h +7 -0
index 51da65b..405e411 100644
@@ -15,6 +15,13 @@
 /* try to find source address in routing lookups */
 #define FIB_RULE_FIND_SADDR	0x00010000
 
+/* fib_rules families. values up to 127 are reserved for real address
+ * families, values above 128 may be used arbitrarily.
+ */
+#define FIB_RULES_IPV4		AF_INET
+#define FIB_RULES_IPV6		AF_INET6
+#define FIB_RULES_DECNET	AF_DECnet
+
 struct fib_rule_hdr {
 	__u8		family;
 	__u8		dst_len;
net/core/rtnetlink.c +10 -5
index bf919b6..78c8598 100644
@@ -118,7 +118,11 @@ static rtnl_doit_func rtnl_get_doit(int protocol, int msgindex)
 {
 	struct rtnl_link *tab;
 
-	tab = rtnl_msg_handlers[protocol];
+	if (protocol < NPROTO)
+		tab = rtnl_msg_handlers[protocol];
+	else
+		tab = NULL;
+
 	if (tab == NULL || tab[msgindex].doit == NULL)
 		tab = rtnl_msg_handlers[PF_UNSPEC];
 
@@ -129,7 +133,11 @@ static rtnl_dumpit_func rtnl_get_dumpit(int protocol, int msgindex)
 {
 	struct rtnl_link *tab;
 
-	tab = rtnl_msg_handlers[protocol];
+	if (protocol < NPROTO)
+		tab = rtnl_msg_handlers[protocol];
+	else
+		tab = NULL;
+
 	if (tab == NULL || tab[msgindex].dumpit == NULL)
 		tab = rtnl_msg_handlers[PF_UNSPEC];
 
@@ -1444,9 +1452,6 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 		return 0;
 
 	family = ((struct rtgenmsg *)NLMSG_DATA(nlh))->rtgen_family;
-	if (family >= NPROTO)
-		return -EAFNOSUPPORT;
-
 	sz_idx = type>>2;
 	kind = type&3;
 
net/decnet/dn_rules.c +1 -1
index 1c8cc6d..af28dcc 100644
@@ -217,7 +217,7 @@ static void dn_fib_rule_flush_cache(struct fib_rules_ops *ops)
 }
 
 static struct fib_rules_ops dn_fib_rules_ops_template = {
-	.family		= AF_DECnet,
+	.family		= FIB_RULES_DECNET,
 	.rule_size	= sizeof(struct dn_fib_rule),
 	.addr_size	= sizeof(u16),
 	.action		= dn_fib_rule_action,
net/ipv4/fib_rules.c +1 -1
index a18355e..3ec84fe 100644
@@ -246,7 +246,7 @@ static void fib4_rule_flush_cache(struct fib_rules_ops *ops)
 }
 
 static struct fib_rules_ops fib4_rules_ops_template = {
-	.family		= AF_INET,
+	.family		= FIB_RULES_IPV4,
 	.rule_size	= sizeof(struct fib4_rule),
 	.addr_size	= sizeof(u32),
 	.action		= fib4_rule_action,
net/ipv6/fib6_rules.c +1 -1
index 92b2b7f..8124f16 100644
@@ -238,7 +238,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
 }
 
 static struct fib_rules_ops fib6_rules_ops_template = {
-	.family			= AF_INET6,
+	.family			= FIB_RULES_IPV6,
 	.rule_size		= sizeof(struct fib6_rule),
 	.addr_size		= sizeof(struct in6_addr),
 	.action			= fib6_rule_action,
Signature · 1 line
1.7.0.4
#7 lore raw

RFC PATCH 4/9 ipv4: raw: move struct raw_sock and raw_sk() to include/net/raw.h

In reply to [email protected]

From: Patrick McHardy <[email protected]>

A following patch will use struct raw_sock to store state for ipmr, so having the definitions in icmp.h doesn't fit very well anymore.

---
 include/net/icmp.h |   11 -----------
 include/net/raw.h  |   12 ++++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)
include/net/icmp.h +0 -11
index 15b3dfe..6e991e0 100644
@@ -48,15 +48,4 @@ extern void	icmp_out_count(struct net *net, unsigned char type);
 /* Move into dst.h ? */
 extern int 	xrlim_allow(struct dst_entry *dst, int timeout);
 
-struct raw_sock {
-	/* inet_sock has to be the first member */
-	struct inet_sock   inet;
-	struct icmp_filter filter;
-};
-
-static inline struct raw_sock *raw_sk(const struct sock *sk)
-{
-	return (struct raw_sock *)sk;
-}
-
 #endif	/* _ICMP_H */
include/net/raw.h +12 -0
index 6c14a65..67cc643 100644
@@ -19,6 +19,7 @@
 
 
 #include <net/protocol.h>
+#include <linux/icmp.h>
 
 extern struct proto raw_prot;
 
@@ -56,4 +57,15 @@ int raw_seq_open(struct inode *ino, struct file *file,
 void raw_hash_sk(struct sock *sk);
 void raw_unhash_sk(struct sock *sk);
 
+struct raw_sock {
+	/* inet_sock has to be the first member */
+	struct inet_sock   inet;
+	struct icmp_filter filter;
+};
+
+static inline struct raw_sock *raw_sk(const struct sock *sk)
+{
+	return (struct raw_sock *)sk;
+}
+
 #endif	/* _RAW_H */
Signature · 1 line
1.7.0.4
#9 lore raw

RFC PATCH 5/9 ipv4: ipmr: move unres_queue and timer to per-namespace data

In reply to [email protected]

From: Patrick McHardy <[email protected]>

The unres_queue is currently shared between all namespaces. Following patches will additionally allow to create multiple multicast routing tables in each namespace. Having a single shared queue for all these users seems to excessive, move the queue and the cleanup timer to the per-namespace data to unshare it.

As a side-effect, this fixes a bug in the seq file iteration functions: the first entry returned is always from the current namespace, entries returned after that may belong to any namespace.

---
 include/net/netns/ipv4.h |    2 +
 net/ipv4/ipmr.c          |   70 +++++++++++++++++++---------------------------
 2 files changed, 31 insertions(+), 41 deletions(-)
include/net/netns/ipv4.h +2 -0
index 2764994..b15e518 100644
@@ -60,6 +60,8 @@ struct netns_ipv4 {
 
 #ifdef CONFIG_IP_MROUTE
 	struct sock		*mroute_sk;
+	struct timer_list	ipmr_expire_timer;
+	struct mfc_cache	*mfc_unres_queue;
 	struct mfc_cache	**mfc_cache_array;
 	struct vif_device	*vif_table;
 	int			maxvif;
net/ipv4/ipmr.c +29 -41

194 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#11 lore raw

RFC PATCH 6/9 ipv4: ipmr: remove net pointer from struct mfc_cache

In reply to [email protected]

From: Patrick McHardy <[email protected]>

Now that cache entries in unres_queue don't need to be distinguished by their network namespace pointer anymore, we can remove it from struct mfc_cache add pass the namespace as function argument to the functions that need it.

---
 include/linux/mroute.h |   15 -----------
 net/ipv4/ipmr.c        |   65 +++++++++++++++++++++++------------------------
 2 files changed, 32 insertions(+), 48 deletions(-)
include/linux/mroute.h +0 -15
index c5f3d53..de7780a 100644
@@ -192,9 +192,6 @@ struct vif_device {
 
 struct mfc_cache {
 	struct mfc_cache *next;			/* Next entry on cache line 	*/
-#ifdef CONFIG_NET_NS
-	struct net *mfc_net;
-#endif
 	__be32 mfc_mcastgrp;			/* Group the entry belongs to 	*/
 	__be32 mfc_origin;			/* Source of packet 		*/
 	vifi_t mfc_parent;			/* Source interface		*/
@@ -217,18 +214,6 @@ struct mfc_cache {
 	} mfc_un;
 };
 
-static inline
-struct net *mfc_net(const struct mfc_cache *mfc)
-{
-	return read_pnet(&mfc->mfc_net);
-}
-
-static inline
-void mfc_net_set(struct mfc_cache *mfc, struct net *net)
-{
-	write_pnet(&mfc->mfc_net, hold_net(net));
-}
-
 #define MFC_STATIC		1
 #define MFC_NOTIFY		2
 
net/ipv4/ipmr.c +32 -33

227 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#13 lore raw

RFC PATCH 7/9 ipv4: ipmr: convert struct mfc_cache to struct list_head

In reply to [email protected]

From: Patrick McHardy <[email protected]>

---
 include/linux/mroute.h   |    2 +-
 include/net/netns/ipv4.h |    4 +-
 net/ipv4/ipmr.c          |  125 ++++++++++++++++++++++-----------------------
 3 files changed, 64 insertions(+), 67 deletions(-)
include/linux/mroute.h +1 -1
index de7780a..7ff6c77 100644
@@ -191,7 +191,7 @@ struct vif_device {
 #define VIFF_STATIC 0x8000
 
 struct mfc_cache {
-	struct mfc_cache *next;			/* Next entry on cache line 	*/
+	struct list_head list;
 	__be32 mfc_mcastgrp;			/* Group the entry belongs to 	*/
 	__be32 mfc_origin;			/* Source of packet 		*/
 	vifi_t mfc_parent;			/* Source interface		*/
include/net/netns/ipv4.h +2 -2
index b15e518..5d06429 100644
@@ -61,8 +61,8 @@ struct netns_ipv4 {
 #ifdef CONFIG_IP_MROUTE
 	struct sock		*mroute_sk;
 	struct timer_list	ipmr_expire_timer;
-	struct mfc_cache	*mfc_unres_queue;
-	struct mfc_cache	**mfc_cache_array;
+	struct list_head	mfc_unres_queue;
+	struct list_head	*mfc_cache_array;
 	struct vif_device	*vif_table;
 	int			maxvif;
 	atomic_t		cache_resolve_queue_len;
net/ipv4/ipmr.c +61 -64

308 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#16 lore raw

RFC PATCH 8/9 net: ipmr: move mroute data into seperate structure

In reply to [email protected]

From: Patrick McHardy <[email protected]>

---
 include/net/netns/ipv4.h |   13 +--
 net/ipv4/ipmr.c          |  369 +++++++++++++++++++++++++---------------------
 2 files changed, 200 insertions(+), 182 deletions(-)
include/net/netns/ipv4.h +1 -12
index 5d06429..72e762a 100644
@@ -59,18 +59,7 @@ struct netns_ipv4 {
 	atomic_t rt_genid;
 
 #ifdef CONFIG_IP_MROUTE
-	struct sock		*mroute_sk;
-	struct timer_list	ipmr_expire_timer;
-	struct list_head	mfc_unres_queue;
-	struct list_head	*mfc_cache_array;
-	struct vif_device	*vif_table;
-	int			maxvif;
-	atomic_t		cache_resolve_queue_len;
-	int			mroute_do_assert;
-	int			mroute_do_pim;
-#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
-	int			mroute_reg_vif_num;
-#endif
+	struct mr_table		*mrt;
 #endif
 };
 #endif
net/ipv4/ipmr.c +199 -170

1,081 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#18 lore raw

RFC PATCH 9/9 net: ipmr: support multiple tables

In reply to [email protected]

From: Patrick McHardy <[email protected]>

This patch adds support for multiple independant multicast routing instances, named "tables".

Userspace multicast routing daemons can bind to a specific table instance by issuing a setsockopt call using a new option MRT_TABLE. The table number is stored in the raw socket data and affects all following ipmr setsockopt(), getsockopt() and ioctl() calls. By default, a single table (RT_TABLE_DEFAULT) is created with a default routing rule pointing to it. Newly created pimreg devices have the table number appended ("pimregX"), with the exception of devices created in the default table, which are named just "pimreg" for compatibility reasons.

Packets are directed to a specific table instance using routing rules, similar to how regular routing rules work. Currently iif, oif and mark are supported as keys, source and destination addresses could be supported additionally.

Example usage:

- bind pimd/xorp/... to a specific table:

uint32_t table = 123;
setsockopt(fd, IPPROTO_IP, MRT_TABLE, &table, sizeof(table));

- create routing rules directing packets to the new table:

# ip mrule add iif eth0 lookup 123
# ip mrule add oif eth0 lookup 123
---
 include/linux/fib_rules.h |    1 +
 include/linux/mroute.h    |    3 +-
 include/net/netns/ipv4.h  |    5 +
 include/net/raw.h         |    1 +
 net/ipv4/Kconfig          |   14 ++
 net/ipv4/ipmr.c           |  399 ++++++++++++++++++++++++++++++++++++++-------
 6 files changed, 361 insertions(+), 62 deletions(-)
include/linux/fib_rules.h +1 -0
index 405e411..04a3976 100644
@@ -21,6 +21,7 @@
 #define FIB_RULES_IPV4		AF_INET
 #define FIB_RULES_IPV6		AF_INET6
 #define FIB_RULES_DECNET	AF_DECnet
+#define FIB_RULES_IPMR		128
 
 struct fib_rule_hdr {
 	__u8		family;
include/linux/mroute.h +2 -1
index 7ff6c77..fa04b24 100644
@@ -27,7 +27,8 @@
 #define MRT_DEL_MFC	(MRT_BASE+5)	/* Delete a multicast forwarding entry	*/
 #define MRT_VERSION	(MRT_BASE+6)	/* Get the kernel multicast version	*/
 #define MRT_ASSERT	(MRT_BASE+7)	/* Activate PIM assert mode		*/
-#define MRT_PIM		(MRT_BASE+8)	/* enable PIM code	*/
+#define MRT_PIM		(MRT_BASE+8)	/* enable PIM code			*/
+#define MRT_TABLE	(MRT_BASE+9)	/* Specify mroute table ID		*/
 
 #define SIOCGETVIFCNT	SIOCPROTOPRIVATE	/* IP protocol privates */
 #define SIOCGETSGCNT	(SIOCPROTOPRIVATE+1)
include/net/netns/ipv4.h +5 -0
index 72e762a..ae07fee 100644
@@ -59,7 +59,12 @@ struct netns_ipv4 {
 	atomic_t rt_genid;
 
 #ifdef CONFIG_IP_MROUTE
+#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
 	struct mr_table		*mrt;
+#else
+	struct list_head	mr_tables;
+	struct fib_rules_ops	*mr_rules_ops;
+#endif
 #endif
 };
 #endif
include/net/raw.h +1 -0
index 67cc643..43c5750 100644
@@ -61,6 +61,7 @@ struct raw_sock {
 	/* inet_sock has to be the first member */
 	struct inet_sock   inet;
 	struct icmp_filter filter;
+	u32		   ipmr_table;
 };
 
 static inline struct raw_sock *raw_sk(const struct sock *sk)
net/ipv4/Kconfig +14 -0
index c9a1c68..be59774 100644
@@ -250,6 +250,20 @@ config IP_MROUTE
 	  <file:Documentation/networking/multicast.txt>. If you haven't heard
 	  about it, you don't need it.
 
+config IP_MROUTE_MULTIPLE_TABLES
+	bool "IP: multicast policy routing"
+	depends on IP_ADVANCED_ROUTER
+	select FIB_RULES
+	help
+	  Normally, a multicast router runs a userspace daemon and decides
+	  what to do with a multicast packet based on the source and
+	  destination addresses. If you say Y here, the multicast router
+	  will also be able to take interfaces and packet marks into
+	  account and run multiple instances of userspace daemons
+	  simultaneously, each one handling a single table.
+
+	  If unsure, say N.
+
 config IP_PIMSM_V1
 	bool "IP: PIM-SM version 1 support"
 	depends on IP_MROUTE
net/ipv4/ipmr.c +338 -61

656 lines not on this page · raw message

Signature · 1 line
1.7.0.4
maintainer
#4 lore raw

Re: [RFC PATCH 2/9] net: fib_rules: set family in fib_rule_hdr centrally

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:08 +0200

Quoted 7 lines

From: Patrick McHardy <[email protected]>

All fib_rules implementations need to set the family in their ->fill() functions. Since the value is available to the generic fib_nl_fill_rule() function, set it there.

Looks good.

maintainer
#6 lore raw

Re: [RFC PATCH 3/9] net: fib_rules: decouple address families from real address families

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:09 +0200

Quoted 6 lines

From: Patrick McHardy <[email protected]>

Decouple the address family values used for fib_rules from the real address families in socket.h. This allows to use fib_rules for code that is not a real address family without increasing AF_MAX/NPROTO.

Quoted 6 lines

Values up to 127 are reserved for real address families and map directly to the corresponding AF value, values starting from 128 are for other uses. rtnetlink is changed to invoke the AF_UNSPEC dumpit/doit handlers for these families.

Ok.

maintainer
#10 lore raw

Re: [RFC PATCH 5/9] ipv4: ipmr: move unres_queue and timer to per-namespace data

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:11 +0200

Quoted 7 lines

From: Patrick McHardy <[email protected]>

The unres_queue is currently shared between all namespaces. Following patches will additionally allow to create multiple multicast routing tables in each namespace. Having a single shared queue for all these users seems to excessive, move the queue and the cleanup timer to the per-namespace data to unshare it.

Quoted 5 lines

As a side-effect, this fixes a bug in the seq file iteration functions: the first entry returned is always from the current namespace, entries returned after that may belong to any namespace.

This looks good.

maintainer
#12 lore raw

Re: [RFC PATCH 6/9] ipv4: ipmr: remove net pointer from struct mfc_cache

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:12 +0200

Quoted 7 lines

From: Patrick McHardy <[email protected]>

Now that cache entries in unres_queue don't need to be distinguished by their network namespace pointer anymore, we can remove it from struct mfc_cache add pass the namespace as function argument to the functions that need it.

This is ok.

maintainer
#14 lore raw

Re: [RFC PATCH 7/9] ipv4: ipmr: convert struct mfc_cache to struct list_head

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:13 +0200

Quoted 3 lines

From: Patrick McHardy <[email protected]>

Great, it looks like you didn't fall into most of the traps that usually occur during a list_head conversion :-)

But:

Quoted 3 lines
net/ipv4/ipmr.c +1 -2
-		c->next = net->ipv4.mfc_unres_queue;
-		net->ipv4.mfc_unres_queue = c;
+		list_add_tail(&c->list, &net->ipv4.mfc_unres_queue);

...

net/ipv4/ipmr.c static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock) · line 838

Quoted 5 lines
net/ipv4/ipmr.c +1 -2
 	write_lock_bh(&mrt_lock);
-	c->next = net->ipv4.mfc_cache_array[line];
-	net->ipv4.mfc_cache_array[line] = c;
+	list_add_tail(&c->list, &net->ipv4.mfc_cache_array[line]);
 	write_unlock_bh(&mrt_lock);

Are you sure we mean to insert to the tail here? It looks like a head insertion to me beforehand, and the fact that the previous list iterators start at the list head pointer seem to confirm this.

maintainer
#19 lore raw

Re: [RFC PATCH 9/9] net: ipmr: support multiple tables

In reply to [email protected]

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:15 +0200

Quoted 2 lines

This patch adds support for multiple independant multicast routing instances, named "tables".

Ok, this looks fine to me too.

Let me know when you have a final version you'd like me to add to net-next-2.6

#15 lore raw

Re: [RFC PATCH 7/9] ipv4: ipmr: convert struct mfc_cache to struct list_head

In reply to David Miller
Quoted 16 lines · David Miller

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:13 +0200

Quoted 3 lines

From: Patrick McHardy <[email protected]>

Great, it looks like you didn't fall into most of the traps that usually occur during a list_head conversion :-)

But:

Quoted 3 lines
net/ipv4/ipmr.c +1 -2
-		c->next = net->ipv4.mfc_unres_queue;
-		net->ipv4.mfc_unres_queue = c;
+		list_add_tail(&c->list, &net->ipv4.mfc_unres_queue);

...

Quoted 9 lines

net/ipv4/ipmr.c static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock) · line 838

Quoted 5 lines
net/ipv4/ipmr.c +1 -2
 	write_lock_bh(&mrt_lock);
-	c->next = net->ipv4.mfc_cache_array[line];
-	net->ipv4.mfc_cache_array[line] = c;
+	list_add_tail(&c->list, &net->ipv4.mfc_cache_array[line]);
 	write_unlock_bh(&mrt_lock);

Are you sure we mean to insert to the tail here? It looks like a head insertion to me beforehand, and the fact that the previous list iterators start at the list head pointer seem to confirm this.

I don't think it matters since each entry only exists once and there are no ordering requirements, but I'll change it just to make sure.

Thanks for your review so far :)

#20 lore raw

Re: [RFC PATCH 9/9] net: ipmr: support multiple tables

In reply to David Miller
Quoted 11 lines · David Miller

From: [email protected]
Date: Sun, 11 Apr 2010 19:37:15 +0200

Quoted 2 lines

This patch adds support for multiple independant multicast routing instances, named "tables".

Ok, this looks fine to me too.

Let me know when you have a final version you'd like me to add to net-next-2.6

I'll fix up the list thing and resubmit, thanks Dave.