]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
notes for DHCPv4 encodings
authorAlan T. DeKok <aland@freeradius.org>
Sun, 23 Jan 2022 14:02:16 +0000 (09:02 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 24 Jan 2022 22:05:52 +0000 (17:05 -0500)
src/protocols/dhcpv4/decode.c
src/protocols/dhcpv4/encode.c

index e7973dca78517ae0b0dcc899f8d3508c133997a3..9b12ba6b33a54a21263e74129f0da849c16cbd2b 100644 (file)
@@ -548,6 +548,21 @@ ssize_t fr_dhcpv4_decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out,
 
        if (da->type == FR_TYPE_VSA) return decode_vsa(ctx, out, da, data + 2, data[1]);
 
+       /*
+        *      @todo - RFC 2131 Section 4.1 says:
+        *
+        *        The client concatenates the values of multiple
+        *        instances of the same option into a single parameter
+        *        list for configuration.
+        *
+        *      which presumably also means the same for the server on reception.
+        *
+        *      TBH, it would be simplest to have a thread-local array
+        *      for temporary work.  If there are multiple options of
+        *      the same number, then the values for those options get
+        *      mashed into the temporary buffer.  Then, that buffer
+        *      gets used for value decoding.
+        */
        ret = decode_value(ctx, out, da, data + 2, data[1]);
        if (ret < 0) {
                fr_dict_unknown_free(&da);
index bc1076a9dd0930f085f168094628c87498900227..1841f5c407f5037bf76ed1c465e9058d183d7672 100644 (file)
@@ -242,6 +242,24 @@ static ssize_t encode_rfc_hdr(fr_dbuff_t *dbuff,
                        break;
                }
 
+               /*
+                *      @todo - RFC 2131 Section 4.1 says:
+                *
+                *        The client concatenates the values of multiple
+                *        instances of the same option into a single parameter
+                *        list for configuration.
+                *
+                *      so if we have multiple options of the same
+                *      number, then pack them as much as possible.
+                *
+                *      TBH, it would be simplest to have a
+                *      thread-local array for temporary work.  If
+                *      there are multiple options of the same number,
+                *      then the values for those options get mashed
+                *      into the temporary buffer.  Then, that buffer
+                *      gets copied to the actual packet, with headers
+                *      being added as necessary.
+                */
                len = encode_value(&work_dbuff, da_stack, depth, cursor, encode_ctx);
                if (len < -1) return len;
                if (len == -1) {