]> The Tcpdump Group git mirrors - tcpdump/commitdiff
DHCP: Fix the option 81 flags field printing
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 10 May 2020 21:13:27 +0000 (23:13 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 14 May 2020 11:46:55 +0000 (13:46 +0200)
The first nibble of the option 81 flags field must be zero.
The current flags are in the second nibble.

From RFC 4702:

2.1.  The Flags Field

   The format of the 1-octet Flags field is:

        0 1 2 3 4 5 6 7
       +-+-+-+-+-+-+-+-+
       |  MBZ  |N|E|O|S|
       +-+-+-+-+-+-+-+-+

[...]

   The remaining bits in the Flags field are reserved for future
   assignment.  DHCP clients and servers that send the Client FQDN
   option MUST clear the MBZ bits, and they MUST ignore these bits.

print-bootp.c

index 264a016b1a20db7a5d9fbdfdafa055f8df3c6f09..6daf485a92fa6711cf83266e1d51536513dcd52e 100644 (file)
@@ -845,7 +845,11 @@ rfc1048_print(netdissect_options *ndo,
                                        len = 0;
                                        break;
                                }
-                               if (GET_U_1(bp))
+                               if (GET_U_1(bp) & 0xf0) {
+                                       ND_PRINT("[ERROR: MBZ nibble 0x%x != 0] ",
+                                                (GET_U_1(bp) & 0xf0) >> 4);
+                               }
+                               if (GET_U_1(bp) & 0x0f)
                                        ND_PRINT("[%s] ",
                                                 client_fqdn_flags(GET_U_1(bp)));
                                bp++;