* [PATCH iproute] ip: add support for multicast rules
@ 2010-04-13 15:06 Patrick McHardy
2010-05-19 16:03 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2010-04-13 15:06 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
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.
[-- Attachment #2: mrule.diff --]
[-- Type: text/x-patch, Size: 2934 bytes --]
>From 1c21ad3ad0a5cd10d1f8cf9c7c5f5b28ae558103 Mon Sep 17 00:00:00 2001
From: Patrick McHardy <kaber@trash.net>
Date: Tue, 13 Apr 2010 17:03:47 +0200
Subject: [PATCH] ip: add support for multicast rules
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
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(-)
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 51da65b..04a3976 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -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;
diff --git a/ip/ip.c b/ip/ip.c
index e0cf175..9f29533 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -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 }
};
diff --git a/ip/ip_common.h b/ip/ip_common.h
index c857667..a114186 100644
--- a/ip/ip_common.h
+++ b/ip/ip_common.h
@@ -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)
diff --git a/ip/iprule.c b/ip/iprule.c
index 7140375..abb8752 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -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);
+}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute] ip: add support for multicast rules
2010-04-13 15:06 [PATCH iproute] ip: add support for multicast rules Patrick McHardy
@ 2010-05-19 16:03 ` Stephen Hemminger
2010-05-20 14:01 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2010-05-19 16:03 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Linux Netdev List
On Tue, 13 Apr 2010 17:06:24 +0200
Patrick McHardy <kaber@trash.net> 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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute] ip: add support for multicast rules
2010-05-19 16:03 ` Stephen Hemminger
@ 2010-05-20 14:01 ` Patrick McHardy
0 siblings, 0 replies; 3+ messages in thread
From: Patrick McHardy @ 2010-05-20 14:01 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Linux Netdev List
Stephen Hemminger wrote:
> On Tue, 13 Apr 2010 17:06:24 +0200
> Patrick McHardy <kaber@trash.net> 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?
Those got changed again during the addition of IPv6 support.
I'll send a new version shortly, including IPv6 support.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-20 14:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 15:06 [PATCH iproute] ip: add support for multicast rules Patrick McHardy
2010-05-19 16:03 ` Stephen Hemminger
2010-05-20 14:01 ` Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).