Re: Questions about route realms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Tuesday 26 January 2010 13:14:17 Anton wrote:
> Hello.
> 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 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
--- a/lib/rt_names.c
+++ b/lib/rt_names.c
@@ -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)
                return -1;
        *id = res;
        return 0;
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Photo]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]     [Video 4 Linux]