]> git.proxmox.com Git - mirror_frr.git/blobdiff - vrrpd/vrrp_arp.c
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / vrrpd / vrrp_arp.c
index 8e903e137f20b57f69bf0f1dc5c34e07ab17955f..750050e8c33bd414921112101c121045d7711732 100644 (file)
@@ -124,7 +124,7 @@ void vrrp_garp_send(struct vrrp_router *r, struct in_addr *v4)
        if (ifp->flags & IFF_NOARP) {
                zlog_warn(
                        VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
-                       "Unable to send gratuitous ARP on %s; has IFF_NOARP\n",
+                       "Unable to send gratuitous ARP on %s; has IFF_NOARP",
                        r->vr->vrid, family2str(r->family), ifp->name);
                return;
        }
@@ -132,6 +132,14 @@ void vrrp_garp_send(struct vrrp_router *r, struct in_addr *v4)
        /* Build garp */
        garpbuf_len = vrrp_build_garp(garpbuf, ifp, v4);
 
+       if (garpbuf_len < 0) {
+               zlog_warn(
+                       VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
+                       "Unable to send gratuitous ARP on %s; MAC address unknown",
+                       r->vr->vrid, family2str(r->family), ifp->name);
+               return;
+       };
+
        /* Send garp */
        inet_ntop(AF_INET, v4, astr, sizeof(astr));
 
@@ -180,7 +188,7 @@ void vrrp_garp_init(void)
        /* Create the socket descriptor */
        /* FIXME: why ETH_P_RARP? */
        errno = 0;
-       frr_elevate_privs(&vrrp_privs) {
+       frr_with_privs(&vrrp_privs) {
                garp_fd = socket(PF_PACKET, SOCK_RAW | SOCK_CLOEXEC,
                                 htons(ETH_P_RARP));
        }