]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
loop over input VPs.
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Mar 2022 22:15:51 +0000 (17:15 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Mar 2022 15:41:06 +0000 (10:41 -0500)
we don't call extend_option() yet.  Just cleaning up

src/protocols/dhcpv4/encode.c

index 8c1059ec14907b7b491259ecee2e5ea21270a8f1..250b92b17b177e609059fc741a99c9c25b8a4752 100644 (file)
@@ -304,11 +304,19 @@ static ssize_t encode_rfc_hdr(fr_dbuff_t *dbuff,
         */
        if (da->flags.array) {
 //             len = encode_array(&work_dbuff, da_stack, depth, cursor, encode_ctx);
-               len = -1;
+               return -1;      /* not done yet */
        } else {
-               len = encode_value(&work_dbuff, da_stack, depth, cursor, encode_ctx);
+               fr_pair_t *vp;
+               
+               do {
+                       len = encode_value(&work_dbuff, da_stack, depth, cursor, encode_ctx);
+                       if (len < 0) return len; /* @todo return the correct offset, but whatever */
+
+                       vp = fr_dcursor_current(cursor);
+               } while (vp && (vp->da == da));
        }
-       if (len < 0) return len;
+
+       len = fr_dbuff_used(&work_dbuff) - 2;
 
        if (len > 255) return PAIR_ENCODE_FATAL_ERROR; /* todo fixme */