aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-04-13 01:03:23 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-13 17:49:34 -0400
commitf0ad0860d01e47a3ffd220564c5c653b3afbe962 (patch)
tree91b69423f472b934daa2c18ae3b7ba065b7c7898 /include
parent0c12295a741d3186987f96f518cfbdaf01abb087 (diff)
ipv4: ipmr: support multiple tables
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 Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fib_rules.h1
-rw-r--r--include/linux/mroute.h3
-rw-r--r--include/net/netns/ipv4.h5
-rw-r--r--include/net/raw.h1
4 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 405e41139a4d..04a397619ebe 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -21,6 +21,7 @@
21#define FIB_RULES_IPV4 AF_INET 21#define FIB_RULES_IPV4 AF_INET
22#define FIB_RULES_IPV6 AF_INET6 22#define FIB_RULES_IPV6 AF_INET6
23#define FIB_RULES_DECNET AF_DECnet 23#define FIB_RULES_DECNET AF_DECnet
24#define FIB_RULES_IPMR 128
24 25
25struct fib_rule_hdr { 26struct fib_rule_hdr {
26 __u8 family; 27 __u8 family;
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 7ff6c77d6008..fa04b246c9ae 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -27,7 +27,8 @@
27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ 27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ 28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
31#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
31 32
32#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
33#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 72e762ab3e5d..ae07feec6446 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -59,7 +59,12 @@ struct netns_ipv4 {
59 atomic_t rt_genid; 59 atomic_t rt_genid;
60 60
61#ifdef CONFIG_IP_MROUTE 61#ifdef CONFIG_IP_MROUTE
62#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
62 struct mr_table *mrt; 63 struct mr_table *mrt;
64#else
65 struct list_head mr_tables;
66 struct fib_rules_ops *mr_rules_ops;
67#endif
63#endif 68#endif
64}; 69};
65#endif 70#endif
diff --git a/include/net/raw.h b/include/net/raw.h
index 67cc64369432..43c57502659b 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -61,6 +61,7 @@ struct raw_sock {
61 /* inet_sock has to be the first member */ 61 /* inet_sock has to be the first member */
62 struct inet_sock inet; 62 struct inet_sock inet;
63 struct icmp_filter filter; 63 struct icmp_filter filter;
64 u32 ipmr_table;
64}; 65};
65 66
66static inline struct raw_sock *raw_sk(const struct sock *sk) 67static inline struct raw_sock *raw_sk(const struct sock *sk)