summaryrefslogtreecommitdiff
path: root/src/netlink.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2020-03-02 11:23:36 -0500
committerSimon Kelley <simon@thekelleys.org.uk>2020-03-02 18:11:22 +0000
commitb2ed691eb3ca6488a8878f5f3dd950a07b14a9db (patch)
treea32c2022491806d01b8fe0f08ea2d70375e50984 /src/netlink.c
parent8d6d5730c90df2e2b20c762dbef6e410d29bf73e (diff)
downloaddnsmasq-b2ed691eb3ca6488a8878f5f3dd950a07b14a9db.tar.gz
Ignore routes in non-main tablesv2.81rc1
Route lookup in Linux is bounded by `ip rules` as well as the contents of specific routing tables. With the advent of vrf's(l3mdev's) non-default tables are regularly being used for routing purposes. dnsmasq listens to all route changes on the box and responds to each one with an event. This is *expensive* when a full BGP routing table is placed into the linux kernel, moreso when dnsmasq is responding to events in tables that it will never actually need to respond to, since dnsmasq at this point in time has no concept of vrf's and would need to be programmed to understand them. Help alleviate this load by reducing the set of data that dnsmasq pays attention to when we know there are events that are not useful at this point in time. Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index b63e8b6..d59bf62 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -360,7 +360,9 @@ static void nl_async(struct nlmsghdr *h)
failing. */
struct rtmsg *rtm = NLMSG_DATA(h);
- if (rtm->rtm_type == RTN_UNICAST && rtm->rtm_scope == RT_SCOPE_LINK)
+ if (rtm->rtm_type == RTN_UNICAST && rtm->rtm_scope == RT_SCOPE_LINK &&
+ (rtm->rtm_table == RT_TABLE_MAIN ||
+ rtm->rtm_table == RT_TABLE_LOCAL))
queue_event(EVENT_NEWROUTE);
}
else if (h->nlmsg_type == RTM_NEWADDR || h->nlmsg_type == RTM_DELADDR)