]> git.puffer.fish Git - mirror/frr.git/commitdiff
vrrpd: set sockets to -1 after closing
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 11 Feb 2019 21:22:05 +0000 (21:22 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
This also fixes a bug where assigning the same address as a VIP twice
would succeed the second time even if it actually failed both times.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vrrpd/vrrp.c

index b01bcb939c5791cfb9c16e21969af6ea88b719c6..14347c239f96f8f988a66828acfa0d2383ca97e8 100644 (file)
@@ -1001,10 +1001,14 @@ done:
                zlog_warn(VRRP_LOGPFX VRRP_LOGPFX_VRID
                          "Failed to initialize VRRP %s router",
                          r->vr->vrid, family2str(r->family));
-               if (r->sock_rx >= 0)
+               if (r->sock_rx >= 0) {
                        close(r->sock_rx);
-               if (r->sock_tx >= 0)
+                       r->sock_rx = -1;
+               }
+               if (r->sock_tx >= 0) {
                        close(r->sock_tx);
+                       r->sock_tx = -1;
+               }
                ret = -1;
        }