ip: add support for multicast rules
Subsystems (2)
PATCH 1/1 ip: add support for multicast rules
This patch adds support for a "ip mrule" command, which is used to configure multicast routing rules.
The corresponding kernel patches have been sent to Dave and should (hopefully) appear in net-next soon.
Quoted 1 line
From
1c21ad3ad0a5cd10d1f8cf9c7c5f5b28ae558103Mon Sep 17 00:00:00 2001
From: Patrick McHardy <[email protected]>
Date: Tue, 13 Apr 2010 17:03:47 +0200
Subject: [PATCH] ip: add support for multicast rules
--- include/linux/fib_rules.h | 8 ++++++++ ip/ip.c | 3 ++- ip/ip_common.h | 1 + ip/iprule.c | 12 ++++++++++++ 4 files changed, 23 insertions(+), 1 deletions(-)
include/linux/fib_rules.h +8 -0
@@ -15,6 +15,14 @@/* 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 +#define FIB_RULES_IPMR 128 +struct fib_rule_hdr {__u8 family;__u8 dst_len;
ip/ip.c +2 -1
@@ -42,7 +42,7 @@ static void usage(void)"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" " ip [ -force ] -batch filename\n" "where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |\n" -" tunnel | tuntap | maddr | mroute | monitor | xfrm }\n" +" tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n" " -f[amily] { inet | inet6 | ipx | dnet | link } |\n" " -o[neline] | -t[imestamp] | -b[atch] [filename] |\n"
@@ -76,6 +76,7 @@ static const struct cmd { { "monitor", do_ipmonitor }, { "xfrm", do_xfrm }, { "mroute", do_multiroute }, + { "mrule", do_multirule }, { "help", do_help }, { 0 } };
ip/ip_common.h +1 -0
@@ -37,6 +37,7 @@ extern int do_iplink(int argc, char **argv);extern int do_ipmonitor (int argc,char **argv);extern int do_multiaddr (int argc,char **argv);extern int do_multiroute (int argc,char **argv); +extern int do_multirule (int argc,char **argv);extern int do_xfrm (int argc,char **argv);static inline int rtm_get_table (struct rtmsg *r,struct rtattr **tb)
ip/iprule.c +12 -0
@@ -436,3 +436,15 @@ int do_iprule(int argc, char **argv)exit (-1 ); } +int do_multirule (int argc,char **argv) +{ +if (preferred_family ==AF_UNSPEC || + preferred_family ==AF_INET ) + preferred_family =FIB_RULES_IPMR ; +else { +fprintf (stderr,"Multicast rules are only supported for IPv4\n" ); +exit (-1 ); + } + +return do_iprule (argc, argv); +}
Signature · 1 line
1.7.0.4
Quoted 5 lines · On Tue, 13 Apr 2010 17:06:24 +0200 Patrick McHardy <[email protected]> wrote:
This patch adds support for a "ip mrule" command, which is used to configure multicast routing rules.
The corresponding kernel patches have been sent to Dave and should (hopefully) appear in net-next soon.
The fib_rules.h file in iproute2 is kept in sync with the kernel headers. But I do not see the definitions of FIB_RULES_IPV4 etc in net-next kernel. What happened to this?
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Tue, 13 Apr 2010 17:06:24 +0200 Patrick McHardy <[email protected]> wrote:
This patch adds support for a "ip mrule" command, which is used to configure multicast routing rules.
Quoted 6 lines
Quoted 2 lines
The corresponding kernel patches have been sent to Dave and should (hopefully) appear in net-next soon.
The
fib_rules.hfile in iproute2 is kept in sync with the kernel headers. But I do not see the definitions ofFIB_RULES_IPV4etc in net-next kernel. What happened to this?
Those got changed again during the addition of IPv6 support. I'll send a new version shortly, including IPv6 support.