net: Fix routing tables with id > 255 for legacy software

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, June 11, 2008 - 6:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=709772...
Commit:     709772e6e06564ed94ba740de70185ac3d792773
Parent:     99c6f60e72f112b57ddb07abb2e5f771ee211f43
Author:     Krzysztof Piotr Oledzki <ole@ans.pl>
AuthorDate: Tue Jun 10 15:44:49 2008 -0700
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Tue Jun 10 15:44:49 2008 -0700

    net: Fix routing tables with id > 255 for legacy software
    
    Most legacy software do not like tables > 255 as rtm_table is u8
    so tb_id is sent &0xff and it is possible to mismatch for example
    table 510 with table 254 (main).
    
    This patch introduces RT_TABLE_COMPAT=252 so the code uses it if
    tb_id > 255. It makes such old applications happy, new
    ones are still able to use RTA_TABLE to get a proper table id.
    
    Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl>
    Acked-by: Patrick McHardy <kaber@trash.net>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/rtnetlink.h |    1 +
 net/ipv4/fib_semantics.c  |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index a2aec2c..b358c70 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -246,6 +246,7 @@ enum rt_class_t
 {
 	RT_TABLE_UNSPEC=0,
 /* User defined values */
+	RT_TABLE_COMPAT=252,
 	RT_TABLE_DEFAULT=253,
 	RT_TABLE_MAIN=254,
 	RT_TABLE_LOCAL=255,
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 3b83c34..0d4d728 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -960,7 +960,10 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
 	rtm->rtm_dst_len = dst_len;
 	rtm->rtm_src_len = 0;
 	rtm->rtm_tos = tos;
-	rtm->rtm_table = tb_id;
+	if (tb_id < 256)
+		rtm->rtm_table = tb_id;
+	else
+		rtm->rtm_table = RT_TABLE_COMPAT;
 	NLA_PUT_U32(skb, RTA_TABLE, tb_id);
 	rtm->rtm_type = type;
 	rtm->rtm_flags = fi->fib_flags;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
net: Fix routing tables with id > 255 for legacy software, Linux Kernel Mailing ..., (Wed Jun 11, 6:01 pm)