10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*410Skcpoon * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SunOS */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <stdio.h> 300Sstevel@tonic-gate #include <stdlib.h> 310Sstevel@tonic-gate #include <ctype.h> 320Sstevel@tonic-gate #include <string.h> 330Sstevel@tonic-gate #include <fcntl.h> 340Sstevel@tonic-gate #include <string.h> 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/time.h> 370Sstevel@tonic-gate #include <sys/dlpi.h> 380Sstevel@tonic-gate #include <sys/sysmacros.h> 390Sstevel@tonic-gate #include <sys/socket.h> 400Sstevel@tonic-gate #include <sys/sockio.h> 410Sstevel@tonic-gate #include <net/if.h> 420Sstevel@tonic-gate #include <netinet/in_systm.h> 430Sstevel@tonic-gate #include <netinet/in.h> 440Sstevel@tonic-gate #include <netinet/ip.h> 450Sstevel@tonic-gate #include <netinet/if_ether.h> 460Sstevel@tonic-gate #include <sys/ib/clients/ibd/ibd.h> 470Sstevel@tonic-gate 480Sstevel@tonic-gate #include "at.h" 490Sstevel@tonic-gate #include "snoop.h" 500Sstevel@tonic-gate 510Sstevel@tonic-gate static uint_t ether_header_len(char *), fddi_header_len(char *), 520Sstevel@tonic-gate tr_header_len(char *), ib_header_len(char *); 530Sstevel@tonic-gate static uint_t interpret_ether(), interpret_fddi(), interpret_tr(); 540Sstevel@tonic-gate static uint_t interpret_ib(int, char *, int, int); 550Sstevel@tonic-gate static void addr_copy_swap(struct ether_addr *, struct ether_addr *); 560Sstevel@tonic-gate 570Sstevel@tonic-gate interface_t *interface; 580Sstevel@tonic-gate interface_t INTERFACES[] = { 590Sstevel@tonic-gate 600Sstevel@tonic-gate /* IEEE 802.3 CSMA/CD network */ 610Sstevel@tonic-gate { DL_CSMACD, 1550, ether_header_len, interpret_ether, IF_HDR_FIXED }, 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* Ethernet Bus */ 640Sstevel@tonic-gate { DL_ETHER, 1550, ether_header_len, interpret_ether, IF_HDR_FIXED }, 650Sstevel@tonic-gate 660Sstevel@tonic-gate /* Fiber Distributed data interface */ 670Sstevel@tonic-gate { DL_FDDI, 4500, fddi_header_len, interpret_fddi, IF_HDR_VAR }, 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* Token Ring interface */ 700Sstevel@tonic-gate { DL_TPR, 17800, tr_header_len, interpret_tr, IF_HDR_VAR }, 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* Infiniband */ 730Sstevel@tonic-gate { DL_IB, 4096, ib_header_len, interpret_ib, IF_HDR_FIXED }, 740Sstevel@tonic-gate 750Sstevel@tonic-gate { (uint_t)-1, 0, 0, 0, 0 } 760Sstevel@tonic-gate 770Sstevel@tonic-gate }; 780Sstevel@tonic-gate 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* externals */ 810Sstevel@tonic-gate extern char *dlc_header; 820Sstevel@tonic-gate extern int pi_frame; 830Sstevel@tonic-gate extern int pi_time_hour; 840Sstevel@tonic-gate extern int pi_time_min; 850Sstevel@tonic-gate extern int pi_time_sec; 860Sstevel@tonic-gate extern int pi_time_usec; 870Sstevel@tonic-gate 880Sstevel@tonic-gate char *printether(); 890Sstevel@tonic-gate char *print_ethertype(); 900Sstevel@tonic-gate static char *print_etherinfo(); 910Sstevel@tonic-gate 920Sstevel@tonic-gate char *print_fc(); 930Sstevel@tonic-gate char *print_smttype(); 940Sstevel@tonic-gate char *print_smtclass(); 950Sstevel@tonic-gate 960Sstevel@tonic-gate struct ether_addr ether_broadcast = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 970Sstevel@tonic-gate static char *data; /* current data buffer */ 980Sstevel@tonic-gate static int datalen; /* current data buffer length */ 990Sstevel@tonic-gate 1000Sstevel@tonic-gate uint_t 1010Sstevel@tonic-gate interpret_ether(flags, e, elen, origlen) 1020Sstevel@tonic-gate int flags; 1030Sstevel@tonic-gate struct ether_header *e; 1040Sstevel@tonic-gate int elen, origlen; 1050Sstevel@tonic-gate { 1060Sstevel@tonic-gate char *off; 1070Sstevel@tonic-gate int len; 1080Sstevel@tonic-gate int ieee8023 = 0; 1090Sstevel@tonic-gate extern char *dst_name; 1100Sstevel@tonic-gate int ethertype; 1110Sstevel@tonic-gate boolean_t data_copied = B_FALSE; 1120Sstevel@tonic-gate int blen = MAX(origlen, ETHERMTU); 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate if (data != NULL && datalen != 0 && datalen < blen) { 1150Sstevel@tonic-gate free(data); 1160Sstevel@tonic-gate data = NULL; 1170Sstevel@tonic-gate datalen = 0; 1180Sstevel@tonic-gate } 1190Sstevel@tonic-gate if (!data) { 1200Sstevel@tonic-gate data = (char *)malloc(blen); 1210Sstevel@tonic-gate if (!data) 1220Sstevel@tonic-gate pr_err("Warning: malloc failure"); 1230Sstevel@tonic-gate datalen = blen; 1240Sstevel@tonic-gate } 1250Sstevel@tonic-gate if (origlen < 14) { 1260Sstevel@tonic-gate if (flags & F_SUM) 1270Sstevel@tonic-gate (void) sprintf(get_sum_line(), 1280Sstevel@tonic-gate "RUNT (short packet - %d bytes)", 1290Sstevel@tonic-gate origlen); 1300Sstevel@tonic-gate if (flags & F_DTAIL) 1310Sstevel@tonic-gate show_header("RUNT: ", "Short packet", origlen); 1320Sstevel@tonic-gate return (elen); 1330Sstevel@tonic-gate } 1340Sstevel@tonic-gate if (elen < 14) 1350Sstevel@tonic-gate return (elen); 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate if (memcmp(&e->ether_dhost, ðer_broadcast, 1380Sstevel@tonic-gate sizeof (struct ether_addr)) == 0) 1390Sstevel@tonic-gate dst_name = "(broadcast)"; 1400Sstevel@tonic-gate else if (e->ether_dhost.ether_addr_octet[0] & 1) 1410Sstevel@tonic-gate dst_name = "(multicast)"; 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate ethertype = ntohs(e->ether_type); 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate /* 1460Sstevel@tonic-gate * The 14 byte ether header screws up alignment 1470Sstevel@tonic-gate * of the rest of the packet for 32 bit aligned 1480Sstevel@tonic-gate * architectures like SPARC. Alas, we have to copy 1490Sstevel@tonic-gate * the rest of the packet in order to align it. 1500Sstevel@tonic-gate */ 1510Sstevel@tonic-gate len = elen - sizeof (struct ether_header); 1520Sstevel@tonic-gate off = (char *)(e + 1); 1530Sstevel@tonic-gate if (ethertype <= 1514) { 1540Sstevel@tonic-gate /* 1550Sstevel@tonic-gate * Fake out the IEEE 802.3 packets. 1560Sstevel@tonic-gate * Should be DSAP=170, SSAP=170, control=3 1570Sstevel@tonic-gate * then three padding bytes of zero, 1580Sstevel@tonic-gate * followed by a normal ethernet-type packet. 1590Sstevel@tonic-gate */ 1600Sstevel@tonic-gate ieee8023 = ntohs(e->ether_type); 1610Sstevel@tonic-gate ethertype = ntohs(*(ushort_t *)(off + 6)); 1620Sstevel@tonic-gate off += 8; 1630Sstevel@tonic-gate len -= 8; 1640Sstevel@tonic-gate } 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate /* 1670Sstevel@tonic-gate * We cannot trust the length field in the header to be correct. 1680Sstevel@tonic-gate * But we should continue to process the packet. Then user can 1690Sstevel@tonic-gate * notice something funny in the header. 1700Sstevel@tonic-gate */ 1710Sstevel@tonic-gate if (len > 0 && (off + len <= (char *)e + elen)) { 1720Sstevel@tonic-gate (void) memcpy(data, off, len); 1730Sstevel@tonic-gate data_copied = B_TRUE; 1740Sstevel@tonic-gate } 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate if (flags & F_SUM) { 1770Sstevel@tonic-gate (void) sprintf(get_sum_line(), 1780Sstevel@tonic-gate "ETHER Type=%04X (%s), size = %d bytes", 1790Sstevel@tonic-gate ethertype, 1800Sstevel@tonic-gate print_ethertype(ethertype), 1810Sstevel@tonic-gate origlen); 1820Sstevel@tonic-gate } 1830Sstevel@tonic-gate 1840Sstevel@tonic-gate if (flags & F_DTAIL) { 1850Sstevel@tonic-gate show_header("ETHER: ", "Ether Header", elen); 1860Sstevel@tonic-gate show_space(); 1870Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 1880Sstevel@tonic-gate "Packet %d arrived at %d:%02d:%d.%05d", 1890Sstevel@tonic-gate pi_frame, 1900Sstevel@tonic-gate pi_time_hour, pi_time_min, pi_time_sec, 1910Sstevel@tonic-gate pi_time_usec / 10); 1920Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 1930Sstevel@tonic-gate "Packet size = %d bytes", 1940Sstevel@tonic-gate elen, elen); 1950Sstevel@tonic-gate (void) sprintf(get_line(0, 6), 1960Sstevel@tonic-gate "Destination = %s, %s", 1970Sstevel@tonic-gate printether(&e->ether_dhost), 1980Sstevel@tonic-gate print_etherinfo(&e->ether_dhost)); 1990Sstevel@tonic-gate (void) sprintf(get_line(6, 6), 2000Sstevel@tonic-gate "Source = %s, %s", 2010Sstevel@tonic-gate printether(&e->ether_shost), 2020Sstevel@tonic-gate print_etherinfo(&e->ether_shost)); 2030Sstevel@tonic-gate if (ieee8023 > 0) 2040Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 2050Sstevel@tonic-gate "IEEE 802.3 length = %d bytes", 2060Sstevel@tonic-gate ieee8023); 2070Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 2080Sstevel@tonic-gate "Ethertype = %04X (%s)", 2090Sstevel@tonic-gate ethertype, print_ethertype(ethertype)); 2100Sstevel@tonic-gate show_space(); 2110Sstevel@tonic-gate } 2120Sstevel@tonic-gate 2130Sstevel@tonic-gate /* Go to the next protocol layer only if data have been copied. */ 2140Sstevel@tonic-gate if (data_copied) { 2150Sstevel@tonic-gate switch (ethertype) { 2160Sstevel@tonic-gate case ETHERTYPE_IP: 2170Sstevel@tonic-gate (void) interpret_ip(flags, (struct ip *)data, len); 2180Sstevel@tonic-gate break; 2190Sstevel@tonic-gate /* Just in case it is decided to add this type */ 2200Sstevel@tonic-gate case ETHERTYPE_IPV6: 2210Sstevel@tonic-gate (void) interpret_ipv6(flags, (ip6_t *)data, len); 2220Sstevel@tonic-gate break; 2230Sstevel@tonic-gate case ETHERTYPE_ARP: 2240Sstevel@tonic-gate case ETHERTYPE_REVARP: 2250Sstevel@tonic-gate interpret_arp(flags, (struct arphdr *)data, len); 2260Sstevel@tonic-gate break; 2270Sstevel@tonic-gate case ETHERTYPE_PPPOED: 2280Sstevel@tonic-gate case ETHERTYPE_PPPOES: 2290Sstevel@tonic-gate (void) interpret_pppoe(flags, (poep_t *)data, len); 2300Sstevel@tonic-gate break; 2310Sstevel@tonic-gate case ETHERTYPE_AARP: /* AppleTalk */ 2320Sstevel@tonic-gate interpret_aarp(flags, data, len); 2330Sstevel@tonic-gate break; 2340Sstevel@tonic-gate case ETHERTYPE_AT: 2350Sstevel@tonic-gate interpret_at(flags, (struct ddp_hdr *)data, len); 2360Sstevel@tonic-gate break; 2370Sstevel@tonic-gate default: 2380Sstevel@tonic-gate break; 2390Sstevel@tonic-gate } 2400Sstevel@tonic-gate } 2410Sstevel@tonic-gate 2420Sstevel@tonic-gate return (elen); 2430Sstevel@tonic-gate } 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate /* ARGSUSED */ 2460Sstevel@tonic-gate uint_t 2470Sstevel@tonic-gate ether_header_len(e) 2480Sstevel@tonic-gate char *e; 2490Sstevel@tonic-gate { 2500Sstevel@tonic-gate return (14); 2510Sstevel@tonic-gate } 2520Sstevel@tonic-gate 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate /* 2550Sstevel@tonic-gate * Table of Ethertypes. 2560Sstevel@tonic-gate * Some of the more popular entries 2570Sstevel@tonic-gate * are at the beginning of the table 2580Sstevel@tonic-gate * to reduce search time. 2590Sstevel@tonic-gate */ 2600Sstevel@tonic-gate struct ether_type { 2610Sstevel@tonic-gate int e_type; 2620Sstevel@tonic-gate char *e_name; 2630Sstevel@tonic-gate } ether_type [] = { 2640Sstevel@tonic-gate ETHERTYPE_IP, "IP", 2650Sstevel@tonic-gate ETHERTYPE_ARP, "ARP", 2660Sstevel@tonic-gate ETHERTYPE_REVARP, "RARP", 2670Sstevel@tonic-gate ETHERTYPE_IPV6, "IPv6", 2680Sstevel@tonic-gate ETHERTYPE_PPPOED, "PPPoE Discovery", 2690Sstevel@tonic-gate ETHERTYPE_PPPOES, "PPPoE Session", 2700Sstevel@tonic-gate /* end of popular entries */ 2710Sstevel@tonic-gate ETHERTYPE_PUP, "Xerox PUP", 2720Sstevel@tonic-gate 0x0201, "Xerox PUP", 2730Sstevel@tonic-gate 0x0400, "Nixdorf", 2740Sstevel@tonic-gate 0x0600, "Xerox NS IDP", 2750Sstevel@tonic-gate 0x0601, "XNS Translation", 2760Sstevel@tonic-gate 0x0801, "X.75 Internet", 2770Sstevel@tonic-gate 0x0802, "NBS Internet", 2780Sstevel@tonic-gate 0x0803, "ECMA Internet", 2790Sstevel@tonic-gate 0x0804, "CHAOSnet", 2800Sstevel@tonic-gate 0x0805, "X.25 Level 3", 2810Sstevel@tonic-gate 0x0807, "XNS Compatibility", 2820Sstevel@tonic-gate 0x081C, "Symbolics Private", 2830Sstevel@tonic-gate 0x0888, "Xyplex", 2840Sstevel@tonic-gate 0x0889, "Xyplex", 2850Sstevel@tonic-gate 0x088A, "Xyplex", 2860Sstevel@tonic-gate 0x0900, "Ungermann-Bass network debugger", 2870Sstevel@tonic-gate 0x0A00, "Xerox IEEE802.3 PUP", 2880Sstevel@tonic-gate 0x0A01, "Xerox IEEE802.3 PUP Address Translation", 2890Sstevel@tonic-gate 0x0BAD, "Banyan Systems", 2900Sstevel@tonic-gate 0x0BAF, "Banyon VINES Echo", 2910Sstevel@tonic-gate 0x1000, "Berkeley Trailer negotiation", 2920Sstevel@tonic-gate 0x1000, "IP trailer (0)", 2930Sstevel@tonic-gate 0x1001, "IP trailer (1)", 2940Sstevel@tonic-gate 0x1002, "IP trailer (2)", 2950Sstevel@tonic-gate 0x1003, "IP trailer (3)", 2960Sstevel@tonic-gate 0x1004, "IP trailer (4)", 2970Sstevel@tonic-gate 0x1005, "IP trailer (5)", 2980Sstevel@tonic-gate 0x1006, "IP trailer (6)", 2990Sstevel@tonic-gate 0x1007, "IP trailer (7)", 3000Sstevel@tonic-gate 0x1008, "IP trailer (8)", 3010Sstevel@tonic-gate 0x1009, "IP trailer (9)", 3020Sstevel@tonic-gate 0x100a, "IP trailer (10)", 3030Sstevel@tonic-gate 0x100b, "IP trailer (11)", 3040Sstevel@tonic-gate 0x100c, "IP trailer (12)", 3050Sstevel@tonic-gate 0x100d, "IP trailer (13)", 3060Sstevel@tonic-gate 0x100e, "IP trailer (14)", 3070Sstevel@tonic-gate 0x100f, "IP trailer (15)", 3080Sstevel@tonic-gate 0x1234, "DCA - Multicast", 3090Sstevel@tonic-gate 0x1600, "VALID system protocol", 3100Sstevel@tonic-gate 0x1989, "Aviator", 3110Sstevel@tonic-gate 0x3C00, "3Com NBP virtual circuit datagram", 3120Sstevel@tonic-gate 0x3C01, "3Com NBP System control datagram", 3130Sstevel@tonic-gate 0x3C02, "3Com NBP Connect request (virtual cct)", 3140Sstevel@tonic-gate 0x3C03, "3Com NBP Connect response", 3150Sstevel@tonic-gate 0x3C04, "3Com NBP Connect complete", 3160Sstevel@tonic-gate 0x3C05, "3Com NBP Close request (virtual cct)", 3170Sstevel@tonic-gate 0x3C06, "3Com NBP Close response", 3180Sstevel@tonic-gate 0x3C07, "3Com NBP Datagram (like XNS IDP)", 3190Sstevel@tonic-gate 0x3C08, "3Com NBP Datagram broadcast", 3200Sstevel@tonic-gate 0x3C09, "3Com NBP Claim NetBIOS name", 3210Sstevel@tonic-gate 0x3C0A, "3Com NBP Delete Netbios name", 3220Sstevel@tonic-gate 0x3C0B, "3Com NBP Remote adaptor status request", 3230Sstevel@tonic-gate 0x3C0C, "3Com NBP Remote adaptor response", 3240Sstevel@tonic-gate 0x3C0D, "3Com NBP Reset", 3250Sstevel@tonic-gate 0x4242, "PCS Basic Block Protocol", 3260Sstevel@tonic-gate 0x4321, "THD - Diddle", 3270Sstevel@tonic-gate 0x5208, "BBN Simnet Private", 3280Sstevel@tonic-gate 0x6000, "DEC unass, experimental", 3290Sstevel@tonic-gate 0x6001, "DEC Dump/Load", 3300Sstevel@tonic-gate 0x6002, "DEC Remote Console", 3310Sstevel@tonic-gate 0x6003, "DECNET Phase IV, DNA Routing", 3320Sstevel@tonic-gate 0x6004, "DEC LAT", 3330Sstevel@tonic-gate 0x6005, "DEC Diagnostic", 3340Sstevel@tonic-gate 0x6006, "DEC customer protocol", 3350Sstevel@tonic-gate 0x6007, "DEC Local Area VAX Cluster (LAVC)", 3360Sstevel@tonic-gate 0x6008, "DEC unass (AMBER?)", 3370Sstevel@tonic-gate 0x6009, "DEC unass (MUMPS?)", 3380Sstevel@tonic-gate 0x6010, "3Com", 3390Sstevel@tonic-gate 0x6011, "3Com", 3400Sstevel@tonic-gate 0x6012, "3Com", 3410Sstevel@tonic-gate 0x6013, "3Com", 3420Sstevel@tonic-gate 0x6014, "3Com", 3430Sstevel@tonic-gate 0x7000, "Ungermann-Bass download", 3440Sstevel@tonic-gate 0x7001, "Ungermann-Bass NIUs", 3450Sstevel@tonic-gate 0x7002, "Ungermann-Bass diagnostic/loopback", 3460Sstevel@tonic-gate 0x7003, "Ungermann-Bass ? (NMC to/from UB Bridge)", 3470Sstevel@tonic-gate 0x7005, "Ungermann-Bass Bridge Spanning Tree", 3480Sstevel@tonic-gate 0x7007, "OS/9 Microware", 3490Sstevel@tonic-gate 0x7009, "OS/9 Net?", 3500Sstevel@tonic-gate 0x7020, "Sintrom", 3510Sstevel@tonic-gate 0x7021, "Sintrom", 3520Sstevel@tonic-gate 0x7022, "Sintrom", 3530Sstevel@tonic-gate 0x7023, "Sintrom", 3540Sstevel@tonic-gate 0x7024, "Sintrom", 3550Sstevel@tonic-gate 0x7025, "Sintrom", 3560Sstevel@tonic-gate 0x7026, "Sintrom", 3570Sstevel@tonic-gate 0x7027, "Sintrom", 3580Sstevel@tonic-gate 0x7028, "Sintrom", 3590Sstevel@tonic-gate 0x7029, "Sintrom", 3600Sstevel@tonic-gate 0x8003, "Cronus VLN", 3610Sstevel@tonic-gate 0x8004, "Cronus Direct", 3620Sstevel@tonic-gate 0x8005, "HP Probe protocol", 3630Sstevel@tonic-gate 0x8006, "Nestar", 3640Sstevel@tonic-gate 0x8008, "AT&T/Stanford Univ", 3650Sstevel@tonic-gate 0x8010, "Excelan", 3660Sstevel@tonic-gate 0x8013, "SGI diagnostic", 3670Sstevel@tonic-gate 0x8014, "SGI network games", 3680Sstevel@tonic-gate 0x8015, "SGI reserved", 3690Sstevel@tonic-gate 0x8016, "SGI XNS NameServer, bounce server", 3700Sstevel@tonic-gate 0x8019, "Apollo DOMAIN", 3710Sstevel@tonic-gate 0x802E, "Tymshare", 3720Sstevel@tonic-gate 0x802F, "Tigan,", 3730Sstevel@tonic-gate 0x8036, "Aeonic Systems", 3740Sstevel@tonic-gate 0x8037, "IPX (Novell Netware)", 3750Sstevel@tonic-gate 0x8038, "DEC LanBridge Management", 3760Sstevel@tonic-gate 0x8039, "DEC unass (DSM/DTP?)", 3770Sstevel@tonic-gate 0x803A, "DEC unass (Argonaut Console?)", 3780Sstevel@tonic-gate 0x803B, "DEC unass (VAXELN?)", 3790Sstevel@tonic-gate 0x803C, "DEC unass (NMSV? DNA Naming Service?)", 3800Sstevel@tonic-gate 0x803D, "DEC Ethernet CSMA/CD Encryption Protocol", 3810Sstevel@tonic-gate 0x803E, "DEC unass (DNA Time Service?)", 3820Sstevel@tonic-gate 0x803F, "DEC LAN Traffic Monitor Protocol", 3830Sstevel@tonic-gate 0x8040, "DEC unass (NetBios Emulator?)", 3840Sstevel@tonic-gate 0x8041, "DEC unass (MS/DOS?, Local Area System Transport?)", 3850Sstevel@tonic-gate 0x8042, "DEC unass", 3860Sstevel@tonic-gate 0x8044, "Planning Research Corp.", 3870Sstevel@tonic-gate 0x8046, "AT&T", 3880Sstevel@tonic-gate 0x8047, "AT&T", 3890Sstevel@tonic-gate 0x8049, "ExperData", 3900Sstevel@tonic-gate 0x805B, "VMTP", 3910Sstevel@tonic-gate 0x805C, "Stanford V Kernel, version 6.0", 3920Sstevel@tonic-gate 0x805D, "Evans & Sutherland", 3930Sstevel@tonic-gate 0x8060, "Little Machines", 3940Sstevel@tonic-gate 0x8062, "Counterpoint", 3950Sstevel@tonic-gate 0x8065, "University of Mass. at Amherst", 3960Sstevel@tonic-gate 0x8066, "University of Mass. at Amherst", 3970Sstevel@tonic-gate 0x8067, "Veeco Integrated Automation", 3980Sstevel@tonic-gate 0x8068, "General Dynamics", 3990Sstevel@tonic-gate 0x8069, "AT&T", 4000Sstevel@tonic-gate 0x806A, "Autophon", 4010Sstevel@tonic-gate 0x806C, "ComDesign", 4020Sstevel@tonic-gate 0x806D, "Compugraphic Corp", 4030Sstevel@tonic-gate 0x806E, "Landmark", 4040Sstevel@tonic-gate 0x806F, "Landmark", 4050Sstevel@tonic-gate 0x8070, "Landmark", 4060Sstevel@tonic-gate 0x8071, "Landmark", 4070Sstevel@tonic-gate 0x8072, "Landmark", 4080Sstevel@tonic-gate 0x8073, "Landmark", 4090Sstevel@tonic-gate 0x8074, "Landmark", 4100Sstevel@tonic-gate 0x8075, "Landmark", 4110Sstevel@tonic-gate 0x8076, "Landmark", 4120Sstevel@tonic-gate 0x8077, "Landmark", 4130Sstevel@tonic-gate 0x807A, "Matra", 4140Sstevel@tonic-gate 0x807B, "Dansk Data Elektronik", 4150Sstevel@tonic-gate 0x807C, "Merit Internodal", 4160Sstevel@tonic-gate 0x807D, "Vitalink", 4170Sstevel@tonic-gate 0x807E, "Vitalink", 4180Sstevel@tonic-gate 0x807F, "Vitalink", 4190Sstevel@tonic-gate 0x8080, "Vitalink TransLAN III Management", 4200Sstevel@tonic-gate 0x8081, "Counterpoint", 4210Sstevel@tonic-gate 0x8082, "Counterpoint", 4220Sstevel@tonic-gate 0x8083, "Counterpoint", 4230Sstevel@tonic-gate 0x8088, "Xyplex", 4240Sstevel@tonic-gate 0x8089, "Xyplex", 4250Sstevel@tonic-gate 0x808A, "Xyplex", 4260Sstevel@tonic-gate 0x809B, "EtherTalk (AppleTalk over Ethernet)", 4270Sstevel@tonic-gate 0x809C, "Datability", 4280Sstevel@tonic-gate 0x809D, "Datability", 4290Sstevel@tonic-gate 0x809E, "Datability", 4300Sstevel@tonic-gate 0x809F, "Spider Systems", 4310Sstevel@tonic-gate 0x80A3, "Nixdorf", 4320Sstevel@tonic-gate 0x80A4, "Siemens Gammasonics", 4330Sstevel@tonic-gate 0x80C0, "DCA Data Exchange Cluster", 4340Sstevel@tonic-gate 0x80C6, "Pacer Software", 4350Sstevel@tonic-gate 0x80C7, "Applitek Corp", 4360Sstevel@tonic-gate 0x80C8, "Intergraph", 4370Sstevel@tonic-gate 0x80C9, "Intergraph", 4380Sstevel@tonic-gate 0x80CB, "Intergraph", 4390Sstevel@tonic-gate 0x80CC, "Intergraph", 4400Sstevel@tonic-gate 0x80CA, "Intergraph", 4410Sstevel@tonic-gate 0x80CD, "Harris Corp", 4420Sstevel@tonic-gate 0x80CE, "Harris Corp", 4430Sstevel@tonic-gate 0x80CF, "Taylor Instrument", 4440Sstevel@tonic-gate 0x80D0, "Taylor Instrument", 4450Sstevel@tonic-gate 0x80D1, "Taylor Instrument", 4460Sstevel@tonic-gate 0x80D2, "Taylor Instrument", 4470Sstevel@tonic-gate 0x80D3, "Rosemount Corp", 4480Sstevel@tonic-gate 0x80D4, "Rosemount Corp", 4490Sstevel@tonic-gate 0x80D5, "IBM SNA Services over Ethernet", 4500Sstevel@tonic-gate 0x80DD, "Varian Associates", 4510Sstevel@tonic-gate 0x80DE, "TRFS", 4520Sstevel@tonic-gate 0x80DF, "TRFS", 4530Sstevel@tonic-gate 0x80E0, "Allen-Bradley", 4540Sstevel@tonic-gate 0x80E1, "Allen-Bradley", 4550Sstevel@tonic-gate 0x80E2, "Allen-Bradley", 4560Sstevel@tonic-gate 0x80E3, "Allen-Bradley", 4570Sstevel@tonic-gate 0x80E4, "Datability", 4580Sstevel@tonic-gate 0x80F2, "Retix", 4590Sstevel@tonic-gate 0x80F3, "AARP (Appletalk)", 4600Sstevel@tonic-gate 0x80F4, "Kinetics", 4610Sstevel@tonic-gate 0x80F5, "Kinetics", 4620Sstevel@tonic-gate 0x80F7, "Apollo", 4630Sstevel@tonic-gate 0x80FF, "Wellfleet Communications", 4640Sstevel@tonic-gate 0x8102, "Wellfleet Communications", 4650Sstevel@tonic-gate 0x8107, "Symbolics Private", 4660Sstevel@tonic-gate 0x8108, "Symbolics Private", 4670Sstevel@tonic-gate 0x8109, "Symbolics Private", 4680Sstevel@tonic-gate 0x812B, "Talaris", 4690Sstevel@tonic-gate 0x8130, "Waterloo", 4700Sstevel@tonic-gate 0x8131, "VG Lab", 4710Sstevel@tonic-gate 0x8137, "Novell (old) NetWare IPX", 4720Sstevel@tonic-gate 0x8138, "Novell", 4730Sstevel@tonic-gate 0x814C, "SNMP over Ethernet", 4740Sstevel@tonic-gate 0x817D, "XTP", 4750Sstevel@tonic-gate 0x81D6, "Lantastic", 4760Sstevel@tonic-gate 0x8888, "HP LanProbe test?", 4770Sstevel@tonic-gate 0x9000, "Loopback", 4780Sstevel@tonic-gate 0x9001, "3Com, XNS Systems Management", 4790Sstevel@tonic-gate 0x9002, "3Com, TCP/IP Systems Management", 4800Sstevel@tonic-gate 0x9003, "3Com, loopback detection", 4810Sstevel@tonic-gate 0xAAAA, "DECNET (VAX 6220 DEBNI)", 4820Sstevel@tonic-gate 0xFF00, "BBN VITAL-LanBridge cache wakeups", 4830Sstevel@tonic-gate 0, "", 4840Sstevel@tonic-gate }; 4850Sstevel@tonic-gate 4860Sstevel@tonic-gate char * 4870Sstevel@tonic-gate print_fc(type) 4880Sstevel@tonic-gate uint_t type; 4890Sstevel@tonic-gate { 4900Sstevel@tonic-gate 4910Sstevel@tonic-gate switch (type) { 4920Sstevel@tonic-gate case 0x50: return ("LLC"); 4930Sstevel@tonic-gate case 0x4f: return ("SMT NSA"); 4940Sstevel@tonic-gate case 0x41: return ("SMT Info"); 4950Sstevel@tonic-gate default: return ("Unknown"); 4960Sstevel@tonic-gate } 4970Sstevel@tonic-gate } 4980Sstevel@tonic-gate 4990Sstevel@tonic-gate char * 5000Sstevel@tonic-gate print_smtclass(type) 5010Sstevel@tonic-gate uint_t type; 5020Sstevel@tonic-gate { 5030Sstevel@tonic-gate switch (type) { 5040Sstevel@tonic-gate case 0x01: return ("NIF"); 5050Sstevel@tonic-gate case 0x02: return ("SIF Conf"); 5060Sstevel@tonic-gate case 0x03: return ("SIF Oper"); 5070Sstevel@tonic-gate case 0x04: return ("ECF"); 5080Sstevel@tonic-gate case 0x05: return ("RAF"); 5090Sstevel@tonic-gate case 0x06: return ("RDF"); 5100Sstevel@tonic-gate case 0x07: return ("SRF"); 5110Sstevel@tonic-gate case 0x08: return ("PMF Get"); 5120Sstevel@tonic-gate case 0x09: return ("PMF Change"); 5130Sstevel@tonic-gate case 0x0a: return ("PMF Add"); 5140Sstevel@tonic-gate case 0x0b: return ("PMF Remove"); 5150Sstevel@tonic-gate case 0xff: return ("ESF"); 5160Sstevel@tonic-gate default: return ("Unknown"); 5170Sstevel@tonic-gate } 5180Sstevel@tonic-gate 5190Sstevel@tonic-gate } 5200Sstevel@tonic-gate char * 5210Sstevel@tonic-gate print_smttype(type) 5220Sstevel@tonic-gate uint_t type; 5230Sstevel@tonic-gate { 5240Sstevel@tonic-gate switch (type) { 5250Sstevel@tonic-gate case 0x01: return ("Announce"); 5260Sstevel@tonic-gate case 0x02: return ("Request"); 5270Sstevel@tonic-gate case 0x03: return ("Response"); 5280Sstevel@tonic-gate default: return ("Unknown"); 5290Sstevel@tonic-gate } 5300Sstevel@tonic-gate 5310Sstevel@tonic-gate } 5320Sstevel@tonic-gate char * 5330Sstevel@tonic-gate print_ethertype(type) 5340Sstevel@tonic-gate int type; 5350Sstevel@tonic-gate { 5360Sstevel@tonic-gate int i; 5370Sstevel@tonic-gate 5380Sstevel@tonic-gate for (i = 0; ether_type[i].e_type; i++) 5390Sstevel@tonic-gate if (type == ether_type[i].e_type) 5400Sstevel@tonic-gate return (ether_type[i].e_name); 5410Sstevel@tonic-gate if (type < 1500) 5420Sstevel@tonic-gate return ("LLC/802.3"); 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate return ("Unknown"); 5450Sstevel@tonic-gate } 5460Sstevel@tonic-gate 5470Sstevel@tonic-gate #define MAX_RDFLDS 14 /* changed to 14 from 8 as per IEEE */ 5480Sstevel@tonic-gate #define TR_FN_ADDR 0x80 /* dest addr is functional */ 5490Sstevel@tonic-gate #define TR_SR_ADDR 0x80 /* MAC utilizes source route */ 5500Sstevel@tonic-gate #define ACFCDASA_LEN 14 /* length of AC|FC|DA|SA */ 5510Sstevel@tonic-gate #define TR_MAC_MASK 0xc0 5520Sstevel@tonic-gate #define TR_AC 0x00 /* Token Ring access control */ 5530Sstevel@tonic-gate #define TR_LLC_FC 0x40 /* Token Ring llc frame control */ 5540Sstevel@tonic-gate #define LSAP_SNAP 0xaa 5550Sstevel@tonic-gate #define LLC_SNAP_HDR_LEN 8 5560Sstevel@tonic-gate #define LLC_HDR1_LEN 3 /* DON'T use sizeof(struct llc_hdr1) */ 5570Sstevel@tonic-gate #define CNTL_LLC_UI 0x03 /* un-numbered information packet */ 5580Sstevel@tonic-gate 5590Sstevel@tonic-gate /* 5600Sstevel@tonic-gate * Source Routing Route Information field. 5610Sstevel@tonic-gate */ 5620Sstevel@tonic-gate struct tr_ri { 5630Sstevel@tonic-gate #if defined(_BIT_FIELDS_HTOL) 5640Sstevel@tonic-gate uchar_t rt:3; /* routing type */ 5650Sstevel@tonic-gate uchar_t len:5; /* length */ 5660Sstevel@tonic-gate uchar_t dir:1; /* direction bit */ 5670Sstevel@tonic-gate uchar_t mtu:3; /* largest frame */ 5680Sstevel@tonic-gate uchar_t res:4; /* reserved */ 5690Sstevel@tonic-gate #elif defined(_BIT_FIELDS_LTOH) 5700Sstevel@tonic-gate uchar_t len:5; /* length */ 5710Sstevel@tonic-gate uchar_t rt:3; /* routing type */ 5720Sstevel@tonic-gate uchar_t res:4; /* reserved */ 5730Sstevel@tonic-gate uchar_t mtu:3; /* largest frame */ 5740Sstevel@tonic-gate uchar_t dir:1; /* direction bit */ 5750Sstevel@tonic-gate #endif 5760Sstevel@tonic-gate /* 5770Sstevel@tonic-gate * In little endian machine, the ring field has to be stored in a 5780Sstevel@tonic-gate * ushort_t type. This implies that it is not possible to have a 5790Sstevel@tonic-gate * layout of bit field to represent bridge and ring. 5800Sstevel@tonic-gate * 5810Sstevel@tonic-gate * If the compiler uses _BIT_FIELDS_HTOL and it is a big endian 5820Sstevel@tonic-gate * machine, the following bit field definition will work. 5830Sstevel@tonic-gate * 5840Sstevel@tonic-gate * struct tr_rd { 5850Sstevel@tonic-gate * ushort_t bridge:4; 5860Sstevel@tonic-gate * ushort_t ring:12; 5870Sstevel@tonic-gate * } rd[MAX_RDFLDS]; 5880Sstevel@tonic-gate * 5890Sstevel@tonic-gate * If the compiler uses _BIT_FIELDS_LTOH and it is a big endian 5900Sstevel@tonic-gate * machine, the definition can be changed to 5910Sstevel@tonic-gate * 5920Sstevel@tonic-gate * struct tr_rd { 5930Sstevel@tonic-gate * ushort_t bridge:4; 5940Sstevel@tonic-gate * ushort_t ring:12; 5950Sstevel@tonic-gate * } rd[MAX_RDFLDS]; 5960Sstevel@tonic-gate * 5970Sstevel@tonic-gate * With little endian machine, we need to use 2 macroes. For 5980Sstevel@tonic-gate * simplicity, since the macroes work for both big and little 5990Sstevel@tonic-gate * endian machines, we will not use bit fields for the 6000Sstevel@tonic-gate * definition. 6010Sstevel@tonic-gate */ 6020Sstevel@tonic-gate #define bridge(route) (ntohs((ushort_t)(route)) & 0x0F) 6030Sstevel@tonic-gate #define ring(route) (ntohs((ushort_t)(route)) >> 4) 6040Sstevel@tonic-gate 6050Sstevel@tonic-gate ushort_t rd[MAX_RDFLDS]; /* route designator fields */ 6060Sstevel@tonic-gate }; 6070Sstevel@tonic-gate 6080Sstevel@tonic-gate struct tr_header { 6090Sstevel@tonic-gate uchar_t ac; 6100Sstevel@tonic-gate uchar_t fc; 6110Sstevel@tonic-gate struct ether_addr dhost; 6120Sstevel@tonic-gate struct ether_addr shost; 6130Sstevel@tonic-gate struct tr_ri ri; 6140Sstevel@tonic-gate }; 6150Sstevel@tonic-gate 6160Sstevel@tonic-gate struct llc_snap_hdr { 6170Sstevel@tonic-gate uchar_t d_lsap; /* destination service access point */ 6180Sstevel@tonic-gate uchar_t s_lsap; /* source link service access point */ 6190Sstevel@tonic-gate uchar_t control; /* short control field */ 6200Sstevel@tonic-gate uchar_t org[3]; /* Ethernet style organization field */ 6210Sstevel@tonic-gate ushort_t type; /* Ethernet style type field */ 6220Sstevel@tonic-gate }; 6230Sstevel@tonic-gate 6240Sstevel@tonic-gate struct ether_addr tokenbroadcastaddr2 = { 6250Sstevel@tonic-gate 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff 6260Sstevel@tonic-gate }; 6270Sstevel@tonic-gate 6280Sstevel@tonic-gate int Mtutab[] = {516, 1470, 2052, 4472, 8144, 11407, 17800}; 6290Sstevel@tonic-gate 6300Sstevel@tonic-gate char * 6310Sstevel@tonic-gate print_sr(struct tr_ri *rh) 6320Sstevel@tonic-gate { 6330Sstevel@tonic-gate int hops, ii; 6340Sstevel@tonic-gate static char line[512]; 6350Sstevel@tonic-gate 6360Sstevel@tonic-gate sprintf(line, "TR Source Route dir=%d, mtu=%d", 6370Sstevel@tonic-gate rh->dir, Mtutab[rh->mtu]); 6380Sstevel@tonic-gate 6390Sstevel@tonic-gate hops = (int)(rh->len - 2) / (int)2; 6400Sstevel@tonic-gate 6410Sstevel@tonic-gate if (hops) { 6420Sstevel@tonic-gate sprintf(line+strlen(line), ", Route: "); 6430Sstevel@tonic-gate for (ii = 0; ii < hops; ii++) { 6440Sstevel@tonic-gate if (! bridge(rh->rd[ii])) { 6450Sstevel@tonic-gate sprintf(line+strlen(line), "(%d)", 6460Sstevel@tonic-gate ring(rh->rd[ii])); 6470Sstevel@tonic-gate } else { 6480Sstevel@tonic-gate sprintf(line+strlen(line), "(%d)%d", 6490Sstevel@tonic-gate ring(rh->rd[ii]), bridge(rh->rd[ii])); 6500Sstevel@tonic-gate } 6510Sstevel@tonic-gate } 6520Sstevel@tonic-gate } 6530Sstevel@tonic-gate return (&line[0]); 6540Sstevel@tonic-gate } 6550Sstevel@tonic-gate 6560Sstevel@tonic-gate uint_t 6570Sstevel@tonic-gate interpret_tr(flags, e, elen, origlen) 6580Sstevel@tonic-gate int flags; 6590Sstevel@tonic-gate caddr_t e; 6600Sstevel@tonic-gate int elen, origlen; 6610Sstevel@tonic-gate { 6620Sstevel@tonic-gate struct tr_header *mh; 6630Sstevel@tonic-gate struct tr_ri *rh; 6640Sstevel@tonic-gate uchar_t fc; 6650Sstevel@tonic-gate struct llc_snap_hdr *snaphdr; 6660Sstevel@tonic-gate char *off; 6670Sstevel@tonic-gate int maclen, len; 6680Sstevel@tonic-gate boolean_t data_copied = B_FALSE; 6690Sstevel@tonic-gate extern char *dst_name, *src_name; 6700Sstevel@tonic-gate int ethertype; 6710Sstevel@tonic-gate int is_llc = 0, is_snap = 0, source_routing = 0; 6720Sstevel@tonic-gate int tr_machdr_len(char *, int *, int *); 6730Sstevel@tonic-gate int blen = MAX(origlen, 17800); 6740Sstevel@tonic-gate 6750Sstevel@tonic-gate if (data != NULL && datalen != 0 && datalen < blen) { 6760Sstevel@tonic-gate free(data); 6770Sstevel@tonic-gate data = NULL; 6780Sstevel@tonic-gate datalen = 0; 6790Sstevel@tonic-gate } 6800Sstevel@tonic-gate if (!data) { 6810Sstevel@tonic-gate data = (char *)malloc(blen); 6820Sstevel@tonic-gate if (!data) 6830Sstevel@tonic-gate pr_err("Warning: malloc failure"); 6840Sstevel@tonic-gate datalen = blen; 6850Sstevel@tonic-gate } 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate if (origlen < ACFCDASA_LEN) { 6880Sstevel@tonic-gate if (flags & F_SUM) 6890Sstevel@tonic-gate (void) sprintf(get_sum_line(), 6900Sstevel@tonic-gate "RUNT (short packet - %d bytes)", 6910Sstevel@tonic-gate origlen); 6920Sstevel@tonic-gate if (flags & F_DTAIL) 6930Sstevel@tonic-gate show_header("RUNT: ", "Short packet", origlen); 6940Sstevel@tonic-gate return (elen); 6950Sstevel@tonic-gate } 6960Sstevel@tonic-gate if (elen < ACFCDASA_LEN) 6970Sstevel@tonic-gate return (elen); 6980Sstevel@tonic-gate 6990Sstevel@tonic-gate mh = (struct tr_header *)e; 7000Sstevel@tonic-gate rh = (struct tr_ri *)&mh->ri; 7010Sstevel@tonic-gate fc = mh->fc; 7020Sstevel@tonic-gate 7030Sstevel@tonic-gate if (is_llc = tr_machdr_len(e, &maclen, &source_routing)) { 7040Sstevel@tonic-gate snaphdr = (struct llc_snap_hdr *)(e + maclen); 7050Sstevel@tonic-gate if (snaphdr->d_lsap == LSAP_SNAP && 7060Sstevel@tonic-gate snaphdr->s_lsap == LSAP_SNAP && 7070Sstevel@tonic-gate snaphdr->control == CNTL_LLC_UI) { 7080Sstevel@tonic-gate is_snap = 1; 7090Sstevel@tonic-gate } 7100Sstevel@tonic-gate } 7110Sstevel@tonic-gate 7120Sstevel@tonic-gate if (memcmp(&mh->dhost, ðer_broadcast, 7130Sstevel@tonic-gate sizeof (struct ether_addr)) == 0) 7140Sstevel@tonic-gate dst_name = "(broadcast)"; 7150Sstevel@tonic-gate else if (memcmp(&mh->dhost, &tokenbroadcastaddr2, 7160Sstevel@tonic-gate sizeof (struct ether_addr)) == 0) 7170Sstevel@tonic-gate dst_name = "(mac broadcast)"; 7180Sstevel@tonic-gate else if (mh->dhost.ether_addr_octet[0] & TR_FN_ADDR) 7190Sstevel@tonic-gate dst_name = "(functional)"; 7200Sstevel@tonic-gate 7210Sstevel@tonic-gate if (is_snap) 7220Sstevel@tonic-gate ethertype = ntohs(snaphdr->type); 7230Sstevel@tonic-gate else { 7240Sstevel@tonic-gate src_name = print_etherinfo(&mh->shost); 7250Sstevel@tonic-gate dst_name = print_etherinfo(&mh->dhost); 7260Sstevel@tonic-gate } 7270Sstevel@tonic-gate 7280Sstevel@tonic-gate /* 7290Sstevel@tonic-gate * The 14 byte ether header screws up alignment 7300Sstevel@tonic-gate * of the rest of the packet for 32 bit aligned 7310Sstevel@tonic-gate * architectures like SPARC. Alas, we have to copy 7320Sstevel@tonic-gate * the rest of the packet in order to align it. 7330Sstevel@tonic-gate */ 7340Sstevel@tonic-gate if (is_llc) { 7350Sstevel@tonic-gate if (is_snap) { 7360Sstevel@tonic-gate len = elen - (maclen + LLC_SNAP_HDR_LEN); 7370Sstevel@tonic-gate off = (char *)(e + maclen + LLC_SNAP_HDR_LEN); 7380Sstevel@tonic-gate } else { 7390Sstevel@tonic-gate len = elen - (maclen + LLC_HDR1_LEN); 7400Sstevel@tonic-gate off = (char *)(e + maclen + LLC_HDR1_LEN); 7410Sstevel@tonic-gate } 7420Sstevel@tonic-gate } else { 7430Sstevel@tonic-gate len = elen - maclen; 7440Sstevel@tonic-gate off = (char *)(e + maclen); 7450Sstevel@tonic-gate } 7460Sstevel@tonic-gate 7470Sstevel@tonic-gate if (len > 0 && (off + len <= (char *)e + elen)) { 7480Sstevel@tonic-gate (void) memcpy(data, off, len); 7490Sstevel@tonic-gate data_copied = B_TRUE; 7500Sstevel@tonic-gate } 7510Sstevel@tonic-gate 7520Sstevel@tonic-gate if (flags & F_SUM) { 7530Sstevel@tonic-gate if (source_routing) 7540Sstevel@tonic-gate sprintf(get_sum_line(), print_sr(rh)); 7550Sstevel@tonic-gate 7560Sstevel@tonic-gate if (is_llc) { 7570Sstevel@tonic-gate if (is_snap) { 7580Sstevel@tonic-gate (void) sprintf(get_sum_line(), 7590Sstevel@tonic-gate "TR LLC w/SNAP Type=%04X (%s), size=%d bytes", 7600Sstevel@tonic-gate ethertype, 7610Sstevel@tonic-gate print_ethertype(ethertype), 7620Sstevel@tonic-gate origlen); 7630Sstevel@tonic-gate } else { 7640Sstevel@tonic-gate (void) sprintf(get_sum_line(), 7650Sstevel@tonic-gate "TR LLC, but no SNAP encoding, size = %d bytes", 7660Sstevel@tonic-gate origlen); 7670Sstevel@tonic-gate } 7680Sstevel@tonic-gate } else { 7690Sstevel@tonic-gate (void) sprintf(get_sum_line(), 7700Sstevel@tonic-gate "TR MAC FC=%02X (%s), size = %d bytes", 7710Sstevel@tonic-gate fc, print_fc(fc), origlen); 7720Sstevel@tonic-gate } 7730Sstevel@tonic-gate } 7740Sstevel@tonic-gate 7750Sstevel@tonic-gate if (flags & F_DTAIL) { 7760Sstevel@tonic-gate show_header("TR: ", "TR Header", elen); 7770Sstevel@tonic-gate show_space(); 7780Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 7790Sstevel@tonic-gate "Packet %d arrived at %d:%02d:%d.%05d", 7800Sstevel@tonic-gate pi_frame, 7810Sstevel@tonic-gate pi_time_hour, pi_time_min, pi_time_sec, 7820Sstevel@tonic-gate pi_time_usec / 10); 7830Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 7840Sstevel@tonic-gate "Packet size = %d bytes", 7850Sstevel@tonic-gate elen); 7860Sstevel@tonic-gate (void) sprintf(get_line(0, 1), 7870Sstevel@tonic-gate "Frame Control = %02x (%s)", 7880Sstevel@tonic-gate fc, print_fc(fc)); 7890Sstevel@tonic-gate (void) sprintf(get_line(2, 6), 7900Sstevel@tonic-gate "Destination = %s, %s", 7910Sstevel@tonic-gate printether(&mh->dhost), 7920Sstevel@tonic-gate print_etherinfo(&mh->dhost)); 7930Sstevel@tonic-gate (void) sprintf(get_line(8, 6), 7940Sstevel@tonic-gate "Source = %s, %s", 7950Sstevel@tonic-gate printether(&mh->shost), 7960Sstevel@tonic-gate print_etherinfo(&mh->shost)); 7970Sstevel@tonic-gate 7980Sstevel@tonic-gate if (source_routing) 7990Sstevel@tonic-gate sprintf(get_line(ACFCDASA_LEN, rh->len), print_sr(rh)); 8000Sstevel@tonic-gate 8010Sstevel@tonic-gate if (is_llc) { 8020Sstevel@tonic-gate (void) sprintf(get_line(maclen, 1), 8030Sstevel@tonic-gate "Dest Service Access Point = %02x", 8040Sstevel@tonic-gate snaphdr->d_lsap); 8050Sstevel@tonic-gate (void) sprintf(get_line(maclen+1, 1), 8060Sstevel@tonic-gate "Source Service Access Point = %02x", 8070Sstevel@tonic-gate snaphdr->s_lsap); 8080Sstevel@tonic-gate (void) sprintf(get_line(maclen+2, 1), 8090Sstevel@tonic-gate "Control = %02x", 8100Sstevel@tonic-gate snaphdr->control); 8110Sstevel@tonic-gate if (is_snap) 8120Sstevel@tonic-gate (void) sprintf(get_line(maclen+3, 3), 8130Sstevel@tonic-gate "SNAP Protocol Id = %02x%02x%02x", 8140Sstevel@tonic-gate snaphdr->org[0], snaphdr->org[1], 8150Sstevel@tonic-gate snaphdr->org[2]); 8160Sstevel@tonic-gate } 8170Sstevel@tonic-gate 8180Sstevel@tonic-gate if (is_snap) 8190Sstevel@tonic-gate (void) sprintf(get_line(maclen+6, 2), 8200Sstevel@tonic-gate "SNAP Type = %04X (%s)", 8210Sstevel@tonic-gate ethertype, print_ethertype(ethertype)); 8220Sstevel@tonic-gate 8230Sstevel@tonic-gate show_space(); 8240Sstevel@tonic-gate } 8250Sstevel@tonic-gate 8260Sstevel@tonic-gate /* go to the next protocol layer */ 8270Sstevel@tonic-gate if (is_snap && data_copied) { 8280Sstevel@tonic-gate switch (ethertype) { 8290Sstevel@tonic-gate case ETHERTYPE_IP: 8300Sstevel@tonic-gate (void) interpret_ip(flags, (struct ip *)data, len); 8310Sstevel@tonic-gate break; 8320Sstevel@tonic-gate /* Just in case it is decided to add this type */ 8330Sstevel@tonic-gate case ETHERTYPE_IPV6: 8340Sstevel@tonic-gate (void) interpret_ipv6(flags, (ip6_t *)data, len); 8350Sstevel@tonic-gate break; 8360Sstevel@tonic-gate case ETHERTYPE_ARP: 8370Sstevel@tonic-gate case ETHERTYPE_REVARP: 8380Sstevel@tonic-gate interpret_arp(flags, (struct arphdr *)data, len); 8390Sstevel@tonic-gate break; 8400Sstevel@tonic-gate case ETHERTYPE_AARP: /* AppleTalk */ 8410Sstevel@tonic-gate interpret_aarp(flags, data, len); 8420Sstevel@tonic-gate break; 8430Sstevel@tonic-gate case ETHERTYPE_AT: 8440Sstevel@tonic-gate interpret_at(flags, (struct ddp_hdr *)data, len); 8450Sstevel@tonic-gate break; 8460Sstevel@tonic-gate default: 8470Sstevel@tonic-gate break; 8480Sstevel@tonic-gate } 8490Sstevel@tonic-gate } 8500Sstevel@tonic-gate 8510Sstevel@tonic-gate return (elen); 8520Sstevel@tonic-gate } 8530Sstevel@tonic-gate 8540Sstevel@tonic-gate 8550Sstevel@tonic-gate /* 8560Sstevel@tonic-gate * stuffs length of mac and ri fields into *lenp 8570Sstevel@tonic-gate * returns: 8580Sstevel@tonic-gate * 0: mac frame 8590Sstevel@tonic-gate * 1: llc frame 8600Sstevel@tonic-gate */ 8610Sstevel@tonic-gate int 8620Sstevel@tonic-gate tr_machdr_len(char *e, int *lenp, int *source_routing) 8630Sstevel@tonic-gate { 8640Sstevel@tonic-gate struct tr_header *mh; 8650Sstevel@tonic-gate struct tr_ri *rh; 8660Sstevel@tonic-gate uchar_t fc; 8670Sstevel@tonic-gate 8680Sstevel@tonic-gate mh = (struct tr_header *)e; 8690Sstevel@tonic-gate rh = (struct tr_ri *)&mh->ri; 8700Sstevel@tonic-gate fc = mh->fc; 8710Sstevel@tonic-gate 8720Sstevel@tonic-gate if (mh->shost.ether_addr_octet[0] & TR_SR_ADDR) { 8730Sstevel@tonic-gate *lenp = ACFCDASA_LEN + rh->len; 8740Sstevel@tonic-gate *source_routing = 1; 8750Sstevel@tonic-gate } else { 8760Sstevel@tonic-gate *lenp = ACFCDASA_LEN; 8770Sstevel@tonic-gate *source_routing = 0; 8780Sstevel@tonic-gate } 8790Sstevel@tonic-gate 8800Sstevel@tonic-gate if ((fc & TR_MAC_MASK) == 0) 8810Sstevel@tonic-gate return (0); /* it's a MAC frame */ 8820Sstevel@tonic-gate else 8830Sstevel@tonic-gate return (1); /* it's an LLC frame */ 8840Sstevel@tonic-gate } 8850Sstevel@tonic-gate 8860Sstevel@tonic-gate uint_t 8870Sstevel@tonic-gate tr_header_len(e) 8880Sstevel@tonic-gate char *e; 8890Sstevel@tonic-gate { 8900Sstevel@tonic-gate struct llc_snap_hdr *snaphdr; 8910Sstevel@tonic-gate int len = 0, source_routing; 8920Sstevel@tonic-gate 8930Sstevel@tonic-gate if (tr_machdr_len(e, &len, &source_routing) == 0) 8940Sstevel@tonic-gate return (len); /* it's a MAC frame */ 8950Sstevel@tonic-gate 8960Sstevel@tonic-gate snaphdr = (struct llc_snap_hdr *)(e + len); 8970Sstevel@tonic-gate if (snaphdr->d_lsap == LSAP_SNAP && 8980Sstevel@tonic-gate snaphdr->s_lsap == LSAP_SNAP && 8990Sstevel@tonic-gate snaphdr->control == CNTL_LLC_UI) 9000Sstevel@tonic-gate len += LLC_SNAP_HDR_LEN; /* it's a SNAP frame */ 9010Sstevel@tonic-gate else 9020Sstevel@tonic-gate len += LLC_HDR1_LEN; 9030Sstevel@tonic-gate 9040Sstevel@tonic-gate return (len); 9050Sstevel@tonic-gate } 9060Sstevel@tonic-gate 9070Sstevel@tonic-gate struct fddi_header { 9080Sstevel@tonic-gate uchar_t fc; 9090Sstevel@tonic-gate struct ether_addr dhost, shost; 9100Sstevel@tonic-gate uchar_t dsap, ssap, ctl, proto_id[3]; 9110Sstevel@tonic-gate ushort_t type; 9120Sstevel@tonic-gate }; 9130Sstevel@tonic-gate 9140Sstevel@tonic-gate uint_t 9150Sstevel@tonic-gate interpret_fddi(flags, e, elen, origlen) 9160Sstevel@tonic-gate int flags; 9170Sstevel@tonic-gate caddr_t e; 9180Sstevel@tonic-gate int elen, origlen; 9190Sstevel@tonic-gate { 9200Sstevel@tonic-gate struct fddi_header fhdr, *f = &fhdr; 9210Sstevel@tonic-gate char *off; 9220Sstevel@tonic-gate int len; 9230Sstevel@tonic-gate boolean_t data_copied = B_FALSE; 9240Sstevel@tonic-gate extern char *dst_name, *src_name; 9250Sstevel@tonic-gate int ethertype; 9260Sstevel@tonic-gate int is_llc = 0, is_smt = 0, is_snap = 0; 9270Sstevel@tonic-gate int blen = MAX(origlen, 4500); 9280Sstevel@tonic-gate 9290Sstevel@tonic-gate if (data != NULL && datalen != 0 && datalen < blen) { 9300Sstevel@tonic-gate free(data); 9310Sstevel@tonic-gate data = NULL; 9320Sstevel@tonic-gate datalen = 0; 9330Sstevel@tonic-gate } 9340Sstevel@tonic-gate if (!data) { 9350Sstevel@tonic-gate data = (char *)malloc(blen); 9360Sstevel@tonic-gate if (!data) 9370Sstevel@tonic-gate pr_err("Warning: malloc failure"); 9380Sstevel@tonic-gate datalen = blen; 9390Sstevel@tonic-gate } 9400Sstevel@tonic-gate 9410Sstevel@tonic-gate if (origlen < 13) { 9420Sstevel@tonic-gate if (flags & F_SUM) 9430Sstevel@tonic-gate (void) sprintf(get_sum_line(), 9440Sstevel@tonic-gate "RUNT (short packet - %d bytes)", 9450Sstevel@tonic-gate origlen); 9460Sstevel@tonic-gate if (flags & F_DTAIL) 9470Sstevel@tonic-gate show_header("RUNT: ", "Short packet", origlen); 9480Sstevel@tonic-gate return (elen); 9490Sstevel@tonic-gate } 9500Sstevel@tonic-gate if (elen < 13) 9510Sstevel@tonic-gate return (elen); 9520Sstevel@tonic-gate 9530Sstevel@tonic-gate (void) memcpy(&f->fc, e, sizeof (f->fc)); 9540Sstevel@tonic-gate addr_copy_swap(&f->dhost, (struct ether_addr *)(e+1)); 9550Sstevel@tonic-gate addr_copy_swap(&f->shost, (struct ether_addr *)(e+7)); 9560Sstevel@tonic-gate 9570Sstevel@tonic-gate if ((f->fc&0x50) == 0x50) { 9580Sstevel@tonic-gate is_llc = 1; 9590Sstevel@tonic-gate (void) memcpy(&f->dsap, e+13, sizeof (f->dsap)); 9600Sstevel@tonic-gate (void) memcpy(&f->ssap, e+14, sizeof (f->ssap)); 9610Sstevel@tonic-gate (void) memcpy(&f->ctl, e+15, sizeof (f->ctl)); 9620Sstevel@tonic-gate if (f->dsap == 0xaa && f->ssap == 0xaa) { 9630Sstevel@tonic-gate is_snap = 1; 9640Sstevel@tonic-gate (void) memcpy(&f->proto_id, e+16, sizeof (f->proto_id)); 9650Sstevel@tonic-gate (void) memcpy(&f->type, e+19, sizeof (f->type)); 9660Sstevel@tonic-gate } 9670Sstevel@tonic-gate } else { 9680Sstevel@tonic-gate if ((f->fc&0x41) == 0x41 || (f->fc&0x4f) == 0x4f) { 9690Sstevel@tonic-gate is_smt = 1; 9700Sstevel@tonic-gate } 9710Sstevel@tonic-gate } 9720Sstevel@tonic-gate 9730Sstevel@tonic-gate 9740Sstevel@tonic-gate if (memcmp(&f->dhost, ðer_broadcast, 9750Sstevel@tonic-gate sizeof (struct ether_addr)) == 0) 9760Sstevel@tonic-gate dst_name = "(broadcast)"; 9770Sstevel@tonic-gate else if (f->dhost.ether_addr_octet[0] & 0x01) 9780Sstevel@tonic-gate dst_name = "(multicast)"; 9790Sstevel@tonic-gate 9800Sstevel@tonic-gate if (is_snap) 9810Sstevel@tonic-gate ethertype = ntohs(f->type); 9820Sstevel@tonic-gate else { 9830Sstevel@tonic-gate src_name = print_etherinfo(&f->shost); 9840Sstevel@tonic-gate dst_name = print_etherinfo(&f->dhost); 9850Sstevel@tonic-gate } 9860Sstevel@tonic-gate 9870Sstevel@tonic-gate /* 9880Sstevel@tonic-gate * The 14 byte ether header screws up alignment 9890Sstevel@tonic-gate * of the rest of the packet for 32 bit aligned 9900Sstevel@tonic-gate * architectures like SPARC. Alas, we have to copy 9910Sstevel@tonic-gate * the rest of the packet in order to align it. 9920Sstevel@tonic-gate */ 9930Sstevel@tonic-gate if (is_llc) { 9940Sstevel@tonic-gate if (is_snap) { 9950Sstevel@tonic-gate len = elen - 21; 9960Sstevel@tonic-gate off = (char *)(e + 21); 9970Sstevel@tonic-gate } else { 9980Sstevel@tonic-gate len = elen - 16; 9990Sstevel@tonic-gate off = (char *)(e + 16); 10000Sstevel@tonic-gate } 10010Sstevel@tonic-gate } else { 10020Sstevel@tonic-gate len = elen - 13; 10030Sstevel@tonic-gate off = (char *)(e + 13); 10040Sstevel@tonic-gate } 10050Sstevel@tonic-gate 10060Sstevel@tonic-gate if (len > 0 && (off + len <= (char *)e + elen)) { 10070Sstevel@tonic-gate (void) memcpy(data, off, len); 10080Sstevel@tonic-gate data_copied = B_TRUE; 10090Sstevel@tonic-gate } 10100Sstevel@tonic-gate 10110Sstevel@tonic-gate if (flags & F_SUM) { 10120Sstevel@tonic-gate if (is_llc) { 10130Sstevel@tonic-gate if (is_snap) { 10140Sstevel@tonic-gate (void) sprintf(get_sum_line(), 10150Sstevel@tonic-gate "FDDI LLC Type=%04X (%s), size = %d bytes", 10160Sstevel@tonic-gate ethertype, 10170Sstevel@tonic-gate print_ethertype(ethertype), 10180Sstevel@tonic-gate origlen); 10190Sstevel@tonic-gate } else { 10200Sstevel@tonic-gate (void) sprintf(get_sum_line(), 10210Sstevel@tonic-gate "LLC, but no SNAP encoding, size = %d bytes", 10220Sstevel@tonic-gate origlen); 10230Sstevel@tonic-gate } 10240Sstevel@tonic-gate } else if (is_smt) { 10250Sstevel@tonic-gate (void) sprintf(get_sum_line(), 10260Sstevel@tonic-gate "SMT Type=%02X (%s), Class = %02X (%s), size = %d bytes", 10270Sstevel@tonic-gate *(uchar_t *)(data+1), print_smttype(*(data+1)), *data, 10280Sstevel@tonic-gate print_smtclass(*data), origlen); 10290Sstevel@tonic-gate } else { 10300Sstevel@tonic-gate (void) sprintf(get_sum_line(), 10310Sstevel@tonic-gate "FC=%02X (%s), size = %d bytes", 10320Sstevel@tonic-gate f->fc, print_fc(f->fc), origlen); 10330Sstevel@tonic-gate } 10340Sstevel@tonic-gate } 10350Sstevel@tonic-gate 10360Sstevel@tonic-gate if (flags & F_DTAIL) { 10370Sstevel@tonic-gate show_header("FDDI: ", "FDDI Header", elen); 10380Sstevel@tonic-gate show_space(); 10390Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 10400Sstevel@tonic-gate "Packet %d arrived at %d:%02d:%d.%05d", 10410Sstevel@tonic-gate pi_frame, 10420Sstevel@tonic-gate pi_time_hour, pi_time_min, pi_time_sec, 10430Sstevel@tonic-gate pi_time_usec / 10); 10440Sstevel@tonic-gate (void) sprintf(get_line(0, 0), 10450Sstevel@tonic-gate "Packet size = %d bytes", 10460Sstevel@tonic-gate elen, elen); 10470Sstevel@tonic-gate (void) sprintf(get_line(0, 6), 10480Sstevel@tonic-gate "Destination = %s, %s", 10490Sstevel@tonic-gate printether(&f->dhost), 10500Sstevel@tonic-gate print_etherinfo(&f->dhost)); 10510Sstevel@tonic-gate (void) sprintf(get_line(6, 6), 10520Sstevel@tonic-gate "Source = %s, %s", 10530Sstevel@tonic-gate printether(&f->shost), 10540Sstevel@tonic-gate print_etherinfo(&f->shost)); 10550Sstevel@tonic-gate 10560Sstevel@tonic-gate if (is_llc) { 10570Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10580Sstevel@tonic-gate "Frame Control = %02x (%s)", 10590Sstevel@tonic-gate f->fc, print_fc(f->fc)); 10600Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10610Sstevel@tonic-gate "Dest Service Access Point = %02x", 10620Sstevel@tonic-gate f->dsap); 10630Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10640Sstevel@tonic-gate "Source Service Access Point = %02x", 10650Sstevel@tonic-gate f->ssap); 10660Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10670Sstevel@tonic-gate "Control = %02x", 10680Sstevel@tonic-gate f->ctl); 10690Sstevel@tonic-gate if (is_snap) 10700Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10710Sstevel@tonic-gate "Protocol Id = %02x%02x%02x", 10720Sstevel@tonic-gate f->proto_id[0], f->proto_id[1], f->proto_id[2]); 10730Sstevel@tonic-gate } else if (is_smt) { 10740Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10750Sstevel@tonic-gate "Frame Control = %02x (%s)", 10760Sstevel@tonic-gate f->fc, print_fc(f->fc)); 10770Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10780Sstevel@tonic-gate "Class = %02x (%s)", 10790Sstevel@tonic-gate (uchar_t)*data, print_smtclass(*data)); 10800Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10810Sstevel@tonic-gate "Type = %02x (%s)", 10820Sstevel@tonic-gate *(uchar_t *)(data+1), print_smttype(*(data+1))); 10830Sstevel@tonic-gate } else { 10840Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10850Sstevel@tonic-gate "FC=%02X (%s), size = %d bytes", 10860Sstevel@tonic-gate f->fc, print_fc(f->fc), origlen); 10870Sstevel@tonic-gate } 10880Sstevel@tonic-gate 10890Sstevel@tonic-gate if (is_snap) 10900Sstevel@tonic-gate (void) sprintf(get_line(12, 2), 10910Sstevel@tonic-gate "LLC Type = %04X (%s)", 10920Sstevel@tonic-gate ethertype, print_ethertype(ethertype)); 10930Sstevel@tonic-gate 10940Sstevel@tonic-gate show_space(); 10950Sstevel@tonic-gate } 10960Sstevel@tonic-gate 10970Sstevel@tonic-gate /* go to the next protocol layer */ 10980Sstevel@tonic-gate if (is_llc && is_snap && f->ctl == 0x03 && data_copied) { 10990Sstevel@tonic-gate switch (ethertype) { 11000Sstevel@tonic-gate case ETHERTYPE_IP: 11010Sstevel@tonic-gate (void) interpret_ip(flags, (struct ip *)data, len); 11020Sstevel@tonic-gate break; 11030Sstevel@tonic-gate /* Just in case it is decided to add this type */ 11040Sstevel@tonic-gate case ETHERTYPE_IPV6: 11050Sstevel@tonic-gate (void) interpret_ipv6(flags, (ip6_t *)data, len); 11060Sstevel@tonic-gate break; 11070Sstevel@tonic-gate case ETHERTYPE_ARP: 11080Sstevel@tonic-gate case ETHERTYPE_REVARP: 11090Sstevel@tonic-gate interpret_arp(flags, (struct arphdr *)data, len); 11100Sstevel@tonic-gate break; 11110Sstevel@tonic-gate default: 11120Sstevel@tonic-gate break; 11130Sstevel@tonic-gate } 11140Sstevel@tonic-gate 11150Sstevel@tonic-gate } 11160Sstevel@tonic-gate 11170Sstevel@tonic-gate return (elen); 11180Sstevel@tonic-gate } 11190Sstevel@tonic-gate 11200Sstevel@tonic-gate uint_t 1121*410Skcpoon fddi_header_len(char *e) 11220Sstevel@tonic-gate { 11230Sstevel@tonic-gate struct fddi_header fhdr, *f = &fhdr; 11240Sstevel@tonic-gate 11250Sstevel@tonic-gate (void) memcpy(&f->fc, e, sizeof (f->fc)); 11260Sstevel@tonic-gate (void) memcpy(&f->dhost, e+1, sizeof (struct ether_addr)); 11270Sstevel@tonic-gate (void) memcpy(&f->shost, e+7, sizeof (struct ether_addr)); 11280Sstevel@tonic-gate 11290Sstevel@tonic-gate if ((f->fc&0x50) == 0x50) { 11300Sstevel@tonic-gate (void) memcpy(&f->dsap, e+13, sizeof (f->dsap)); 11310Sstevel@tonic-gate (void) memcpy(&f->ssap, e+14, sizeof (f->ssap)); 11320Sstevel@tonic-gate (void) memcpy(&f->ctl, e+15, sizeof (f->ctl)); 11330Sstevel@tonic-gate if (f->dsap == 0xaa && f->ssap == 0xaa) { 11340Sstevel@tonic-gate return (21); 11350Sstevel@tonic-gate } 11360Sstevel@tonic-gate return (16); 11370Sstevel@tonic-gate } else { 11380Sstevel@tonic-gate if ((f->fc&0x41) == 0x41 || (f->fc&0x4f) == 0x4f) { 11390Sstevel@tonic-gate return (13); 11400Sstevel@tonic-gate } 11410Sstevel@tonic-gate } 1142*410Skcpoon /* Return the default FDDI header length. */ 1143*410Skcpoon return (13); 11440Sstevel@tonic-gate } 11450Sstevel@tonic-gate 11460Sstevel@tonic-gate /* 11470Sstevel@tonic-gate * Print the given Ethernet address 11480Sstevel@tonic-gate */ 11490Sstevel@tonic-gate char * 11500Sstevel@tonic-gate printether(p) 11510Sstevel@tonic-gate struct ether_addr *p; 11520Sstevel@tonic-gate { 11530Sstevel@tonic-gate static char buf[256]; 11540Sstevel@tonic-gate 11550Sstevel@tonic-gate sprintf(buf, "%x:%x:%x:%x:%x:%x", 11560Sstevel@tonic-gate p->ether_addr_octet[0], 11570Sstevel@tonic-gate p->ether_addr_octet[1], 11580Sstevel@tonic-gate p->ether_addr_octet[2], 11590Sstevel@tonic-gate p->ether_addr_octet[3], 11600Sstevel@tonic-gate p->ether_addr_octet[4], 11610Sstevel@tonic-gate p->ether_addr_octet[5]); 11620Sstevel@tonic-gate 11630Sstevel@tonic-gate return (buf); 11640Sstevel@tonic-gate } 11650Sstevel@tonic-gate 11660Sstevel@tonic-gate /* 11670Sstevel@tonic-gate * Table of Ethernet Address Assignments 11680Sstevel@tonic-gate * Some of the more popular entries 11690Sstevel@tonic-gate * are at the beginning of the table 11700Sstevel@tonic-gate * to reduce search time. Note that the 11710Sstevel@tonic-gate * e-block's are stored in host byte-order. 11720Sstevel@tonic-gate */ 11730Sstevel@tonic-gate struct block_type { 11740Sstevel@tonic-gate int e_block; 11750Sstevel@tonic-gate char *e_name; 11760Sstevel@tonic-gate } ether_block [] = { 11770Sstevel@tonic-gate 0x080020, "Sun", 11780Sstevel@tonic-gate 0x0000C6, "HP", 11790Sstevel@tonic-gate 0x08002B, "DEC", 11800Sstevel@tonic-gate 0x00000F, "NeXT", 11810Sstevel@tonic-gate 0x00000C, "Cisco", 11820Sstevel@tonic-gate 0x080069, "Silicon Graphics", 11830Sstevel@tonic-gate 0x000069, "Silicon Graphics", 11840Sstevel@tonic-gate 0x0000A7, "Network Computing Devices (NCD X-terminal)", 11850Sstevel@tonic-gate 0x08005A, "IBM", 11860Sstevel@tonic-gate 0x0000AC, "Apollo", 11870Sstevel@tonic-gate /* end of popular entries */ 11880Sstevel@tonic-gate 0x000002, "BBN", 11890Sstevel@tonic-gate 0x000010, "Sytek", 11900Sstevel@tonic-gate 0x000011, "Tektronix", 11910Sstevel@tonic-gate 0x000018, "Webster (?)", 11920Sstevel@tonic-gate 0x00001B, "Novell", 11930Sstevel@tonic-gate 0x00001D, "Cabletron", 11940Sstevel@tonic-gate 0x000020, "DIAB (Data Industrier AB)", 11950Sstevel@tonic-gate 0x000021, "SC&C", 11960Sstevel@tonic-gate 0x000022, "Visual Technology", 11970Sstevel@tonic-gate 0x000029, "IMC", 11980Sstevel@tonic-gate 0x00002A, "TRW", 11990Sstevel@tonic-gate 0x00003D, "AT&T", 12000Sstevel@tonic-gate 0x000049, "Apricot Ltd.", 12010Sstevel@tonic-gate 0x000055, "AT&T", 12020Sstevel@tonic-gate 0x00005A, "S & Koch", 12030Sstevel@tonic-gate 0x00005A, "Xerox 806 (unregistered)", 12040Sstevel@tonic-gate 0x00005E, "U.S. Department of Defense (IANA)", 12050Sstevel@tonic-gate 0x000065, "Network General", 12060Sstevel@tonic-gate 0x00006B, "MIPS", 12070Sstevel@tonic-gate 0x000077, "MIPS", 12080Sstevel@tonic-gate 0x000079, "NetWare (?)", 12090Sstevel@tonic-gate 0x00007A, "Ardent", 12100Sstevel@tonic-gate 0x00007B, "Research Machines", 12110Sstevel@tonic-gate 0x00007D, "Harris (3M) (old)", 12120Sstevel@tonic-gate 0x000080, "Imagen(?)", 12130Sstevel@tonic-gate 0x000081, "Synoptics", 12140Sstevel@tonic-gate 0x000084, "Aquila (?)", 12150Sstevel@tonic-gate 0x000086, "Gateway (?)", 12160Sstevel@tonic-gate 0x000089, "Cayman Systems Gatorbox", 12170Sstevel@tonic-gate 0x000093, "Proteon", 12180Sstevel@tonic-gate 0x000094, "Asante", 12190Sstevel@tonic-gate 0x000098, "Cross Com", 12200Sstevel@tonic-gate 0x00009F, "Ameristar Technology", 12210Sstevel@tonic-gate 0x0000A2, "Wellfleet", 12220Sstevel@tonic-gate 0x0000A3, "Network Application Technology", 12230Sstevel@tonic-gate 0x0000A4, "Acorn", 12240Sstevel@tonic-gate 0x0000A6, "Network General", 12250Sstevel@tonic-gate 0x0000A7, "Network Computing Devices (NCD X-terminal)", 12260Sstevel@tonic-gate 0x0000A9, "Network Systems", 12270Sstevel@tonic-gate 0x0000AA, "Xerox", 12280Sstevel@tonic-gate 0x0000B3, "CIMLinc", 12290Sstevel@tonic-gate 0x0000B5, "Datability Terminal Server", 12300Sstevel@tonic-gate 0x0000B7, "Dove Fastnet", 12310Sstevel@tonic-gate 0x0000BC, "Allen-Bradley", 12320Sstevel@tonic-gate 0x0000C0, "Western Digital", 12330Sstevel@tonic-gate 0x0000C8, "Altos", 12340Sstevel@tonic-gate 0x0000C9, "Emulex Terminal Server", 12350Sstevel@tonic-gate 0x0000D0, "Develcon Electronics, Ltd.", 12360Sstevel@tonic-gate 0x0000D1, "Adaptec Inc. Nodem product", 12370Sstevel@tonic-gate 0x0000D7, "Dartmouth College (NED Router)", 12380Sstevel@tonic-gate 0x0000DD, "Gould", 12390Sstevel@tonic-gate 0x0000DE, "Unigraph", 12400Sstevel@tonic-gate 0x0000E2, "Acer Counterpoint", 12410Sstevel@tonic-gate 0x0000E8, "Accton Technology Corporation", 12420Sstevel@tonic-gate 0x0000EE, "Network Designers Limited(?)", 12430Sstevel@tonic-gate 0x0000EF, "Alantec", 12440Sstevel@tonic-gate 0x0000F3, "Gandalf", 12450Sstevel@tonic-gate 0x0000FD, "High Level Hardware (Orion, UK)", 12460Sstevel@tonic-gate 0x000143, "IEEE 802", 12470Sstevel@tonic-gate 0x001700, "Kabel", 12480Sstevel@tonic-gate 0x004010, "Sonic", 12490Sstevel@tonic-gate 0x00608C, "3Com", 12500Sstevel@tonic-gate 0x00800F, "SMC", 12510Sstevel@tonic-gate 0x008019, "Dayna Communications Etherprint product", 12520Sstevel@tonic-gate 0x00802D, "Xylogics, Inc. Annex terminal servers", 12530Sstevel@tonic-gate 0x008035, "Technology Works", 12540Sstevel@tonic-gate 0x008087, "Okidata", 12550Sstevel@tonic-gate 0x00808C, "Frontier Software Development", 12560Sstevel@tonic-gate 0x0080C7, "Xircom Inc.", 12570Sstevel@tonic-gate 0x0080D0, "Computer Products International", 12580Sstevel@tonic-gate 0x0080D3, "Shiva Appletalk-Ethernet interface", 12590Sstevel@tonic-gate 0x0080D4, "Chase Limited", 12600Sstevel@tonic-gate 0x0080F1, "Opus", 12610Sstevel@tonic-gate 0x00AA00, "Intel", 12620Sstevel@tonic-gate 0x00B0D0, "Computer Products International", 12630Sstevel@tonic-gate 0x00DD00, "Ungermann-Bass", 12640Sstevel@tonic-gate 0x00DD01, "Ungermann-Bass", 12650Sstevel@tonic-gate 0x00EFE5, "IBM (3Com card)", 12660Sstevel@tonic-gate 0x020406, "BBN", 12670Sstevel@tonic-gate 0x026060, "3Com", 12680Sstevel@tonic-gate 0x026086, "Satelcom MegaPac (UK)", 12690Sstevel@tonic-gate 0x02E6D3, "Bus-Tech, Inc. (BTI)", 12700Sstevel@tonic-gate 0x080001, "Computer Vision", 12710Sstevel@tonic-gate 0x080002, "3Com (Formerly Bridge)", 12720Sstevel@tonic-gate 0x080003, "ACC (Advanced Computer Communications)", 12730Sstevel@tonic-gate 0x080005, "Symbolics", 12740Sstevel@tonic-gate 0x080007, "Apple", 12750Sstevel@tonic-gate 0x080008, "BBN", 12760Sstevel@tonic-gate 0x080009, "Hewlett-Packard", 12770Sstevel@tonic-gate 0x08000A, "Nestar Systems", 12780Sstevel@tonic-gate 0x08000B, "Unisys", 12790Sstevel@tonic-gate 0x08000D, "ICL", 12800Sstevel@tonic-gate 0x08000E, "NCR", 12810Sstevel@tonic-gate 0x080010, "AT&T", 12820Sstevel@tonic-gate 0x080011, "Tektronix, Inc.", 12830Sstevel@tonic-gate 0x080017, "NSC", 12840Sstevel@tonic-gate 0x08001A, "Data General", 12850Sstevel@tonic-gate 0x08001B, "Data General", 12860Sstevel@tonic-gate 0x08001E, "Apollo", 12870Sstevel@tonic-gate 0x080022, "NBI", 12880Sstevel@tonic-gate 0x080025, "CDC", 12890Sstevel@tonic-gate 0x080026, "Norsk Data (Nord)", 12900Sstevel@tonic-gate 0x080027, "PCS Computer Systems GmbH", 12910Sstevel@tonic-gate 0x080028, "TI Explorer", 12920Sstevel@tonic-gate 0x08002E, "Metaphor", 12930Sstevel@tonic-gate 0x08002F, "Prime Computer", 12940Sstevel@tonic-gate 0x080036, "Intergraph CAE stations", 12950Sstevel@tonic-gate 0x080037, "Fujitsu-Xerox", 12960Sstevel@tonic-gate 0x080038, "Bull", 12970Sstevel@tonic-gate 0x080039, "Spider Systems", 12980Sstevel@tonic-gate 0x08003B, "Torus Systems", 12990Sstevel@tonic-gate 0x08003E, "Motorola VME bus processor module", 13000Sstevel@tonic-gate 0x080041, "DCA Digital Comm. Assoc.", 13010Sstevel@tonic-gate 0x080046, "Sony", 13020Sstevel@tonic-gate 0x080047, "Sequent", 13030Sstevel@tonic-gate 0x080049, "Univation", 13040Sstevel@tonic-gate 0x08004C, "Encore", 13050Sstevel@tonic-gate 0x08004E, "BICC", 13060Sstevel@tonic-gate 0x080056, "Stanford University", 13070Sstevel@tonic-gate 0x080057, "Evans & Sutherland (?)", 13080Sstevel@tonic-gate 0x080067, "Comdesign", 13090Sstevel@tonic-gate 0x080068, "Ridge", 13100Sstevel@tonic-gate 0x08006A, "ATTst (?)", 13110Sstevel@tonic-gate 0x08006E, "Excelan", 13120Sstevel@tonic-gate 0x080075, "DDE (Danish Data Elektronik A/S)", 13130Sstevel@tonic-gate 0x080077, "TSL (now Retix)", 13140Sstevel@tonic-gate 0x08007C, "Vitalink TransLAN III", 13150Sstevel@tonic-gate 0x080080, "XIOS", 13160Sstevel@tonic-gate 0x080081, "Crosfield Electronics", 13170Sstevel@tonic-gate 0x080086, "Imagen/QMS", 13180Sstevel@tonic-gate 0x080087, "Xyplex terminal server", 13190Sstevel@tonic-gate 0x080089, "Kinetics AppleTalk-Ethernet interface", 13200Sstevel@tonic-gate 0x08008B, "Pyramid", 13210Sstevel@tonic-gate 0x08008D, "XyVision", 13220Sstevel@tonic-gate 0x080090, "Retix Inc Bridge", 13230Sstevel@tonic-gate 0x10005A, "IBM", 13240Sstevel@tonic-gate 0x1000D4, "DEC", 13250Sstevel@tonic-gate 0x400003, "NetWare", 13260Sstevel@tonic-gate 0x800010, "AT&T", 13270Sstevel@tonic-gate 0xAA0004, "DEC (DECNET)", 13280Sstevel@tonic-gate 0xC00000, "SMC", 13290Sstevel@tonic-gate 0, "", 13300Sstevel@tonic-gate }; 13310Sstevel@tonic-gate 13320Sstevel@tonic-gate /* 13330Sstevel@tonic-gate * The oui argument should be in host byte-order to conform with 13340Sstevel@tonic-gate * the above array's values. 13350Sstevel@tonic-gate */ 13360Sstevel@tonic-gate char * 13370Sstevel@tonic-gate ether_ouiname(uint32_t oui) 13380Sstevel@tonic-gate { 13390Sstevel@tonic-gate uint_t i; 13400Sstevel@tonic-gate 13410Sstevel@tonic-gate for (i = 0; ether_block[i].e_block != 0; i++) 13420Sstevel@tonic-gate if (oui == ether_block[i].e_block) 13430Sstevel@tonic-gate return (ether_block[i].e_name); 13440Sstevel@tonic-gate 13450Sstevel@tonic-gate return (NULL); 13460Sstevel@tonic-gate } 13470Sstevel@tonic-gate 13480Sstevel@tonic-gate /* 13490Sstevel@tonic-gate * Print the additional Ethernet address info 13500Sstevel@tonic-gate */ 13510Sstevel@tonic-gate static char * 13520Sstevel@tonic-gate print_etherinfo(eaddr) 13530Sstevel@tonic-gate struct ether_addr *eaddr; 13540Sstevel@tonic-gate { 13550Sstevel@tonic-gate uint_t addr = 0; 13560Sstevel@tonic-gate char *p = (char *)&addr + 1; 13570Sstevel@tonic-gate char *ename; 13580Sstevel@tonic-gate 13590Sstevel@tonic-gate (void) memcpy(p, eaddr, 3); 13600Sstevel@tonic-gate 13610Sstevel@tonic-gate if (memcmp(eaddr, ðer_broadcast, sizeof (struct ether_addr)) == 0) 13620Sstevel@tonic-gate return ("(broadcast)"); 13630Sstevel@tonic-gate 13640Sstevel@tonic-gate if (eaddr->ether_addr_octet[0] & 1) 13650Sstevel@tonic-gate return ("(multicast)"); 13660Sstevel@tonic-gate 13670Sstevel@tonic-gate addr = ntohl(addr); /* make it right for little-endians */ 13680Sstevel@tonic-gate ename = ether_ouiname(addr); 13690Sstevel@tonic-gate 13700Sstevel@tonic-gate if (ename != NULL) 13710Sstevel@tonic-gate return (ename); 13720Sstevel@tonic-gate else 13730Sstevel@tonic-gate return (""); 13740Sstevel@tonic-gate } 13750Sstevel@tonic-gate 13760Sstevel@tonic-gate static uchar_t endianswap[] = { 13770Sstevel@tonic-gate 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 13780Sstevel@tonic-gate 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 13790Sstevel@tonic-gate 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 13800Sstevel@tonic-gate 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 13810Sstevel@tonic-gate 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 13820Sstevel@tonic-gate 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 13830Sstevel@tonic-gate 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 13840Sstevel@tonic-gate 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 13850Sstevel@tonic-gate 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 13860Sstevel@tonic-gate 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 13870Sstevel@tonic-gate 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 13880Sstevel@tonic-gate 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 13890Sstevel@tonic-gate 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 13900Sstevel@tonic-gate 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 13910Sstevel@tonic-gate 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 13920Sstevel@tonic-gate 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 13930Sstevel@tonic-gate 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 13940Sstevel@tonic-gate 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 13950Sstevel@tonic-gate 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 13960Sstevel@tonic-gate 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 13970Sstevel@tonic-gate 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 13980Sstevel@tonic-gate 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 13990Sstevel@tonic-gate 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 14000Sstevel@tonic-gate 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 14010Sstevel@tonic-gate 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 14020Sstevel@tonic-gate 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 14030Sstevel@tonic-gate 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 14040Sstevel@tonic-gate 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 14050Sstevel@tonic-gate 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 14060Sstevel@tonic-gate 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 14070Sstevel@tonic-gate 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 14080Sstevel@tonic-gate 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, 14090Sstevel@tonic-gate }; 14100Sstevel@tonic-gate 14110Sstevel@tonic-gate static void 14120Sstevel@tonic-gate addr_copy_swap(pd, ps) 14130Sstevel@tonic-gate struct ether_addr *pd; 14140Sstevel@tonic-gate struct ether_addr *ps; 14150Sstevel@tonic-gate { 14160Sstevel@tonic-gate pd->ether_addr_octet[0] = endianswap[ps->ether_addr_octet[0]]; 14170Sstevel@tonic-gate pd->ether_addr_octet[1] = endianswap[ps->ether_addr_octet[1]]; 14180Sstevel@tonic-gate pd->ether_addr_octet[2] = endianswap[ps->ether_addr_octet[2]]; 14190Sstevel@tonic-gate pd->ether_addr_octet[3] = endianswap[ps->ether_addr_octet[3]]; 14200Sstevel@tonic-gate pd->ether_addr_octet[4] = endianswap[ps->ether_addr_octet[4]]; 14210Sstevel@tonic-gate pd->ether_addr_octet[5] = endianswap[ps->ether_addr_octet[5]]; 14220Sstevel@tonic-gate } 14230Sstevel@tonic-gate 14240Sstevel@tonic-gate /* ARGSUSED */ 14250Sstevel@tonic-gate uint_t 14260Sstevel@tonic-gate ib_header_len(char *hdr) 14270Sstevel@tonic-gate { 14280Sstevel@tonic-gate return (IPOIB_HDRSIZE); 14290Sstevel@tonic-gate } 14300Sstevel@tonic-gate 14310Sstevel@tonic-gate static uint_t 14320Sstevel@tonic-gate interpret_ib(int flags, char *header, int elen, int origlen) 14330Sstevel@tonic-gate { 14340Sstevel@tonic-gate struct ipoib_header *hdr = (struct ipoib_header *)header; 14350Sstevel@tonic-gate char *off; 14360Sstevel@tonic-gate int len; 14370Sstevel@tonic-gate extern char *dst_name; 14380Sstevel@tonic-gate unsigned short ethertype; 14390Sstevel@tonic-gate int blen = MAX(origlen, 4096); 14400Sstevel@tonic-gate 14410Sstevel@tonic-gate if (data != NULL && datalen != 0 && datalen < blen) { 14420Sstevel@tonic-gate free(data); 14430Sstevel@tonic-gate data = NULL; 14440Sstevel@tonic-gate datalen = 0; 14450Sstevel@tonic-gate } 14460Sstevel@tonic-gate if (data == NULL) { 14470Sstevel@tonic-gate data = malloc(blen); 14480Sstevel@tonic-gate if (data == NULL) 14490Sstevel@tonic-gate pr_err("Warning: malloc failure"); 14500Sstevel@tonic-gate datalen = blen; 14510Sstevel@tonic-gate } 14520Sstevel@tonic-gate if (origlen < IPOIB_HDRSIZE) { 14530Sstevel@tonic-gate if (flags & F_SUM) 14540Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE, 14550Sstevel@tonic-gate "RUNT (short packet - %d bytes)", origlen); 14560Sstevel@tonic-gate if (flags & F_DTAIL) 14570Sstevel@tonic-gate show_header("RUNT: ", "Short packet", origlen); 14580Sstevel@tonic-gate return (elen); 14590Sstevel@tonic-gate } 14600Sstevel@tonic-gate if (elen < IPOIB_HDRSIZE) 14610Sstevel@tonic-gate return (elen); 14620Sstevel@tonic-gate 14630Sstevel@tonic-gate /* 14640Sstevel@tonic-gate * It is not possible to understand just by looking 14650Sstevel@tonic-gate * at the header whether this was a broad/multi cast 14660Sstevel@tonic-gate * packet; thus dst_name is not updated. 14670Sstevel@tonic-gate */ 14680Sstevel@tonic-gate ethertype = ntohs(hdr->ipoib_type); 14690Sstevel@tonic-gate len = elen - IPOIB_HDRSIZE; 14700Sstevel@tonic-gate off = (char *)(hdr + 1); 14710Sstevel@tonic-gate (void) memcpy(data, off, len); 14720Sstevel@tonic-gate 14730Sstevel@tonic-gate if (flags & F_SUM) { 14740Sstevel@tonic-gate (void) snprintf(get_sum_line(), MAXLINE, 14750Sstevel@tonic-gate "IPIB Type=%04X (%s), size = %d bytes", 14760Sstevel@tonic-gate ethertype, 14770Sstevel@tonic-gate print_ethertype(ethertype), 14780Sstevel@tonic-gate origlen); 14790Sstevel@tonic-gate } 14800Sstevel@tonic-gate 14810Sstevel@tonic-gate if (flags & F_DTAIL) { 14820Sstevel@tonic-gate show_header("IPIB: ", "IPIB Header", elen); 14830Sstevel@tonic-gate show_space(); 14840Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(), 14850Sstevel@tonic-gate "Packet %d arrived at %d:%02d:%d.%02d", 14860Sstevel@tonic-gate pi_frame, pi_time_hour, pi_time_min, 14870Sstevel@tonic-gate pi_time_sec, pi_time_usec / 10000); 14880Sstevel@tonic-gate (void) snprintf(get_line(0, 0), get_line_remain(), 14890Sstevel@tonic-gate "Packet size = %d bytes", elen, elen); 14900Sstevel@tonic-gate (void) snprintf(get_line(0, 2), get_line_remain(), 14910Sstevel@tonic-gate "Ethertype = %04X (%s)", ethertype, 14920Sstevel@tonic-gate print_ethertype(ethertype)); 14930Sstevel@tonic-gate show_space(); 14940Sstevel@tonic-gate } 14950Sstevel@tonic-gate 14960Sstevel@tonic-gate /* Go to the next protocol layer */ 14970Sstevel@tonic-gate switch (ethertype) { 14980Sstevel@tonic-gate case ETHERTYPE_IP: 14990Sstevel@tonic-gate (void) interpret_ip(flags, (struct ip *)data, len); 15000Sstevel@tonic-gate break; 15010Sstevel@tonic-gate case ETHERTYPE_IPV6: 15020Sstevel@tonic-gate (void) interpret_ipv6(flags, (ip6_t *)data, len); 15030Sstevel@tonic-gate break; 15040Sstevel@tonic-gate case ETHERTYPE_ARP: 15050Sstevel@tonic-gate case ETHERTYPE_REVARP: 15060Sstevel@tonic-gate interpret_arp(flags, (struct arphdr *)data, len); 15070Sstevel@tonic-gate break; 15080Sstevel@tonic-gate } 15090Sstevel@tonic-gate 15100Sstevel@tonic-gate return (elen); 15110Sstevel@tonic-gate } 1512