From db2dede403921e8935b53a07c9e908c05edd4c85 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 13 Jan 2011 16:40:42 -0800 Subject: [PATCH] route-table: Process route messages more selectively. This commit cleans up the routing table by preventing it from processing messages which are not relevant for our purposes. --- lib/route-table.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/route-table.c b/lib/route-table.c index dd215f75..440db8fd 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -46,6 +46,7 @@ struct route_data { /* A digested version of a route message sent down by the kernel to indicate * that a route has changed. */ struct route_table_msg { + bool relevant; /* Should this message be processed? */ int nlmsg_type; /* e.g. RTM_NEWROUTE, RTM_DELROUTE. */ struct route_data rd; /* Data parsed from this message. */ }; @@ -232,6 +233,16 @@ route_table_parse(struct ofpbuf *buf, struct route_table_msg *change) } memset(change, 0, sizeof *change); + change->relevant = true; + + if (rtm->rtm_scope == RT_SCOPE_NOWHERE) { + change->relevant = false; + } + + if (rtm->rtm_type != RTN_UNICAST && + rtm->rtm_type != RTN_LOCAL) { + change->relevant = false; + } change->nlmsg_type = nlmsg->nlmsg_type; change->rd.rtm_dst_len = rtm->rtm_dst_len; @@ -254,6 +265,8 @@ route_table_change(const struct route_table_msg *change, void *aux OVS_UNUSED) if (!change) { VLOG_DBG_RL(&rl, "received NULL change message"); route_table_reset(); + } else if (!change->relevant) { + VLOG_DBG_RL(&rl, "ignoring irrelevant change message"); } else if (change->nlmsg_type == RTM_NEWROUTE) { if (!route_node_lookup(&change->rd)) { struct route_node *rn; -- 2.30.2