#define RTN_FAILED_POLICY 12
#endif
+#ifndef RT_TABLE_PRELOCAL
+#define RT_TABLE_PRELOCAL 128
+#endif
+
#include <string.h>
#include <fcntl.h>
#include <glob.h>
table = RT_TABLE_MAIN;
else if (!strcmp(name, "local"))
table = RT_TABLE_LOCAL;
+ else if (!strcmp(name, "prelocal"))
+ table = RT_TABLE_PRELOCAL;
/* try to look up name in /etc/iproute2/rt_tables */
else if ((f = fopen("/etc/iproute2/rt_tables", "r")) != NULL)
rule.flags = IPRULE_INET4 | IPRULE_PRIORITY | IPRULE_LOOKUP;
rule.priority = 0;
+ rule.lookup = RT_TABLE_PRELOCAL;
+ rv |= system_iprule(&rule, RTM_NEWRULE);
+
+ rule.priority = 1;
rule.lookup = RT_TABLE_LOCAL;
rv |= system_iprule(&rule, RTM_NEWRULE);
rule.flags = IPRULE_INET6 | IPRULE_PRIORITY | IPRULE_LOOKUP;
rule.priority = 0;
+ rule.lookup = RT_TABLE_PRELOCAL;
+ rv |= system_iprule(&rule, RTM_NEWRULE);
+
+ rule.priority = 1;
rule.lookup = RT_TABLE_LOCAL;
rv |= system_iprule(&rule, RTM_NEWRULE);