Print this page
4587 snoop misdecodes DHCPv6 DHCPV6_DUID_LL identifiers


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 #include <sys/types.h>
  29 #include <sys/errno.h>
  30 #include <setjmp.h>



  31 #include <sys/socket.h>
  32 #include <net/if.h>
  33 #include <net/if_arp.h>
  34 #include <netinet/in_systm.h>
  35 #include <netinet/in.h>
  36 #include <netinet/ip.h>
  37 #include <netinet/if_ether.h>
  38 #include <netdb.h>
  39 #include <net/if_types.h>

  40 
  41 #include "snoop.h"
  42 
  43 extern char *dlc_header;
  44 extern jmp_buf xdr_err;
  45 
  46 static char *printip(unsigned char *);
  47 static char *addrtoname_align(unsigned char *);
  48 
  49 static char unarp_addr[] = "Unknown";
  50 char *opname[] = {
  51         "",
  52         "ARP Request",
  53         "ARP Reply",
  54         "REVARP Request",
  55         "REVARP Reply",
  56 };
  57 
  58 void
  59 interpret_arp(int flags, struct arphdr *ap, int alen)


 202 char *
 203 addrtoname_align(unsigned char *p)
 204 {
 205         struct in_addr a;
 206 
 207         memcpy(&a, p, 4);
 208         return ((char *)addrtoname(AF_INET, &a));
 209 }
 210 
 211 /*
 212  * These numbers are assigned by the IANA.  See the arp-parameters registry.
 213  * Only those values that are used within Solaris have #defines.
 214  */
 215 const char *
 216 arp_htype(int t)
 217 {
 218         switch (t) {
 219         case ARPHRD_ETHER:
 220                 return ("Ethernet (10Mb)");
 221         case 2:
 222                 return ("Experimental Ethernet (3MB)");
 223         case 3:
 224                 return ("Amateur Radio AX.25");
 225         case 4:
 226                 return ("Proteon ProNET Token Ring");
 227         case 5:
 228                 return ("Chaos");
 229         case ARPHRD_IEEE802:
 230                 return ("IEEE 802");
 231         case 7:
 232                 return ("ARCNET");
 233         case 8:
 234                 return ("Hyperchannel");
 235         case 9:
 236                 return ("Lanstar");
 237         case 10:
 238                 return ("Autonet");
 239         case 11:
 240                 return ("LocalTalk");
 241         case 12:
 242                 return ("LocalNet");
 243         case 13:
 244                 return ("Ultra Link");
 245         case 14:
 246                 return ("SMDS");
 247         case ARPHRD_FRAME:
 248                 return ("Frame Relay");
 249         case ARPHRD_ATM:
 250                 return ("ATM");
 251         case ARPHRD_HDLC:
 252                 return ("HDLC");
 253         case ARPHRD_FC:
 254                 return ("Fibre Channel");
 255         case ARPHRD_IPATM:
 256                 return ("IP-ATM");


 257         case ARPHRD_TUNNEL:
 258                 return ("Tunnel");
 259         case ARPHRD_IB:
 260                 return ("IPIB");
 261         };
 262         return ("UNKNOWN");
 263 }


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 


  26 #include <sys/types.h>
  27 #include <sys/errno.h>
  28 #include <setjmp.h>
  29 #include <stdio.h>
  30 #include <stdlib.h>
  31 #include <string.h>
  32 #include <sys/socket.h>
  33 #include <net/if.h>
  34 #include <net/if_arp.h>
  35 #include <netinet/in_systm.h>
  36 #include <netinet/in.h>
  37 #include <netinet/ip.h>
  38 #include <netinet/if_ether.h>
  39 #include <netdb.h>
  40 #include <net/if_types.h>
  41 #include <arpa/inet.h>
  42 
  43 #include "snoop.h"
  44 
  45 extern char *dlc_header;
  46 extern jmp_buf xdr_err;
  47 
  48 static char *printip(unsigned char *);
  49 static char *addrtoname_align(unsigned char *);
  50 
  51 static char unarp_addr[] = "Unknown";
  52 char *opname[] = {
  53         "",
  54         "ARP Request",
  55         "ARP Reply",
  56         "REVARP Request",
  57         "REVARP Reply",
  58 };
  59 
  60 void
  61 interpret_arp(int flags, struct arphdr *ap, int alen)


 204 char *
 205 addrtoname_align(unsigned char *p)
 206 {
 207         struct in_addr a;
 208 
 209         memcpy(&a, p, 4);
 210         return ((char *)addrtoname(AF_INET, &a));
 211 }
 212 
 213 /*
 214  * These numbers are assigned by the IANA.  See the arp-parameters registry.
 215  * Only those values that are used within Solaris have #defines.
 216  */
 217 const char *
 218 arp_htype(int t)
 219 {
 220         switch (t) {
 221         case ARPHRD_ETHER:
 222                 return ("Ethernet (10Mb)");
 223         case 2:
 224                 return ("Experimental Ethernet (3Mb)");
 225         case 3:
 226                 return ("Amateur Radio AX.25");
 227         case 4:
 228                 return ("Proteon ProNET Token Ring");
 229         case 5:
 230                 return ("Chaos");
 231         case ARPHRD_IEEE802:
 232                 return ("IEEE 802");
 233         case 7:
 234                 return ("ARCNET");
 235         case 8:
 236                 return ("Hyperchannel");
 237         case 9:
 238                 return ("Lanstar");
 239         case 10:
 240                 return ("Autonet");
 241         case 11:
 242                 return ("LocalTalk");
 243         case 12:
 244                 return ("LocalNet");
 245         case 13:
 246                 return ("Ultra Link");
 247         case 14:
 248                 return ("SMDS");
 249         case ARPHRD_FRAME:
 250                 return ("Frame Relay");
 251         case ARPHRD_ATM:
 252                 return ("ATM");
 253         case ARPHRD_HDLC:
 254                 return ("HDLC");
 255         case ARPHRD_FC:
 256                 return ("Fibre Channel");
 257         case ARPHRD_IPATM:
 258                 return ("IP-ATM");
 259         case ARPHRD_METRICOM:
 260                 return ("Metricom");
 261         case ARPHRD_TUNNEL:
 262                 return ("Tunnel");
 263         case ARPHRD_IB:
 264                 return ("IPIB");
 265         };
 266         return ("UNKNOWN");
 267 }