<varlistentry>
<term><varname>ARP=</varname></term>
<listitem>
- <para>Takes a boolean. If set to true, the IPv4 ARP (low-level Address Resolution Protocol)
- and IPv6 NDP (Neighbor Discovery Protocol) for this interface are enabled. When unset, the
- kernel's default will be used.</para>
- <para> For example, disabling ARP is useful when creating multiple MACVLAN or VLAN virtual
- interfaces atop a single lower-level physical interface, which will then only serve as a
- link/"bridge" device aggregating traffic to the same physical link and not participate in
- the network otherwise. Defaults to unset.</para>
+ <para>Takes a boolean. If set to true, the IPv4 ARP (low-level Address Resolution Protocol) and
+ IPv6 NDP (Neighbor Discovery Protocol) for this interface are enabled. For example, disabling ARP
+ is useful when creating multiple MACVLAN or VLAN virtual interfaces atop a single lower-level
+ physical interface, which will then only serve as a link/"bridge" device aggregating traffic to the
+ same physical link and not participate in the network otherwise. Defaults to unset, and enabled
+ when the IPv4 link-local addressing is enabled in <varname>LinkLocalAddressing=</varname> or an
+ IPv4 address with <varname>DuplicateAddressDetection=</varname> enabled is requested. Otherwise,
+ the kernel's default will be used.</para>
<xi:include href="version-info.xml" xpointer="v232"/>
</listitem>
<varname>MACVLAN=</varname>/<varname>MACVTAP=</varname> has <varname>Mode=passthru</varname>,
or <option>ipv6</option> otherwise.</para>
+ <para>When IPv4 link-local addressing is enabled, <varname>ARP=</varname> is enabled unless if it
+ is explicitly configured.</para>
+
<xi:include href="version-info.xml" xpointer="v219"/>
</listitem>
</varlistentry>
<literal>ipv4</literal> for IPv4 link-local addresses (169.254.0.0/16), <literal>ipv6</literal>
for IPv6 addresses, and <literal>none</literal> otherwise.</para>
+ <para>When enabled, regradless implicitly or not, <varname>ARP=</varname> is enabled unless it is
+ explicitly configured.</para>
+
<xi:include href="version-info.xml" xpointer="v232"/>
</listitem>
</varlistentry>
return link_ipv4acd_supported(link);
}
+bool link_ipv4acd_enabled(Link *link) {
+ assert(link);
+ assert(link->network);
+
+ Address *address;
+ ORDERED_HASHMAP_FOREACH(address, link->network->addresses_by_section)
+ if (address_ipv4acd_enabled(link, address))
+ return true;
+
+ return false;
+}
+
bool ipv4acd_bound(Link *link, const Address *address) {
sd_ipv4acd *acd;
typedef struct Link Link;
bool link_ipv4acd_supported(Link *link);
+bool link_ipv4acd_enabled(Link *link);
bool ipv4acd_bound(Link *link, const Address *address);
int ipv4acd_configure(Link *link, const Address *address);
void ipv4acd_detach(Link *link, const Address *address);
#include "netlink-util.h"
#include "networkd-address.h"
#include "networkd-can.h"
+#include "networkd-ipv4acd.h"
+#include "networkd-ipv4ll.h"
#include "networkd-link.h"
#include "networkd-manager.h"
#include "networkd-queue.h"
return set_link_handler_internal(rtnl, m, req, link, /* ignore = */ true, get_link_default_handler);
}
+static int link_get_arp(Link *link) {
+ assert(link);
+
+ /* This returns tristate. */
+
+ if (!link->network)
+ return -1;
+
+ /* If ARP= is explicitly specified, use the setting. */
+ if (link->network->arp >= 0)
+ return link->network->arp;
+
+ /* Enable ARP when IPv4ACD is enabled. */
+ if (link_ipv4acd_enabled(link))
+ return true;
+
+ /* Similary, enable ARP when IPv4LL is enabled. */
+ if (link_ipv4ll_enabled(link))
+ return true;
+
+ /* Otherwise, do not change the flag. */
+ return -1;
+}
+
static int link_configure_fill_message(
Link *link,
sd_netlink_message *req,
case REQUEST_TYPE_SET_LINK_FLAGS: {
unsigned ifi_change = 0, ifi_flags = 0;
- if (link->network->arp >= 0) {
+ int arp = link_get_arp(link);
+
+ if (arp >= 0) {
ifi_change |= IFF_NOARP;
- SET_FLAG(ifi_flags, IFF_NOARP, link->network->arp == 0);
+ SET_FLAG(ifi_flags, IFF_NOARP, arp == 0);
}
if (link->network->multicast >= 0) {
assert(link);
assert(link->network);
- if (link->network->arp < 0 &&
+ if (link_get_arp(link) < 0 &&
link->network->multicast < 0 &&
link->network->allmulticast < 0 &&
link->network->promiscuous < 0)