Deleted Added
sdiff udiff text old ( 236192 ) new ( 252283 )
full compact
1/*
2 * Copyright (C) 1998 and 1999 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29/*
30 * RFC3315: DHCPv6
31 * supported DHCPv6 options:
32 * RFC3319: Session Initiation Protocol (SIP) Servers options,
33 * RFC3633: IPv6 Prefix options,
34 * RFC3646: DNS Configuration options,
35 * RFC3898: Network Information Service (NIS) Configuration options,
36 * RFC4075: Simple Network Time Protocol (SNTP) Configuration option,
37 * RFC4242: Information Refresh Time option,
38 * RFC4280: Broadcast and Multicast Control Servers options,
39 * RFC6334: Dual-Stack Lite option,
40 */
41
42#ifndef lint
43static const char rcsid[] _U_ =
44 "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.37 2008-02-06 10:26:09 guy Exp $";
45#endif
46
47#ifdef HAVE_CONFIG_H

--- 118 unchanged lines hidden (view full) ---

166#define DH6OPT_NEW_POSIX_TIMEZONE 41
167#define DH6OPT_NEW_TZDB_TIMEZONE 42
168#define DH6OPT_ERO 43
169#define DH6OPT_LQ_QUERY 44
170#define DH6OPT_CLIENT_DATA 45
171#define DH6OPT_CLT_TIME 46
172#define DH6OPT_LQ_RELAY_DATA 47
173#define DH6OPT_LQ_CLIENT_LINK 48
174#define DH6OPT_AFTR_NAME 64
175
176struct dhcp6opt {
177 u_int16_t dh6opt_type;
178 u_int16_t dh6opt_len;
179 /* type-dependent data follows */
180};
181
182static const char *

--- 92 unchanged lines hidden (view full) ---

275 case DH6OPT_CLIENT_DATA:
276 return "LQ-client-data";
277 case DH6OPT_CLT_TIME:
278 return "Clt-time";
279 case DH6OPT_LQ_RELAY_DATA:
280 return "LQ-relay-data";
281 case DH6OPT_LQ_CLIENT_LINK:
282 return "LQ-client-link";
283 case DH6OPT_AFTR_NAME:
284 return "AFTR-Name";
285 default:
286 snprintf(genstr, sizeof(genstr), "opt_%d", type);
287 return(genstr);
288 }
289}
290
291static const char *
292dhcp6stcode(int code)

--- 44 unchanged lines hidden (view full) ---

337 u_int authinfolen, authrealmlen;
338
339 if (cp == ep)
340 return;
341 while (cp < ep) {
342 if (ep < cp + sizeof(*dh6o))
343 goto trunc;
344 dh6o = (struct dhcp6opt *)cp;
345 TCHECK(*dh6o);
346 optlen = EXTRACT_16BITS(&dh6o->dh6opt_len);
347 if (ep < cp + sizeof(*dh6o) + optlen)
348 goto trunc;
349 opttype = EXTRACT_16BITS(&dh6o->dh6opt_type);
350 printf(" (%s", dhcp6opt_name(opttype));
351 switch (opttype) {
352 case DH6OPT_CLIENTID:
353 case DH6OPT_SERVERID:

--- 56 unchanged lines hidden (view full) ---

410 }
411 tp = (u_char *)(dh6o + 1);
412 printf(" %s", ip6addr_string(&tp[0]));
413 printf(" pltime:%u vltime:%u",
414 EXTRACT_32BITS(&tp[16]),
415 EXTRACT_32BITS(&tp[20]));
416 if (optlen > 24) {
417 /* there are sub-options */
418 dhcp6opt_print(tp + 24, tp + optlen);
419 }
420 printf(")");
421 break;
422 case DH6OPT_ORO:
423 case DH6OPT_ERO:
424 if (optlen % 2) {
425 printf(" ?)");
426 break;

--- 183 unchanged lines hidden (view full) ---

610 }
611 tp = (u_char *)(dh6o + 1);
612 printf(" IAID:%u T1:%u T2:%u",
613 EXTRACT_32BITS(&tp[0]),
614 EXTRACT_32BITS(&tp[4]),
615 EXTRACT_32BITS(&tp[8]));
616 if (optlen > 12) {
617 /* there are sub-options */
618 dhcp6opt_print(tp + 12, tp + optlen);
619 }
620 printf(")");
621 break;
622 case DH6OPT_IA_TA:
623 if (optlen < 4) {
624 printf(" ?)");
625 break;
626 }
627 tp = (u_char *)(dh6o + 1);
628 printf(" IAID:%u", EXTRACT_32BITS(tp));
629 if (optlen > 4) {
630 /* there are sub-options */
631 dhcp6opt_print(tp + 4, tp + optlen);
632 }
633 printf(")");
634 break;
635 case DH6OPT_IA_PD_PREFIX:
636 if (optlen < 25) {
637 printf(" ?)");
638 break;
639 }
640 tp = (u_char *)(dh6o + 1);
641 printf(" %s/%d", ip6addr_string(&tp[9]), tp[8]);
642 printf(" pltime:%u vltime:%u",
643 EXTRACT_32BITS(&tp[0]),
644 EXTRACT_32BITS(&tp[4]));
645 if (optlen > 25) {
646 /* there are sub-options */
647 dhcp6opt_print(tp + 25, tp + optlen);
648 }
649 printf(")");
650 break;
651 case DH6OPT_LIFETIME:
652 case DH6OPT_CLT_TIME:
653 if (optlen != 4) {
654 printf(" ?)");
655 break;

--- 56 unchanged lines hidden (view full) ---

712 printf(" %s ", ip6addr_string(&tp[0]));
713 /*
714 * Print hex dump first 10 characters.
715 */
716 for (i = 16; i < optlen && i < 26; i++)
717 printf("%02x", tp[i]);
718 printf("...)");
719 break;
720 case DH6OPT_AFTR_NAME:
721 if (optlen < 3) {
722 printf(" ?)");
723 break;
724 }
725 tp = (u_char *)(dh6o + 1);
726 int remain_len = optlen;
727 printf(" ");
728 /* Encoding is described in section 3.1 of RFC 1035 */
729 int label_len; /* Label length */
730 while (remain_len && *tp) {
731 label_len = *tp++;
732 if (label_len < remain_len - 1) {
733 printf("%.*s", label_len, tp);
734 tp += label_len;
735 remain_len -= (label_len + 1);
736 if(*tp) printf(".");
737 } else {
738 printf(" ?");
739 break;
740 }
741 }
742 printf(")");
743 break;
744 default:
745 printf(")");
746 break;
747 }
748
749 cp += sizeof(*dh6o) + optlen;
750 }
751 return;

--- 118 unchanged lines hidden ---