xref: /titanic_44/usr/src/uts/common/inet/arp.h (revision 69bb4bb45c98da60d21839c4dc3c01ea1be60585)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*69bb4bb4Scarlsonj  * Common Development and Distribution License (the "License").
6*69bb4bb4Scarlsonj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*69bb4bb4Scarlsonj  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_INET_ARP_H
287c478bd9Sstevel@tonic-gate #define	_INET_ARP_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
32*69bb4bb4Scarlsonj #include <sys/types.h>
33*69bb4bb4Scarlsonj 
347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
38*69bb4bb4Scarlsonj /*
39*69bb4bb4Scarlsonj  * Warning: the interfaces described in this file are private to the
40*69bb4bb4Scarlsonj  * implementation.  They may change at any time without notice and are not
41*69bb4bb4Scarlsonj  * documented.  Do not depend on them.
42*69bb4bb4Scarlsonj  */
43*69bb4bb4Scarlsonj 
447c478bd9Sstevel@tonic-gate #define	ARP_REQUEST	1
457c478bd9Sstevel@tonic-gate #define	ARP_RESPONSE	2
467c478bd9Sstevel@tonic-gate #define	RARP_REQUEST	3
477c478bd9Sstevel@tonic-gate #define	RARP_RESPONSE	4
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #define	AR_IOCTL		(((unsigned)'A' & 0xFF)<<8)
507c478bd9Sstevel@tonic-gate #define	CMD_IN_PROGRESS		0x10000
51*69bb4bb4Scarlsonj 
527c478bd9Sstevel@tonic-gate #define	AR_ENTRY_ADD		(AR_IOCTL + 1)
537c478bd9Sstevel@tonic-gate #define	AR_ENTRY_DELETE		(AR_IOCTL + 2)
547c478bd9Sstevel@tonic-gate #define	AR_ENTRY_QUERY		(AR_IOCTL + 3)
557c478bd9Sstevel@tonic-gate #define	AR_ENTRY_SQUERY		(AR_IOCTL + 6)
567c478bd9Sstevel@tonic-gate #define	AR_MAPPING_ADD		(AR_IOCTL + 7)
577c478bd9Sstevel@tonic-gate #define	AR_CLIENT_NOTIFY	(AR_IOCTL + 8)
587c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_UP		(AR_IOCTL + 9)
597c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_DOWN	(AR_IOCTL + 10)
607c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_ON		(AR_IOCTL + 12)
617c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_OFF	(AR_IOCTL + 13)
627c478bd9Sstevel@tonic-gate #define	AR_DLPIOP_DONE		(AR_IOCTL + 14)
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * This is not an ARP command per se, it is used to interface between
657c478bd9Sstevel@tonic-gate  * ARP and IP during close.
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate #define	AR_ARP_CLOSING		(AR_IOCTL + 16)
68*69bb4bb4Scarlsonj #define	AR_ARP_EXTEND		(AR_IOCTL + 17)
697c478bd9Sstevel@tonic-gate 
70*69bb4bb4Scarlsonj /* Both ace_flags and area_flags; must also modify arp.c in mdb */
71*69bb4bb4Scarlsonj #define	ACE_F_PERMANENT		0x0001
72*69bb4bb4Scarlsonj #define	ACE_F_PUBLISH		0x0002
73*69bb4bb4Scarlsonj #define	ACE_F_DYING		0x0004
74*69bb4bb4Scarlsonj #define	ACE_F_RESOLVED		0x0008
757c478bd9Sstevel@tonic-gate /* Using bit mask extraction from target address */
76*69bb4bb4Scarlsonj #define	ACE_F_MAPPING		0x0010
77*69bb4bb4Scarlsonj #define	ACE_F_MYADDR		0x0020	/* IP claims to own this address */
78*69bb4bb4Scarlsonj #define	ACE_F_UNVERIFIED	0x0040	/* DAD not yet complete */
79*69bb4bb4Scarlsonj #define	ACE_F_AUTHORITY		0x0080	/* check for duplicate MACs */
80*69bb4bb4Scarlsonj #define	ACE_F_DEFEND		0x0100	/* single transmit (area_flags only) */
81*69bb4bb4Scarlsonj #define	ACE_F_OLD		0x0200	/* should revalidate when IP asks */
82*69bb4bb4Scarlsonj #define	ACE_F_FAST		0x0400	/* fast probe enabled */
83*69bb4bb4Scarlsonj #define	ACE_F_DELAYED		0x0800	/* rescheduled on arp_defend_rate */
84*69bb4bb4Scarlsonj #define	ACE_F_DAD_ABORTED	0x1000	/* DAD was aborted on link down */
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /* ARP Command Structures */
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /* arc_t - Common command overlay */
897c478bd9Sstevel@tonic-gate typedef struct ar_cmd_s {
907c478bd9Sstevel@tonic-gate 	uint32_t	arc_cmd;
917c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_offset;
927c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_length;
937c478bd9Sstevel@tonic-gate } arc_t;
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  * NOTE: when using area_t for an AR_ENTRY_SQUERY, the area_hw_addr_offset
977c478bd9Sstevel@tonic-gate  * field isn't what you might think. See comments in ip_multi.c where
987c478bd9Sstevel@tonic-gate  * the routine ill_create_squery() is called, and also in the routine
997c478bd9Sstevel@tonic-gate  * itself, to see how this field is used *only* when the area_t holds
1007c478bd9Sstevel@tonic-gate  * an AR_ENTRY_SQUERY.
1017c478bd9Sstevel@tonic-gate  */
1027c478bd9Sstevel@tonic-gate typedef	struct ar_entry_add_s {
1037c478bd9Sstevel@tonic-gate 	uint32_t	area_cmd;
1047c478bd9Sstevel@tonic-gate 	uint32_t	area_name_offset;
1057c478bd9Sstevel@tonic-gate 	uint32_t	area_name_length;
1067c478bd9Sstevel@tonic-gate 	uint32_t	area_proto;
1077c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_offset;
1087c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_length;
1097c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_mask_offset;
1107c478bd9Sstevel@tonic-gate 	uint32_t	area_flags;		/* Same values as ace_flags */
1117c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_offset;
1127c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_length;
1137c478bd9Sstevel@tonic-gate } area_t;
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate typedef	struct ar_entry_delete_s {
1167c478bd9Sstevel@tonic-gate 	uint32_t	ared_cmd;
1177c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_offset;
1187c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_length;
1197c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto;
1207c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_offset;
1217c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_length;
1227c478bd9Sstevel@tonic-gate } ared_t;
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate typedef	struct ar_entry_query_s {
1257c478bd9Sstevel@tonic-gate 	uint32_t	areq_cmd;
1267c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_offset;
1277c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_length;
1287c478bd9Sstevel@tonic-gate 	uint32_t	areq_proto;
1297c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_offset;
1307c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_length;
1317c478bd9Sstevel@tonic-gate 	uint32_t	areq_flags;
1327c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_offset;
1337c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_length;
1347c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_count;	/* 0 ==> cache lookup only */
1357c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_interval; /* # of milliseconds; 0: default */
1367c478bd9Sstevel@tonic-gate 		/* # ofquests to buffer; 0: default */
1377c478bd9Sstevel@tonic-gate 	uint32_t	areq_max_buffered;
1387c478bd9Sstevel@tonic-gate 	uchar_t	areq_sap[8];		/* to insert in returned template */
1397c478bd9Sstevel@tonic-gate } areq_t;
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * Structure used with AR_ENTRY_LLAQUERY to map from the link_addr
1437c478bd9Sstevel@tonic-gate  * (in Neighbor Discovery option format excluding the option type and
1447c478bd9Sstevel@tonic-gate  * length) to a hardware address.
1457c478bd9Sstevel@tonic-gate  * The response has the same format as for an AR_ENTRY_SQUERY - an M_CTL with
1467c478bd9Sstevel@tonic-gate  * arel_hw_addr updated.
1477c478bd9Sstevel@tonic-gate  * An IPv6 address will be passed in AR_ENTRY_LLAQUERY so that atmip
1487c478bd9Sstevel@tonic-gate  * can send it in AR_CLIENT_NOTIFY messages.
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate typedef	struct ar_entry_llaquery_s {
1517c478bd9Sstevel@tonic-gate 	uint32_t	arel_cmd;
1527c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_offset;
1537c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_length;
1547c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_offset;
1557c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_length;
1567c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_offset;
1577c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_length;
1587c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_offset;
1597c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_length;
1607c478bd9Sstevel@tonic-gate } arel_t;
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate typedef	struct ar_mapping_add_s {
1637c478bd9Sstevel@tonic-gate 	uint32_t	arma_cmd;
1647c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_offset;
1657c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_length;
1667c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto;
1677c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_offset;
1687c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_length;
1697c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_mask_offset;
1707c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_extract_mask_offset;
1717c478bd9Sstevel@tonic-gate 	uint32_t	arma_flags;
1727c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_offset;
1737c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_length;
1747c478bd9Sstevel@tonic-gate 		/* Offset were we start placing */
1757c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_mapping_start;
1767c478bd9Sstevel@tonic-gate 					/* the mask&proto_addr */
1777c478bd9Sstevel@tonic-gate } arma_t;
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /* Structure used to notify clients of interesting conditions. */
1807c478bd9Sstevel@tonic-gate typedef struct ar_client_notify_s {
1817c478bd9Sstevel@tonic-gate 	uint32_t	arcn_cmd;
1827c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_offset;
1837c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_length;
1847c478bd9Sstevel@tonic-gate 	uint32_t	arcn_code;			/* Notification code. */
1857c478bd9Sstevel@tonic-gate } arcn_t;
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate /* Client Notification Codes */
1887c478bd9Sstevel@tonic-gate #define	AR_CN_BOGON	1
1897c478bd9Sstevel@tonic-gate #define	AR_CN_ANNOUNCE	2
190*69bb4bb4Scarlsonj #define	AR_CN_READY	3		/* DAD complete; address usable */
191*69bb4bb4Scarlsonj #define	AR_CN_FAILED	4		/* DAD failed; address unusable */
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate /* ARP Header */
1947c478bd9Sstevel@tonic-gate typedef struct arh_s {
1957c478bd9Sstevel@tonic-gate 	uchar_t	arh_hardware[2];
1967c478bd9Sstevel@tonic-gate 	uchar_t	arh_proto[2];
1977c478bd9Sstevel@tonic-gate 	uchar_t	arh_hlen;
1987c478bd9Sstevel@tonic-gate 	uchar_t	arh_plen;
1997c478bd9Sstevel@tonic-gate 	uchar_t	arh_operation[2];
2007c478bd9Sstevel@tonic-gate 	/* The sender and target hw/proto pairs follow */
2017c478bd9Sstevel@tonic-gate } arh_t;
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2047c478bd9Sstevel@tonic-gate }
2057c478bd9Sstevel@tonic-gate #endif
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate #endif	/* _INET_ARP_H */
208