Skip to content

Commit 709772e

Browse files
ole2pldavem330
authored andcommitted
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>
1 parent 99c6f60 commit 709772e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/linux/rtnetlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ enum rt_class_t
246246
{
247247
RT_TABLE_UNSPEC=0,
248248
/* User defined values */
249+
RT_TABLE_COMPAT=252,
249250
RT_TABLE_DEFAULT=253,
250251
RT_TABLE_MAIN=254,
251252
RT_TABLE_LOCAL=255,

net/ipv4/fib_semantics.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,10 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
960960
rtm->rtm_dst_len = dst_len;
961961
rtm->rtm_src_len = 0;
962962
rtm->rtm_tos = tos;
963-
rtm->rtm_table = tb_id;
963+
if (tb_id < 256)
964+
rtm->rtm_table = tb_id;
965+
else
966+
rtm->rtm_table = RT_TABLE_COMPAT;
964967
NLA_PUT_U32(skb, RTA_TABLE, tb_id);
965968
rtm->rtm_type = type;
966969
rtm->rtm_flags = fi->fib_flags;

0 commit comments

Comments
 (0)