|
|
7bb5d0 |
From 595b2e2e87f152c4ade7e2d66cb78915096f60c2 Mon Sep 17 00:00:00 2001
|
|
|
7bb5d0 |
From: Donald Sharp <donaldsharp72@gmail.com>
|
|
|
7bb5d0 |
Date: Mon, 2 Mar 2020 11:23:36 -0500
|
|
|
7bb5d0 |
Subject: [PATCH] Ignore routes in non-main tables
|
|
|
7bb5d0 |
|
|
|
7bb5d0 |
Route lookup in Linux is bounded by `ip rules` as well
|
|
|
7bb5d0 |
as the contents of specific routing tables. With the
|
|
|
7bb5d0 |
advent of vrf's(l3mdev's) non-default tables are regularly being
|
|
|
7bb5d0 |
used for routing purposes.
|
|
|
7bb5d0 |
|
|
|
7bb5d0 |
dnsmasq listens to all route changes on the box and responds
|
|
|
7bb5d0 |
to each one with an event. This is *expensive* when a full
|
|
|
7bb5d0 |
BGP routing table is placed into the linux kernel, moreso
|
|
|
7bb5d0 |
when dnsmasq is responding to events in tables that it will
|
|
|
7bb5d0 |
never actually need to respond to, since dnsmasq at this
|
|
|
7bb5d0 |
point in time has no concept of vrf's and would need
|
|
|
7bb5d0 |
to be programmed to understand them. Help alleviate this load
|
|
|
7bb5d0 |
by reducing the set of data that dnsmasq pays attention to
|
|
|
7bb5d0 |
when we know there are events that are not useful at this
|
|
|
7bb5d0 |
point in time.
|
|
|
7bb5d0 |
|
|
|
7bb5d0 |
Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
|
|
|
7bb5d0 |
(cherry picked from commit b2ed691eb3ca6488a8878f5f3dd950a07b14a9db)
|
|
|
7bb5d0 |
---
|
|
|
7bb5d0 |
src/netlink.c | 4 +++-
|
|
|
7bb5d0 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
7bb5d0 |
|
|
|
7bb5d0 |
diff --git a/src/netlink.c b/src/netlink.c
|
|
|
7bb5d0 |
index 8cd51af..0a3da3e 100644
|
|
|
7bb5d0 |
--- a/src/netlink.c
|
|
|
7bb5d0 |
+++ b/src/netlink.c
|
|
|
7bb5d0 |
@@ -363,7 +363,9 @@ static void nl_async(struct nlmsghdr *h)
|
|
|
7bb5d0 |
failing. */
|
|
|
7bb5d0 |
struct rtmsg *rtm = NLMSG_DATA(h);
|
|
|
7bb5d0 |
|
|
|
7bb5d0 |
- if (rtm->rtm_type == RTN_UNICAST && rtm->rtm_scope == RT_SCOPE_LINK)
|
|
|
7bb5d0 |
+ if (rtm->rtm_type == RTN_UNICAST && rtm->rtm_scope == RT_SCOPE_LINK &&
|
|
|
7bb5d0 |
+ (rtm->rtm_table == RT_TABLE_MAIN ||
|
|
|
7bb5d0 |
+ rtm->rtm_table == RT_TABLE_LOCAL))
|
|
|
7bb5d0 |
queue_event(EVENT_NEWROUTE);
|
|
|
7bb5d0 |
}
|
|
|
7bb5d0 |
else if (h->nlmsg_type == RTM_NEWADDR || h->nlmsg_type == RTM_DELADDR)
|
|
|
7bb5d0 |
--
|
|
|
7bb5d0 |
2.26.2
|
|
|
7bb5d0 |
|