]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: do not send more PRL options when Anonymize is true.
authorjuga0 <juga@riseup.net>
Thu, 3 Aug 2017 17:19:51 +0000 (19:19 +0200)
committerjuga0 <juga@riseup.net>
Wed, 6 Sep 2017 17:25:10 +0000 (19:25 +0200)
* check that Client has reserved memory for PRL
* do not send duplicated ROUTES option when Anonymize is true

src/libsystemd-network/sd-dhcp-client.c
src/network/networkd-dhcp4.c

index 9cc56364d296d9912c383129b5110a133bacb0c4..b5f85399adba12f04f2d2c79e3b194dec69faf6b 100644 (file)
@@ -615,11 +615,18 @@ static int client_message_init(
            it MUST include that list in any subsequent DHCPREQUEST
            messages.
          */
-        r = dhcp_option_append(&packet->dhcp, optlen, &optoffset, 0,
-                               SD_DHCP_OPTION_PARAMETER_REQUEST_LIST,
-                               client->req_opts_size, client->req_opts);
-        if (r < 0)
-                return r;
+
+        /* RFC7844 section 3:
+           MAY contain the Parameter Request List option. */
+        /* NOTE: in case that there would be an option to do not send
+         * any PRL at all, the size should be checked before sending */
+        if (client->req_opts_size > 0) {
+                r = dhcp_option_append(&packet->dhcp, optlen, &optoffset, 0,
+                                       SD_DHCP_OPTION_PARAMETER_REQUEST_LIST,
+                                       client->req_opts_size, client->req_opts);
+                if (r < 0)
+                        return r;
+        }
 
         /* RFC2131 section 3.5:
            The client SHOULD include the ’maximum DHCP message size’ option to
index 07661e3fa9ff805ed95e2ca49be2cfde5f0a304a..9c69979c7bbbfaa75dbd1305be995fdf4d7aa160 100644 (file)
@@ -624,7 +624,12 @@ int dhcp4_configure(Link *link) {
                         return r;
         }
 
-        if (link->network->dhcp_use_routes) {
+        /* NOTE: when using Anonymity Profiles, routes PRL options are sent
+         * by default, so they should not be added again here. */
+        /* NOTE: even if this variable is called "use", it also "sends" PRL
+         * options, maybe there should be a different configuration variable
+         * to send or not route options?. */
+        if (link->network->dhcp_use_routes && !link->network->dhcp_anonymize) {
                 r = sd_dhcp_client_set_request_option(link->dhcp_client,
                                                       SD_DHCP_OPTION_STATIC_ROUTE);
                 if (r < 0)