]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't add status on success
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 5 Nov 2021 15:29:14 +0000 (11:29 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 5 Nov 2021 15:29:32 +0000 (11:29 -0400)
src/process/dhcpv6/base.c

index 9a1f556894089d7571828c99250714d030994452..874e4df8558e5106e9ae28c9581cb88d5bf7138d 100644 (file)
@@ -372,14 +372,24 @@ static inline CC_HINT(always_inline)
 void status_code_add(request_t *request, fr_value_box_t const **code)
 {
        fr_pair_t               *vp;
+       fr_value_box_t const    *vb;
 
-       if (!code) return;
+       if (!code || !*code) return;
+
+       vb = *code;
+
+       /*
+        *      If it's a success save some bytes
+        *      in the packet and don't bother
+        *      adding the success code.
+        */
+       if (vb->vb_uint16 == 0) return;
 
        /*
         *      Don't override user
         */
        if (pair_update_reply(&vp, attr_status_code_value) == 1) return;
-       fr_value_box_copy(vp, &vp->data, *code);
+       fr_value_box_copy(vp, &vp->data, vb);
 }
 
 /** Restore our copy of the header fields into the reply list