From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Kernel Netdev Mailing List <netdev@vger.kernel.org>
Subject: [IPROUTE]: Add support for multipath route realms
Date: Tue, 25 Jul 2006 05:58:36 +0200 [thread overview]
Message-ID: <44C596EC.905@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 2783 bytes --]
[IPROUTE]: Add support for multipath route realms
Routing realms exist per nexthop, but iproute currently only allows to send
a single route realm, which is refused by the kernel for multipath routes.
Add support for specifying per nexthop realms. Old kernels only return the
first realm back to userspace when dumping, so the others can't be displayed,
besides that it will also behave correctly on old kernels.
old kernel:
1.2.3.4 realm 1
nexthop dev dummy0 weight 1
nexthop dev dummy1 weight 1
nexthop dev dummy2 weight 1
nexthop dev dummy3 weight 1
new kernel:
1.2.3.4
nexthop realm 1 dev dummy0 weight 1
nexthop realm 2 dev dummy1 weight 1
nexthop realm 3 dev dummy2 weight 1
nexthop realm 4 dev dummy3 weight 1
route queries on both old and new kernel:
1.2.3.4 dev dummy0 src 10.0.0.1 realm 1
cache mtu 1500 advmss 1460 metric 10 64
1.2.3.4 dev dummy1 src 10.0.0.1 realm 2
cache mtu 1500 advmss 1460 metric 10 64
1.2.3.4 dev dummy2 src 10.0.0.1 realm 3
cache mtu 1500 advmss 1460 metric 10 64
1.2.3.4 dev dummy3 src 10.0.0.1 realm 4
cache mtu 1500 advmss 1460 metric 10 64
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit dbc39a8d37d658776a8959d2393b1047ea124436
tree be59669a06709aaa3b194f050529fe3986928dc8
parent 8f8a36487119a3cd1afe86a9649704aca088567b
author Patrick McHardy <kaber@trash.net> Tue, 25 Jul 2006 05:55:36 +0200
committer Patrick McHardy <kaber@trash.net> Tue, 25 Jul 2006 05:55:36 +0200
ip/iproute.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index a43c09e..3544f02 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -557,6 +557,18 @@ #endif
RTA_DATA(tb[RTA_GATEWAY]),
abuf, sizeof(abuf)));
}
+ if (tb[RTA_FLOW]) {
+ __u32 to = *(__u32*)RTA_DATA(tb[RTA_FLOW]);
+ __u32 from = to>>16;
+ to &= 0xFFFF;
+ fprintf(fp, " realm%s ", from ? "s" : "");
+ if (from) {
+ fprintf(fp, "%s/",
+ rtnl_rtrealm_n2a(from, b1, sizeof(b1)));
+ }
+ fprintf(fp, "%s",
+ rtnl_rtrealm_n2a(to, b1, sizeof(b1)));
+ }
}
if (r->rtm_flags&RTM_F_CLONED && r->rtm_type == RTN_MULTICAST) {
fprintf(fp, " %s", ll_index_to_name(nh->rtnh_ifindex));
@@ -606,6 +618,13 @@ int parse_one_nh(struct rtattr *rta, str
rtnh->rtnh_hops = w - 1;
} else if (strcmp(*argv, "onlink") == 0) {
rtnh->rtnh_flags |= RTNH_F_ONLINK;
+ } else if (matches(*argv, "realms") == 0) {
+ __u32 realm;
+ NEXT_ARG();
+ if (get_rt_realms(&realm, *argv))
+ invarg("\"realm\" value is invalid\n", *argv);
+ rta_addattr32(rta, 4096, RTA_FLOW, realm);
+ rtnh->rtnh_len += sizeof(struct rtattr) + 4;
} else
break;
}
next reply other threads:[~2006-07-25 4:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-25 3:58 Patrick McHardy [this message]
2006-07-25 8:19 ` [IPROUTE]: Add support for multipath route realms Herbert Xu
2006-07-25 8:21 ` Herbert Xu
2006-07-25 8:21 ` Patrick McHardy
2006-08-04 17:52 ` Stephen Hemminger
2006-08-04 19:17 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44C596EC.905@trash.net \
--to=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.