From: Felix Fietkau Date: Fri, 5 Feb 2016 15:43:53 +0000 (+0100) Subject: rules: process rules after the local table to ensure that local access still works X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;ds=sidebyside;h=35cc60dc4dd8ea4c921dbe64bb2376ab9aee76e1;p=project%2Frelayd.git rules: process rules after the local table to ensure that local access still works Signed-off-by: Felix Fietkau --- diff --git a/route.c b/route.c index df933b1..6cea299 100644 --- a/route.c +++ b/route.c @@ -66,6 +66,10 @@ rtnl_rule_request(struct relayd_interface *rif, int flags) struct rtattr rta; int table; } __packed table; + struct { + struct rtattr rta; + int prio; + } __packed prio; struct { struct rtattr rta; char ifname[IFNAMSIZ + 1]; @@ -77,6 +81,11 @@ rtnl_rule_request(struct relayd_interface *rif, int flags) .rtm_scope = RT_SCOPE_UNIVERSE, .rtm_protocol = RTPROT_BOOT, }, + .prio = { + .rta.rta_type = FRA_PRIORITY, + .rta.rta_len = sizeof(req.prio), + .prio = 2, + }, .table.rta = { .rta_type = FRA_TABLE, .rta_len = sizeof(req.table), @@ -94,11 +103,8 @@ rtnl_rule_request(struct relayd_interface *rif, int flags) strcpy(req.dev.ifname, ifname); req.dev.rta.rta_len = sizeof(req.dev.rta) + strlen(ifname) + 1; } else { - uint32_t val = 1; - req.dev.rta.rta_type = FRA_PRIORITY; - req.dev.rta.rta_len = sizeof(req.dev.rta) + sizeof(uint32_t); - padding -= sizeof(uint32_t); - memcpy(&req.dev.ifname, &val, sizeof(val)); + padding = sizeof(req.dev); + req.prio.prio--; } req.table.table = get_route_table(rif); req.nl.nlmsg_len = sizeof(req) - padding;