#include "netdissect-stdinc.h"
-#include <stdio.h>
-#include <string.h>
-
#include "netdissect.h"
#include "addrtoname.h"
#include "extract.h"
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT(" %s", ip6addr_string(ndo, tp));
+ ND_PRINT(" %s", GET_IP6ADDR_STRING(tp));
ND_PRINT(" pltime:%u vltime:%u",
GET_BE_U_4(tp + 16),
GET_BE_U_4(tp + 20));
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(" ?)");
}
tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 16)
- ND_PRINT(" %s", ip6addr_string(ndo, tp + i));
+ ND_PRINT(" %s", GET_IP6ADDR_STRING(tp + i));
ND_PRINT(")");
break;
case DH6OPT_SIP_SERVER_D:
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT(" %s/%u", ip6addr_string(ndo, tp + 9),
+ ND_PRINT(" %s/%u", GET_IP6ADDR_STRING(tp + 9),
GET_U_1(tp + 8));
ND_PRINT(" pltime:%u vltime:%u",
GET_BE_U_4(tp),
ND_PRINT(" type_%u", dh6_lq_query_type);
break;
}
- ND_PRINT(" %s", ip6addr_string(ndo, tp + 1));
+ ND_PRINT(" %s", GET_IP6ADDR_STRING(tp + 1));
if (optlen > 17) {
/* there are query-options */
dhcp6opt_print(ndo, tp + 17, tp + optlen);
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT(" %s ", ip6addr_string(ndo, tp));
+ ND_PRINT(" %s ", GET_IP6ADDR_STRING(tp));
/*
* Print hex dump first 10 characters.
*/
ND_PRINT(" ?");
break;
}
- ND_PRINT(" %s", ip6addr_string(ndo, tp));
+ ND_PRINT(" %s", GET_IP6ADDR_STRING(tp));
break;
case DH6OPT_NTP_SUBOPTION_SRV_FQDN:
ND_PRINT(" ");
label_len = GET_U_1(tp);
tp++;
if (label_len < remain_len - 1) {
- (void)nd_printn(ndo, tp, label_len, NULL);
+ nd_printjnp(ndo, tp, label_len);
tp += label_len;
remain_len -= (label_len + 1);
if(GET_U_1(tp)) ND_PRINT(".");
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT("=");
- (void)nd_printn(ndo, tp, (u_int)optlen, NULL);
+ ND_PRINT(" ");
+ nd_printjnp(ndo, tp, optlen);
ND_PRINT(")");
break;
extp = (const u_char *)(dh6 + 1);
dhcp6opt_print(ndo, extp, ep);
} else { /* relay messages */
- ND_TCHECK_16(dh6relay->dh6relay_peeraddr);
-
- ND_PRINT("linkaddr=%s", ip6addr_string(ndo, dh6relay->dh6relay_linkaddr));
+ ND_PRINT("linkaddr=%s", GET_IP6ADDR_STRING(dh6relay->dh6relay_linkaddr));
- ND_PRINT(" peeraddr=%s", ip6addr_string(ndo, dh6relay->dh6relay_peeraddr));
+ ND_PRINT(" peeraddr=%s", GET_IP6ADDR_STRING(dh6relay->dh6relay_peeraddr));
dhcp6opt_print(ndo, (const u_char *)(dh6relay + 1), ep);
}