/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <setjmp.h>
#include <netinet/in_systm.h>
#include <netinet/if_ether.h>
#include <netdb.h>
#include <net/if_types.h>
#include "snoop.h"
extern char *dlc_header;
static char *printip(unsigned char *);
static char *addrtoname_align(unsigned char *);
char *opname[] = {
"",
"ARP Request",
"ARP Reply",
"REVARP Request",
"REVARP Reply",
};
void
{
char *line;
int maclen;
/*
* Check that at least the generic ARP header was received.
*/
goto short_packet;
/*
*/
goto short_packet;
if (maclen == 0) {
} else {
pr_err("Warning: malloc failure");
}
pr_err("Warning: malloc failure");
}
}
line = get_sum_line();
switch (arpop) {
case ARPOP_REQUEST:
break;
case ARPOP_REPLY:
break;
case REVARP_REQUEST:
dmacbuf);
break;
case REVARP_REPLY:
break;
}
}
show_space();
"Opcode %d (%s)", arpop,
if (is_ip) {
"Sender's hardware address = %s", smacbuf);
"Sender's protocol address = %s",
"Target hardware address = %s",
"Target protocol address = %s",
}
show_trailer();
}
if (maclen != 0) {
}
return;
"ARP (short packet)");
show_space();
"ARP (short packet)");
}
}
char *
printip(unsigned char *p)
{
struct in_addr a;
memcpy(&a, p, 4);
return (buff);
}
char *
addrtoname_align(unsigned char *p)
{
struct in_addr a;
memcpy(&a, p, 4);
return ((char *)addrtoname(AF_INET, &a));
}
/*
* These numbers are assigned by the IANA. See the arp-parameters registry.
* Only those values that are used within Solaris have #defines.
*/
const char *
arp_htype(int t)
{
switch (t) {
case ARPHRD_ETHER:
return ("Ethernet (10Mb)");
case 2:
return ("Experimental Ethernet (3MB)");
case 3:
return ("Amateur Radio AX.25");
case 4:
return ("Proteon ProNET Token Ring");
case 5:
return ("Chaos");
case ARPHRD_IEEE802:
return ("IEEE 802");
case 7:
return ("ARCNET");
case 8:
return ("Hyperchannel");
case 9:
return ("Lanstar");
case 10:
return ("Autonet");
case 11:
return ("LocalTalk");
case 12:
return ("LocalNet");
case 13:
return ("Ultra Link");
case 14:
return ("SMDS");
case ARPHRD_FRAME:
return ("Frame Relay");
case ARPHRD_ATM:
return ("ATM");
case ARPHRD_HDLC:
return ("HDLC");
case ARPHRD_FC:
return ("Fibre Channel");
case ARPHRD_IPATM:
return ("IP-ATM");
case ARPHRD_TUNNEL:
return ("Tunnel");
case ARPHRD_IB:
return ("IPIB");
};
return ("UNKNOWN");
}