]> git.proxmox.com Git - mirror_frr.git/blobdiff - nhrpd/linux.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / nhrpd / linux.c
index bcf97f030a8624500b68288b4143a71b7dfbef43..eb98166872c650658a2e0515735bec994a864fef 100644 (file)
@@ -1,36 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* NHRP daemon Linux specific glue
  * Copyright (c) 2014-2015 Timo Teräs
- *
- * This file is free software: you may copy, redistribute and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "zebra.h"
 
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
 #include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <asm/types.h>
-#include <arpa/inet.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <linux/ip.h>
-#include <linux/if_arp.h>
-#include <linux/if_tunnel.h>
-#include <linux/limits.h>
+#include <linux/if_packet.h>
 
 #include "nhrp_protocol.h"
 #include "os.h"
-#include "netlink.h"
 
 #ifndef HAVE_STRLCPY
 size_t strlcpy(char *__restrict dest,
@@ -60,7 +39,7 @@ int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr,
                .msg_iov = &iov,
                .msg_iovlen = 1,
        };
-       int status;
+       int status, fd;
 
        if (addrlen > sizeof(lladdr.sll_addr))
                return -1;
@@ -72,7 +51,11 @@ int os_sendmsg(const uint8_t *buf, size_t len, int ifindex, const uint8_t *addr,
        lladdr.sll_halen = addrlen;
        memcpy(lladdr.sll_addr, addr, addrlen);
 
-       status = sendmsg(os_socket(), &msg, 0);
+       fd = os_socket();
+       if (fd < 0)
+               return -1;
+
+       status = sendmsg(fd, &msg, 0);
        if (status < 0)
                return -errno;