network: Introduce UseCaptivePortal IPv6RA option

Accepts a boolean. When enabled retains captive portal configuration
advertised by the router.
This commit is contained in:
Ronan Pigott 2023-06-29 16:58:03 -07:00
parent a75feb554b
commit d74c4ce103
3 changed files with 19 additions and 0 deletions

View file

@ -2612,6 +2612,14 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UseCaptivePortal=</varname></term>
<listitem>
<para>When true (the default), the captive portal received in the Router Advertisement will be recorded
and made available to client programs and displayed in the networkctl status output per-link.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UseAutonomousPrefix=</varname></term>
<listitem>

View file

@ -284,6 +284,7 @@ IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_d
IPv6AcceptRA.RouteTable, config_parse_dhcp_or_ra_route_table, AF_INET6, 0
IPv6AcceptRA.RouteMetric, config_parse_ipv6_accept_ra_route_metric, 0, 0
IPv6AcceptRA.QuickAck, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_quickack)
IPv6AcceptRA.UseCaptivePortal, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_captive_portal)
IPv6AcceptRA.RouterAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_router)
IPv6AcceptRA.RouterDenyList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_deny_listed_router)
IPv6AcceptRA.PrefixAllowList, config_parse_in_addr_prefixes, AF_INET6, offsetof(Network, ndisc_allow_listed_prefix)

View file

@ -623,11 +623,21 @@ int link_save(Link *link) {
log_link_warning(link, "DHCPv6 Captive Portal (%s) does not match DHCPv4 (%s). Ignoring DHCPv6 portal.",
dhcp6_captive_portal, dhcp_captive_portal);
if (link->network->ipv6_accept_ra_use_captive_portal && link->ndisc_captive_portal) {
if (dhcp_captive_portal && !streq(dhcp_captive_portal, link->ndisc_captive_portal))
log_link_warning(link, "IPv6RA captive portal (%s) does not match DHCPv4 (%s). Ignorning IPv6RA portal.",
link->ndisc_captive_portal, dhcp_captive_portal);
if (dhcp6_captive_portal && !streq(dhcp6_captive_portal, link->ndisc_captive_portal))
log_link_warning(link, "IPv6RA captive portal (%s) does not match DHCPv6 (%s). Ignorning IPv6RA portal.",
link->ndisc_captive_portal, dhcp6_captive_portal);
}
if (dhcp_captive_portal)
fprintf(f, "CAPTIVE_PORTAL=%s\n", dhcp_captive_portal);
else if (dhcp6_captive_portal)
fprintf(f, "CAPTIVE_PORTAL=%s\n", dhcp6_captive_portal);
else if (link->ndisc_captive_portal)
fprintf(f, "CAPTIVE_PORTAL=%s\n", link->ndisc_captive_portal);
/************************************************************/