This allows both IPv4 and IPv6 link-local addresses to be enabled or disabled. By default
we still enable IPv6LL and disable IPv4LL. The old config option is kept for backwards
compatibility, but removed from the documentation.
</listitem>
</varlistentry>
<varlistentry>
- <term><varname>IPv4LL=</varname></term>
+ <term><varname>LinkLocal=</varname></term>
<listitem>
- <para>A boolean. When true, enables IPv4 link-local support.
- </para>
+ <para>Enables link-local address autoconfiguration. Accepts
+ <literal>yes</literal>, <literal>no</literal>,
+ <literal>ipv4</literal>, or <literal>ipv6</literal>. Defaults to
+ <literal>ipv6</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>
[Network]
DHCP=yes
-IPv4LL=yes
+LinkLocal=yes
[Network]
# Default to using a /28 prefix, giving up to 13 addresses per container.
Address=0.0.0.0/28
-IPv4LL=yes
+LinkLocal=yes
DHCPServer=yes
IPMasquerade=yes
assert(link);
assert(link->network);
- assert(link->network->ipv4ll);
+ assert(IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES));
r = sd_ipv4ll_new(&link->ipv4ll);
if (r < 0)
if (!link->network)
return false;
- return link->network->ipv4ll;
+ return IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV4, ADDRESS_FAMILY_YES);
+}
+
+bool link_ipv6ll_enabled(Link *link) {
+ if (link->flags & IFF_LOOPBACK)
+ return false;
+
+ if (!link->network)
+ return false;
+
+ return IN_SET(link->network->link_local, ADDRESS_FAMILY_IPV6, ADDRESS_FAMILY_YES);
}
bool link_lldp_enabled(Link *link) {
}
}
+ if (!link_ipv6ll_enabled(link)) {
+ r = sd_rtnl_message_open_container(req, IFLA_AF_SPEC);
+ if (r < 0) {
+ log_link_error(link, "Could not open IFLA_AF_SPEC container: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_open_container(req, AF_INET6);
+ if (r < 0) {
+ log_link_error(link, "Could not open AF_INET6 container: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, IN6_ADDR_GEN_MODE_NONE);
+ if (r < 0) {
+ log_link_error(link, "Could not append IFLA_INET6_ADDR_GEN_MODE: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_close_container(req);
+ if (r < 0) {
+ log_link_error(link, "Could not close AF_INET6 contaire: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_rtnl_message_close_container(req);
+ if (r < 0) {
+ log_link_error(link, "Could not close IFLA_AF_SPEC contaire: %s", strerror(-r));
+ return r;
+ }
+ }
+
r = sd_rtnl_call_async(link->manager->rtnl, req, link_up_handler, link,
0, NULL);
if (r < 0) {
return r;
if (link->flags & IFF_LOOPBACK) {
- if (network->ipv4ll)
- log_link_debug(link, "ignoring IPv4LL for loopback link");
+ if (network->link_local != ADDRESS_FAMILY_NO)
+ log_link_debug(link, "ignoring link-local autoconfiguration for loopback link");
if (network->dhcp != ADDRESS_FAMILY_NO)
log_link_debug(link, "ignoring DHCP clients for loopback link");
bool link_lldp_enabled(Link *link);
bool link_ipv4ll_enabled(Link *link);
+bool link_ipv6ll_enabled(Link *link);
bool link_dhcp4_server_enabled(Link *link);
bool link_dhcp4_enabled(Link *link);
bool link_dhcp6_enabled(Link *link);
Network.Tunnel, config_parse_tunnel, 0, 0
Network.DHCP, config_parse_dhcp, 0, offsetof(Network, dhcp)
Network.DHCPServer, config_parse_bool, 0, offsetof(Network, dhcp_server)
-Network.IPv4LL, config_parse_bool, 0, offsetof(Network, ipv4ll)
+Network.LinkLocal, config_parse_address_family_boolean,0, offsetof(Network, link_local)
Network.IPv4LLRoute, config_parse_bool, 0, offsetof(Network, ipv4ll_route)
Network.LLDP, config_parse_bool, 0, offsetof(Network, lldp)
Network.Address, config_parse_address, 0, 0
BridgeFDB.MACAddress, config_parse_fdb_hwaddr, 0, 0
BridgeFDB.VLANId, config_parse_fdb_vlan_id, 0, 0
/* backwards compatibility: do not add new entries to this section */
+Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns)
DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu)
DHCPv4.UseHostname, config_parse_bool, 0, offsetof(Network, dhcp_hostname)
network->llmnr = LLMNR_SUPPORT_YES;
+ network->link_local = ADDRESS_FAMILY_IPV6;
+
r = config_parse(NULL, filename, file,
"Match\0"
"Link\0"
return 0;
}
+int config_parse_ipv4ll(
+ const char* unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ AddressFamilyBoolean *link_local = data;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ /* Note that this is mostly like
+ * config_parse_address_family_boolean(), except that it
+ * applies only to IPv4 */
+
+ if (parse_boolean(rvalue))
+ *link_local |= ADDRESS_FAMILY_IPV4;
+ else
+ *link_local &= ~ADDRESS_FAMILY_IPV4;
+
+ return 0;
+}
+
int config_parse_dhcp(
const char* unit,
const char *filename,
bool dhcp_critical;
bool dhcp_routes;
unsigned dhcp_route_metric;
- bool ipv4ll;
+ AddressFamilyBoolean link_local;
bool ipv4ll_route;
bool dhcp_server;
const char *section, unsigned section_line, const char *lvalue,
int ltype, const char *rvalue, void *data, void *userdata);
+/* IPv4LL support (legacy) */
+
+int config_parse_ipv4ll(const char *unit, const char *filename, unsigned line,
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
+
/* LLMNR support */
const char* llmnr_support_to_string(LLMNRSupport i) _const_;