Print this page
4587 snoop misdecodes DHCPv6 DHCPV6_DUID_LL identifiers
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c
          +++ new/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_dhcpv6.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Dynamic Host Configuration Protocol version 6, for IPv6.  Supports
  29   29   * RFCs 3315, 3319, 3646, 3898, 4075, 4242, 4280, 4580, 4649, and 4704.
  30   30   */
  31   31  
       32 +#include <ctype.h>
  32   33  #include <stdio.h>
  33   34  #include <stdlib.h>
  34   35  #include <string.h>
  35   36  #include <time.h>
  36   37  #include <sys/types.h>
  37   38  #include <sys/socket.h>
  38   39  #include <netinet/in.h>
  39   40  #include <netinet/dhcp6.h>
  40   41  #include <arpa/inet.h>
  41   42  #include <dhcp_impl.h>
↓ open down ↓ 582 lines elided ↑ open up ↑
 624  625                          if (type == DHCPV6_DUID_LLT || type == DHCPV6_DUID_LL) {
 625  626                                  if (olen < sizeof (val16))
 626  627                                          break;
 627  628                                  (void) memcpy(&val16, data, sizeof (val16));
 628  629                                  data += sizeof (val16);
 629  630                                  olen -= sizeof (val16);
 630  631                                  val16 = ntohs(val16);
 631  632                                  (void) snprintf(get_line(0, 0),
 632  633                                      get_line_remain(),
 633  634                                      "  Hardware Type = %u (%s)", val16,
 634      -                                    arp_htype(type));
      635 +                                    arp_htype(val16));
 635  636                          }
 636  637                          if (type == DHCPV6_DUID_LLT) {
 637  638                                  time_t timevalue;
 638  639  
 639  640                                  if (olen < sizeof (val32))
 640  641                                          break;
 641  642                                  (void) memcpy(&val32, data, sizeof (val32));
 642  643                                  data += sizeof (val32);
 643  644                                  olen -= sizeof (val32);
 644  645                                  timevalue = ntohl(val32) + DUID_TIME_BASE;
↓ open down ↓ 406 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX