Re: Questions about route realms
From: Atis Elsts
Date: Tue Jan 26 2010 - 08:02:47 EST
On Tuesday 26 January 2010 13:14:17 Anton wrote:
> Two questions:
> 1. Does linux kernel support realms only for IPv4 ? I tried to add an IPv6
> route with realm. It was added but "ip -6 r sh" did not show realm, it
> showed added route without realm. May be this is only tc bug ? I hope ...
> We widely use realms for classifying traffic and if we will use IPv6 I
> don't know how to replace realms by something else.
No, there is no route realm support for IPv6 at the moment AFAIK.
> 2. realm has an unsigned 32 int size. 16-bit src realm and 16-bit dst
> realm. When I'm trying to add route with realm more then 255 it returns
> error. For example "ip r add 192.168.0.0/16 dev ppp0 realm 65000" should
> work but it does not. Is this a bug or am I mistaking ?
According to e.g. this book, source and destination realms "are 8-bit values":
On the other hand, it seems that Linux kernel can handle 16 bit values just
fine, so this could be an unnecessary limitation in iproute.
(There is one exception in Linux kernel, one place where the upper 8 bits are
ignored - for statistics in /proc/net/rt_acct. If, on the other hand, realms
are used for matching in firewall, they should work.)
Can you try this patch?
Allow to have realm values up to 65535 when adding IPv4 routes or rules; Linux
kernel already supports this.
diff --git a/lib/rt_names.c b/lib/rt_names.c
index 52edfe3..a7fdea6 100644
@@ -304,7 +304,7 @@ int rtnl_rtrealm_a2n(__u32 *id, char *arg)
res = strtoul(arg, &end, 0);
- if (!end || end == arg || *end || res > 255)
+ if (!end || end == arg || *end || res > 0xffff)
*id = res;
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html