summaryrefslogtreecommitdiffstats
path: root/zebra/rtadv.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-11-19 21:46:42 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-11-19 21:51:10 +0100
commit311c15ee60b07dc8afa523799c87fc5f62363284 (patch)
treef3dbb1bf057550840545f0a65bb60389e633d9e5 /zebra/rtadv.c
parentMerge pull request #5354 from mitch-skiba/addpath-fix (diff)
downloadfrr-311c15ee60b07dc8afa523799c87fc5f62363284.tar.xz
frr-311c15ee60b07dc8afa523799c87fc5f62363284.zip
zebra: Router Advertisement socket mess up
The code for when a new vrf is created to properly handle router advertisement for it is messed up in several ways: 1) Generation of the zrouter data structure should set the rtadv socket to -1 so that we don't accidently close someone elses open file descriptor 2) When you created a new zvrf instance *after* bootup we are XCALLOC'ing the data structure so the zvrf->fd was 0. The shutdown code was looking for the >= 0 to know if the fd existed (since fd 0 is valid!) This sequence of events would cause zebra to consume 100% of the cpu: Run zebra by itself ( no other programs ) ip link add vrf1 type vrf table 1003 ip link del vrf vrf1 vtysh -c "configure" -c "no interface vrf1" This commit fixes this issue. Fixes: #5376 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/rtadv.c')
-rw-r--r--zebra/rtadv.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 2228fcfd3..4903455a2 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -2120,14 +2120,8 @@ static void rtadv_event(struct zebra_vrf *zvrf, enum rtadv_event event, int val)
&rtadv->ra_timer);
break;
case RTADV_STOP:
- if (rtadv->ra_timer) {
- thread_cancel(rtadv->ra_timer);
- rtadv->ra_timer = NULL;
- }
- if (rtadv->ra_read) {
- thread_cancel(rtadv->ra_read);
- rtadv->ra_read = NULL;
- }
+ THREAD_OFF(rtadv->ra_timer);
+ THREAD_OFF(rtadv->ra_read);
break;
case RTADV_TIMER:
thread_add_timer(zrouter.master, rtadv_timer, zvrf, val,
@@ -2152,10 +2146,11 @@ void rtadv_init(struct zebra_vrf *zvrf)
if (vrf_is_backend_netns()) {
zvrf->rtadv.sock = rtadv_make_socket(zvrf->zns->ns_id);
zrouter.rtadv_sock = -1;
- } else if (!zrouter.rtadv_sock) {
+ } else {
zvrf->rtadv.sock = -1;
- if (!zrouter.rtadv_sock)
- zrouter.rtadv_sock = rtadv_make_socket(zvrf->zns->ns_id);
+ if (zrouter.rtadv_sock < 0)
+ zrouter.rtadv_sock =
+ rtadv_make_socket(zvrf->zns->ns_id);
}
}