]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: Introduce UseCaptivePortal IPv6RA option
authorRonan Pigott <ronan@rjp.ie>
Thu, 29 Jun 2023 23:58:03 +0000 (16:58 -0700)
committerRonan Pigott <ronan@rjp.ie>
Sun, 2 Jul 2023 08:13:43 +0000 (01:13 -0700)
Accepts a boolean. When enabled retains captive portal configuration
advertised by the router.

man/systemd.network.xml
src/network/networkd-network-gperf.gperf
src/network/networkd-state-file.c

index b623a4aa75b7f7408867ae7452b2381e4c0703cc..0d3805fa8a7caf0d954b9f7414a97263c58edc12 100644 (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>
index ab0d252b940632ae4f418a869135ea8f5d6d6dbf..6a7ef24651ffe422ea6ea6f0806ba7b8363f389c 100644 (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)
index 5f5cb3239d03216bffc5a7ecbffb7ae6056ec738..c9366e97d802b6795b16170a65025ada4c5a7ff4 100644 (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);
 
                 /************************************************************/