]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: move link_lldp_emit_enabled() to networkd-lldp-tx.c
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 9 May 2019 05:21:06 +0000 (07:21 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2019 21:14:39 +0000 (06:14 +0900)
src/network/networkd-link.c
src/network/networkd-lldp-tx.c
src/network/networkd-lldp-tx.h

index 2b6ff2b6c58d6e1e4f5e97d607934e7317ab6394..9c6dc4d6d676330bda889d72cd8ea5aec5f3c655 100644 (file)
@@ -216,21 +216,6 @@ static bool link_lldp_rx_enabled(Link *link) {
         return link->network->lldp_mode != LLDP_MODE_NO;
 }
 
-static bool link_lldp_emit_enabled(Link *link) {
-        assert(link);
-
-        if (link->flags & IFF_LOOPBACK)
-                return false;
-
-        if (link->iftype != ARPHRD_ETHER)
-                return false;
-
-        if (!link->network)
-                return false;
-
-        return link->network->lldp_emit != LLDP_EMIT_NO;
-}
-
 static bool link_ipv4_forward_enabled(Link *link) {
         assert(link);
 
index 8fd6365e68b42870ba5c719d91dcfce59ccc383c..00c4358a0a89500900de89406815f7fa9913b766 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <endian.h>
 #include <inttypes.h>
+#include <net/if.h>
 #include <string.h>
 
 #include "alloc-util.h"
@@ -9,6 +10,7 @@
 #include "fd-util.h"
 #include "hostname-util.h"
 #include "missing_network.h"
+#include "networkd-link.h"
 #include "networkd-lldp-tx.h"
 #include "networkd-manager.h"
 #include "parse-util.h"
@@ -38,6 +40,21 @@ static const struct ether_addr lldp_multicast_addr[_LLDP_EMIT_MAX] = {
         [LLDP_EMIT_CUSTOMER_BRIDGE] = {{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }},
 };
 
+bool link_lldp_emit_enabled(Link *link) {
+        assert(link);
+
+        if (link->flags & IFF_LOOPBACK)
+                return false;
+
+        if (link->iftype != ARPHRD_ETHER)
+                return false;
+
+        if (!link->network)
+                return false;
+
+        return link->network->lldp_emit != LLDP_EMIT_NO;
+}
+
 static int lldp_write_tlv_header(uint8_t **p, uint8_t id, size_t sz) {
         assert(p);
 
index 6842804a7e0de7b1e78e13169e20b84ce081c77e..561becda41c84fec4d967165e0fe181009e9c637 100644 (file)
@@ -1,8 +1,11 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
+#include <stdbool.h>
+
 #include "conf-parser.h"
-#include "networkd-link.h"
+
+typedef struct Link Link;
 
 typedef enum LLDPEmit {
         LLDP_EMIT_NO,
@@ -12,6 +15,7 @@ typedef enum LLDPEmit {
         _LLDP_EMIT_MAX,
 } LLDPEmit;
 
+bool link_lldp_emit_enabled(Link *link);
 int link_lldp_emit_start(Link *link);
 void link_lldp_emit_stop(Link *link);