*/
/*
* RFC3315: DHCPv6
- * supported DHCPv6 options:
+ * supported DHCPv6 options:
* RFC3319: Session Initiation Protocol (SIP) Servers options,
* RFC3633: IPv6 Prefix options,
* RFC3646: DNS Configuration options,
* RFC6334: Dual-Stack Lite option,
*/
-#ifndef lint
-static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.37 2008-02-06 10:26:09 guy Exp $";
-#endif
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "extract.h"
/* lease duration */
-#define DHCP6_DURATITION_INFINITE 0xffffffff
+#define DHCP6_DURATION_INFINITE 0xffffffff
/* Error Values */
#define DH6ERR_FAILURE 16
#define DH6OPT_RECONF_ACCEPT 20
#define DH6OPT_SIP_SERVER_D 21
#define DH6OPT_SIP_SERVER_A 22
-#define DH6OPT_DNS 23
-#define DH6OPT_DNSNAME 24
+#define DH6OPT_DNS_SERVERS 23
+#define DH6OPT_DOMAIN_LIST 24
#define DH6OPT_IA_PD 25
#define DH6OPT_IA_PD_PREFIX 26
#define DH6OPT_NIS_SERVERS 27
return "SIP-servers-domain";
case DH6OPT_SIP_SERVER_A:
return "SIP-servers-address";
- case DH6OPT_DNS:
+ case DH6OPT_DNS_SERVERS:
return "DNS-server";
- case DH6OPT_DNSNAME:
+ case DH6OPT_DOMAIN_LIST:
return "DNS-search-list";
case DH6OPT_IA_PD:
return "IA_PD";
static void
dhcp6opt_print(const u_char *cp, const u_char *ep)
{
- struct dhcp6opt *dh6o;
- u_char *tp;
+ const struct dhcp6opt *dh6o;
+ const u_char *tp;
size_t i;
u_int16_t opttype;
size_t optlen;
printf(")");
break;
case DH6OPT_SIP_SERVER_A:
- case DH6OPT_DNS:
+ case DH6OPT_DNS_SERVERS:
case DH6OPT_SNTP_SERVERS:
case DH6OPT_NIS_SERVERS:
case DH6OPT_NISP_SERVERS:
printf(" %s", ip6addr_string(&tp[i]));
printf(")");
break;
+ case DH6OPT_SIP_SERVER_D:
+ case DH6OPT_DOMAIN_LIST:
+ tp = (u_char *)(dh6o + 1);
+ while (tp < cp + sizeof(*dh6o) + optlen) {
+ putchar(' ');
+ if ((tp = ns_nprint(tp, cp + sizeof(*dh6o) + optlen)) == NULL)
+ goto trunc;
+ }
+ printf(")");
+ break;
case DH6OPT_STATUS_CODE:
if (optlen < 2) {
printf(" ?)");
break;
}
tp = (u_char *)(dh6o + 1);
- while (tp < ep - 4) {
+ while (tp < cp + sizeof(*dh6o) + optlen - 4) {
subopt_code = EXTRACT_16BITS(tp);
tp += 2;
subopt_len = EXTRACT_16BITS(tp);
tp += 2;
+ if (tp + subopt_len > cp + sizeof(*dh6o) + optlen)
+ goto trunc;
printf(" subopt:%d", subopt_code);
switch (subopt_code) {
case DH6OPT_NTP_SUBOPTION_SRV_ADDR:
break;
}
printf(" %s", ip6addr_string(&tp[0]));
- tp += subopt_len;
break;
case DH6OPT_NTP_SUBOPTION_SRV_FQDN:
putchar(' ');
- ns_nprint(tp, ep);
- tp += subopt_len;
+ if (ns_nprint(tp, tp + subopt_len) == NULL)
+ goto trunc;
break;
default:
printf(" ?");
break;
}
+ tp += subopt_len;
}
printf(")");
break;