diff options
author | Steven Barth <steven@midlink.org> | 2014-06-20 19:48:32 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-06-20 19:48:32 +0200 |
commit | 07e9b542017c692ee2abe7a8689517b466150944 (patch) | |
tree | 5de40d767a9bdf30d0a2bf6ad2235f01dc37dbdb /system-linux.c | |
parent | 65cab45660dd0b234b663a39a133c64271f667b7 (diff) |
system: fix treatment of RT_TABLE_MAIN
Do not treat RT_TABLE_MAIN as RT_TABLE_UNSPEC in system_resolve_rt_table() in
order to allow ip rules with lookup main to work as expected.
Provide a new function system_is_default_rt_table() to allow calling code to
specifically test for RT_TABLE_MAIN, this is going to be needed for the
backwards compatible handling of the table attribute in route objects.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/system-linux.c b/system-linux.c index 8f612c9..c6f17e9 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1464,14 +1464,15 @@ bool system_resolve_rt_table(const char *name, unsigned int *id) if (table == RT_TABLE_UNSPEC) return false; - /* do not consider main table special */ - if (table == RT_TABLE_MAIN) - table = RT_TABLE_UNSPEC; - *id = table; return true; } +bool system_is_default_rt_table(unsigned int id) +{ + return (id == RT_TABLE_MAIN); +} + static int system_iprule(struct iprule *rule, int cmd) { int alen = ((rule->flags & IPRULE_FAMILY) == IPRULE_INET4) ? 4 : 16; |