snoop_arp.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1991-2001, 2003 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 *);
static char unarp_addr[] = "Unknown";
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));
}