/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
* 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
* written permission.
* 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.
*/
/*
* ATM Address Resolution Protocol.
*
* See RFC 2225 for protocol description. ATMARP packets are similar
* to ARP packets, except that there are no length fields for the
* protocol address - instead, there are type/length fields for
* the ATM number and subaddress - and the hardware addresses consist
* of an ATM number and an ATM subaddress.
*/
struct atmarp_pkthdr {
nd_uint16_t aar_hrd; /* format of hardware address */
nd_uint16_t aar_pro; /* format of protocol address */
nd_uint8_t aar_shtl; /* length of source ATM number */
nd_uint8_t aar_sstl; /* length of source ATM subaddress */
#define ATMARP_IS_E164 0x40 /* bit in type/length for E.164 format */
#define ATMARP_LEN_MASK 0x3F /* length of {sub}address in type/length */
nd_uint16_t aar_op; /* same as regular ARP */
nd_uint8_t aar_spln; /* length of source protocol address */
nd_uint8_t aar_thtl; /* length of target ATM number */
nd_uint8_t aar_tstl; /* length of target ATM subaddress */
nd_uint8_t aar_tpln; /* length of target protocol address */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
nd_byte aar_sha[]; /* source ATM number */
nd_byte aar_ssa[]; /* source ATM subaddress */
nd_byte aar_spa[]; /* sender protocol address */
nd_byte aar_tha[]; /* target ATM number */
nd_byte aar_tsa[]; /* target ATM subaddress */
nd_byte aar_tpa[]; /* target protocol address */
#endif
ndo->ndo_protocol = "arp";
ap = (const struct arp_pkthdr *)bp;
ND_TCHECK_SIZE(ap);
hrd = HRD(ap);
pro = PRO(ap);
op = OP(ap);
/* if its ATM then call the ATM ARP printer
for Frame-relay ARP most of the fields
are similar to Ethernet so overload the Ethernet Printer
and set the linkaddr type for GET_LINKADDR_STRING() accordingly */
case ARPOP_REVREQUEST:
/*
* XXX - GET_LINKADDR_STRING() may return a pointer to
* a static buffer, so we only have one call to it per
* ND_PRINT() call.
*
* This should be done in a cleaner fashion.
*/
ND_PRINT("who-is %s",
GET_LINKADDR_STRING(THA(ap), linkaddr, HRD_LEN(ap)));
ND_PRINT(" tell %s",
GET_LINKADDR_STRING(SHA(ap), linkaddr, HRD_LEN(ap)));
break;
case ARPOP_REVREPLY:
ND_PRINT("%s at ",
GET_LINKADDR_STRING(THA(ap), linkaddr, HRD_LEN(ap)));
tpaddr_print_ip(ndo, ap, pro);
break;
case ARPOP_INVREQUEST:
/*
* XXX - GET_LINKADDR_STRING() may return a pointer to
* a static buffer, so we only have one call to it per
* ND_PRINT() call.
*
* This should be done in a cleaner fashion.
*/
ND_PRINT("who-is %s",
GET_LINKADDR_STRING(THA(ap), linkaddr, HRD_LEN(ap)));
ND_PRINT(" tell %s",
GET_LINKADDR_STRING(SHA(ap), linkaddr, HRD_LEN(ap)));
break;
case ARPOP_INVREPLY:
ND_PRINT("%s at ",
GET_LINKADDR_STRING(SHA(ap), linkaddr, HRD_LEN(ap)));
spaddr_print_ip(ndo, ap, pro);
break;