And move it from networkd-link.[ch] to relevant files.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <linux/if_arp.h>
+
#include "sd-dhcp-client.h"
#include "sd-ipv4acd.h"
+#include "ipvlan.h"
#include "networkd-address.h"
#include "networkd-dhcp4.h"
#include "networkd-ipv4acd.h"
#include "networkd-link.h"
#include "networkd-manager.h"
+bool link_ipv4acd_supported(Link *link) {
+ assert(link);
+
+ if (link->flags & IFF_LOOPBACK)
+ return false;
+
+ /* ARPHRD_INFINIBAND seems to potentially support IPv4ACD.
+ * But currently sd-ipv4acd only supports ARPHRD_ETHER. */
+ if (link->iftype != ARPHRD_ETHER)
+ return false;
+
+ if (link->hw_addr.length != ETH_ALEN)
+ return false;
+
+ if (ether_addr_is_null(&link->hw_addr.ether))
+ return false;
+
+ if (streq_ptr(link->kind, "vrf"))
+ return false;
+
+ /* L3 or L3S mode do not support ARP. */
+ if (IN_SET(link_get_ipvlan_mode(link), NETDEV_IPVLAN_MODE_L3, NETDEV_IPVLAN_MODE_L3S))
+ return false;
+
+ return true;
+}
+
static int static_ipv4acd_address_remove(Link *link, Address *address, bool on_conflict) {
int r;
typedef struct Address Address;
typedef struct Link Link;
+bool link_ipv4acd_supported(Link *link);
int ipv4acd_configure(Address *address);
int ipv4acd_update_mac(Link *link);
int ipv4acd_start(Link *link);
#include "netif-util.h"
#include "networkd-address.h"
+#include "networkd-ipv4acd.h"
#include "networkd-ipv4ll.h"
#include "networkd-link.h"
#include "networkd-manager.h"
#include "networkd-queue.h"
#include "parse-util.h"
+bool link_ipv4ll_enabled(Link *link) {
+ assert(link);
+
+ if (!link_ipv4acd_supported(link))
+ return false;
+
+ if (!link->network)
+ return false;
+
+ if (link->network->bond)
+ return false;
+
+ return link->network->link_local & ADDRESS_FAMILY_IPV4;
+}
+
static int address_new_from_ipv4ll(Link *link, Address **ret) {
_cleanup_(address_freep) Address *address = NULL;
struct in_addr addr;
typedef struct Link Link;
+bool link_ipv4ll_enabled(Link *link);
+
int ipv4ll_configure(Link *link);
int ipv4ll_update_mac(Link *link);
#include "format-util.h"
#include "fs-util.h"
#include "glyph-util.h"
-#include "ipvlan.h"
#include "missing_network.h"
#include "netlink-util.h"
#include "network-internal.h"
#include "util.h"
#include "vrf.h"
-bool link_ipv4ll_enabled(Link *link) {
- assert(link);
-
- if (link->flags & IFF_LOOPBACK)
- return false;
-
- if (!link->network)
- return false;
-
- if (link->iftype == ARPHRD_CAN)
- return false;
-
- if (link->hw_addr.length != ETH_ALEN)
- return false;
-
- if (ether_addr_is_null(&link->hw_addr.ether))
- return false;
-
- /* ARPHRD_INFINIBAND seems to potentially support IPv4LL.
- * But currently sd-ipv4ll and sd-ipv4acd only support ARPHRD_ETHER. */
- if (link->iftype != ARPHRD_ETHER)
- return false;
-
- if (streq_ptr(link->kind, "vrf"))
- return false;
-
- /* L3 or L3S mode do not support ARP. */
- if (IN_SET(link_get_ipvlan_mode(link), NETDEV_IPVLAN_MODE_L3, NETDEV_IPVLAN_MODE_L3S))
- return false;
-
- if (link->network->bond)
- return false;
-
- return link->network->link_local & ADDRESS_FAMILY_IPV4;
-}
-
bool link_ipv6_enabled(Link *link) {
assert(link);
bool link_ipv6_enabled(Link *link);
int link_ipv6ll_gained(Link *link);
-bool link_ipv4ll_enabled(Link *link);
-
int link_stop_engines(Link *link, bool may_keep_dhcp);
const char* link_state_to_string(LinkState s) _const_;