* Copyright (c) 1988-1990 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"@(#) $Header: print-arp.c,v 1.16 91/04/19 10:45:56 mccanne Exp $ (LBL)";
#include <netinet/if_ether.h>
arp_print(ap
, length
, caplen
)
register struct ether_arp
*ap
;
if ((u_char
*)(ap
+ 1) > snapend
) {
if (length
< sizeof(struct ether_arp
)) {
(void)printf("truncated-arp");
default_print((u_short
*)ap
, length
);
if (ap
->arp_hrd
!= ARPHRD_ETHER
|| (ap
->arp_pro
!= ETHERTYPE_IP
&& ap
->arp_pro
!= ETHERTYPE_TRAIL
)
|| ap
->arp_hln
!= sizeof(SHA(ap
))
|| ap
->arp_pln
!= sizeof(SPA(ap
))) {
(void)printf("arp-req #%d for proto #%d (%d) hardware %d (%d)",
ap
->arp_op
, ap
->arp_pro
, ap
->arp_pln
,
ap
->arp_hrd
, ap
->arp_hln
);
if (ap
->arp_pro
== ETHERTYPE_TRAIL
)
(void)printf("arp who-has %s tell %s",
(void)printf("arp reply %s is-at %s",
etheraddr_string(SHA(ap
)));
(void)printf("rarp who-is %s tell %s",
etheraddr_string(THA(ap
)),
etheraddr_string(SHA(ap
)));
(void)printf("rarp reply %s at %s",
etheraddr_string(THA(ap
)),
(void)printf("arp-%d", ap
->arp_op
);
default_print((u_short
*)ap
, caplen
);