<varlistentry>
<term><varname>Gateway=</varname></term>
<listitem>
- <para>Takes the gateway address or special value <literal>_dhcp</literal>. If
- <literal>_dhcp</literal>, then the gateway address provided by DHCP (or in the IPv6 case,
- provided by IPv6 RA) is used.</para>
+ <para>Takes the gateway address or the special values <literal>_dhcp4</literal> and
+ <literal>_dhcp6</literal>. If <literal>_dhcp4</literal> or <literal>_dhcp6</literal> is
+ set, then the gateway address provided by DHCP (or in the IPv6 case, provided by IPv6 RA)
+ is used.</para>
</listitem>
</varlistentry>
<varlistentry>
TAKE_PTR(n);
return 0;
}
+
+ if (streq(rvalue, "_dhcp4")) {
+ n->gw_family = AF_INET;
+ n->gateway_from_dhcp = true;
+ TAKE_PTR(n);
+ return 0;
+ }
+
+ if (streq(rvalue, "_dhcp6")) {
+ n->gw_family = AF_INET6;
+ n->gateway_from_dhcp = true;
+ TAKE_PTR(n);
+ return 0;
+ }
}
r = in_addr_from_string_auto(rvalue, &n->gw_family, &n->gw);
return 0;
}
+ n->gateway_from_dhcp = false;
TAKE_PTR(n);
return 0;
}
if (route->family == AF_UNSPEC) {
assert(route->section);
- return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
- "%s: Route section without Gateway=, Destination=, Source=, "
- "or PreferredSource= field configured. "
- "Ignoring [Route] section from line %u.",
- route->section->filename, route->section->line);
+ if (route->gateway_from_dhcp) {
+ log_warning("%s: Deprecated value \"_dhcp\" is specified for Gateway= in [Route] section from line %u. "
+ "Please use \"_dhcp4\" or \"_dhcp6\" instead. Assuming \"_dhcp4\".",
+ route->section->filename, route->section->line);
+
+ route->family = AF_INET;
+ route->gw_family = AF_INET;
+ } else
+ return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
+ "%s: Route section without Gateway=, Destination=, Source=, "
+ "or PreferredSource= field configured. "
+ "Ignoring [Route] section from line %u.",
+ route->section->filename, route->section->line);
}
if (route->family == AF_INET6 && route->gw_family == AF_INET)