]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-dhcp6.c
On Solaris, for 64-bit builds, use the 64-bit pcap-config.
[tcpdump] / print-dhcp6.c
index 699b728fbd9b9cb02e2e20a42bd29d7ace438369..6b0dc21335d31c432c3e97ccf77d5a72b695a155 100644 (file)
@@ -408,11 +408,26 @@ dhcp6opt_print(netdissect_options *ndo,
                        ND_PRINT(" %u)", GET_BE_U_2(tp));
                        break;
                case DH6OPT_RELAY_MSG:
+                   {
+                       const u_char *snapend_save;
+
                        ND_PRINT(" (");
                        tp = (const u_char *)(dh6o + 1);
+                       /*
+                        * Update the snapend to the end of the option before
+                        * calling recursively dhcp6_print() for the nested
+                        * packet. Other options may be present after the
+                        * nested DHCPv6 packet. This prevents that, in
+                        * dhcp6_print(), for the nested DHCPv6 packet, the
+                        * remaining length < remaining caplen.
+                        */
+                       snapend_save = ndo->ndo_snapend;
+                       ndo->ndo_snapend = ND_MIN(tp + optlen, ndo->ndo_snapend);
                        dhcp6_print(ndo, tp, optlen);
+                       ndo->ndo_snapend = snapend_save;
                        ND_PRINT(")");
                        break;
+                   }
                case DH6OPT_AUTH:
                        if (optlen < 11) {
                                ND_PRINT(" ?)");
@@ -764,7 +779,7 @@ dhcp6opt_print(netdissect_options *ndo,
                                break;
                        }
                        tp = (const u_char *)(dh6o + 1);
-                       ND_PRINT("=");
+                       ND_PRINT(" ");
                        nd_printjnp(ndo, tp, optlen);
                        ND_PRINT(")");
                        break;