netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  Fix routing tables with id > 255 for legacy software
@ 2008-06-02 22:09 Krzysztof Oledzki
  2008-06-03  8:08 ` Jarek Poplawski
  0 siblings, 1 reply; 19+ messages in thread
From: Krzysztof Oledzki @ 2008-06-02 22:09 UTC (permalink / raw)
  To: kaber, netdev

>From 4cb8c341fc444afc638cf9ce4efb7e4248e88b5e Mon Sep 17 00:00:00 2001
From: Krzysztof Piotr Oledzki <ole@ans.pl>
Date: Tue, 3 Jun 2008 00:03:41 +0200
Subject: [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=253 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>
---
 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 44c81c7..8bcdea8 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;
-- 
1.5.5.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2008-06-10 22:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-02 22:09 [PATCH] Fix routing tables with id > 255 for legacy software Krzysztof Oledzki
2008-06-03  8:08 ` Jarek Poplawski
2008-06-03 10:37   ` Krzysztof Oledzki
2008-06-03 11:33     ` Jarek Poplawski
2008-06-03 11:47       ` Jarek Poplawski
2008-06-03 12:43       ` Patrick McHardy
2008-06-03 13:03         ` Krzysztof Oledzki
2008-06-03 13:10           ` Patrick McHardy
2008-06-03 15:15             ` Krzysztof Oledzki
2008-06-03 17:49               ` Jarek Poplawski
2008-06-03 17:58                 ` Patrick McHardy
2008-06-03 18:29                   ` Jarek Poplawski
2008-06-03 18:29                   ` Krzysztof Oledzki
2008-06-03 18:42                     ` Jarek Poplawski
2008-06-03 18:28               ` Patrick McHardy
2008-06-03 18:39                 ` Krzysztof Oledzki
2008-06-03 20:28                   ` Patrick McHardy
2008-06-03 23:23                     ` Patrick McHardy
2008-06-10 22:45                       ` David Miller

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).