From: Yu Watanabe Date: Thu, 9 May 2019 05:21:06 +0000 (+0200) Subject: network: move link_lldp_emit_enabled() to networkd-lldp-tx.c X-Git-Tag: v243-rc1~452^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0b20047244224d00de89d69faf8256284cad00c1;p=thirdparty%2Fsystemd.git network: move link_lldp_emit_enabled() to networkd-lldp-tx.c --- diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 2b6ff2b6c58..9c6dc4d6d67 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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); diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c index 8fd6365e68b..00c4358a0a8 100644 --- a/src/network/networkd-lldp-tx.c +++ b/src/network/networkd-lldp-tx.c @@ -2,6 +2,7 @@ #include #include +#include #include #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); diff --git a/src/network/networkd-lldp-tx.h b/src/network/networkd-lldp-tx.h index 6842804a7e0..561becda41c 100644 --- a/src/network/networkd-lldp-tx.h +++ b/src/network/networkd-lldp-tx.h @@ -1,8 +1,11 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once +#include + #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);