sd-lldp: fix how we create the LLDP listening socket
authorLennart Poettering <lennart@poettering.net>
Thu, 18 Feb 2016 21:45:22 +0000 (22:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 20 Feb 2016 21:42:29 +0000 (22:42 +0100)
Specifiy the ethernet family, and make sure we se the O_CLOEXEC and O_NONBLOCK
bits how we should for all fds.

src/libsystemd-network/lldp-network.c

index 10729e7..f031760 100644 (file)
@@ -57,7 +57,7 @@ int lldp_network_bind_raw_socket(int ifindex) {
 
         assert(ifindex > 0);
 
-        fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+        fd = socket(PF_PACKET, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, htons(ETHERTYPE_LLDP));
         if (fd < 0)
                 return -errno;