xref: /titanic_53/usr/src/uts/common/inet/arp.h (revision e11c3f44f531fdff80941ce57c065d2ae861cefc)
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
569bb4bb4Scarlsonj  * Common Development and Distribution License (the "License").
669bb4bb4Scarlsonj  * 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*e11c3f44Smeem  * Copyright 2009 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 
3069bb4bb4Scarlsonj #include <sys/types.h>
31*e11c3f44Smeem #include <net/if.h>
3269bb4bb4Scarlsonj 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
3769bb4bb4Scarlsonj /*
3869bb4bb4Scarlsonj  * Warning: the interfaces described in this file are private to the
3969bb4bb4Scarlsonj  * implementation.  They may change at any time without notice and are not
4069bb4bb4Scarlsonj  * documented.  Do not depend on them.
4169bb4bb4Scarlsonj  */
4269bb4bb4Scarlsonj 
437c478bd9Sstevel@tonic-gate #define	ARP_REQUEST	1
447c478bd9Sstevel@tonic-gate #define	ARP_RESPONSE	2
457c478bd9Sstevel@tonic-gate #define	RARP_REQUEST	3
467c478bd9Sstevel@tonic-gate #define	RARP_RESPONSE	4
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate #define	AR_IOCTL		(((unsigned)'A' & 0xFF)<<8)
497c478bd9Sstevel@tonic-gate #define	CMD_IN_PROGRESS		0x10000
5069bb4bb4Scarlsonj 
517c478bd9Sstevel@tonic-gate #define	AR_ENTRY_ADD		(AR_IOCTL + 1)
527c478bd9Sstevel@tonic-gate #define	AR_ENTRY_DELETE		(AR_IOCTL + 2)
537c478bd9Sstevel@tonic-gate #define	AR_ENTRY_QUERY		(AR_IOCTL + 3)
547c478bd9Sstevel@tonic-gate #define	AR_ENTRY_SQUERY		(AR_IOCTL + 6)
557c478bd9Sstevel@tonic-gate #define	AR_MAPPING_ADD		(AR_IOCTL + 7)
567c478bd9Sstevel@tonic-gate #define	AR_CLIENT_NOTIFY	(AR_IOCTL + 8)
577c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_UP		(AR_IOCTL + 9)
587c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_DOWN	(AR_IOCTL + 10)
597c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_ON		(AR_IOCTL + 12)
607c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_OFF	(AR_IOCTL + 13)
617c478bd9Sstevel@tonic-gate #define	AR_DLPIOP_DONE		(AR_IOCTL + 14)
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * This is not an ARP command per se, it is used to interface between
647c478bd9Sstevel@tonic-gate  * ARP and IP during close.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	AR_ARP_CLOSING		(AR_IOCTL + 16)
6769bb4bb4Scarlsonj #define	AR_ARP_EXTEND		(AR_IOCTL + 17)
68*e11c3f44Smeem #define	AR_IPMP_ACTIVATE	(AR_IOCTL + 18)
69*e11c3f44Smeem #define	AR_IPMP_DEACTIVATE	(AR_IOCTL + 19)
707c478bd9Sstevel@tonic-gate 
7169bb4bb4Scarlsonj /* Both ace_flags and area_flags; must also modify arp.c in mdb */
7269bb4bb4Scarlsonj #define	ACE_F_PERMANENT		0x0001
7369bb4bb4Scarlsonj #define	ACE_F_PUBLISH		0x0002
7469bb4bb4Scarlsonj #define	ACE_F_DYING		0x0004
7569bb4bb4Scarlsonj #define	ACE_F_RESOLVED		0x0008
767c478bd9Sstevel@tonic-gate /* Using bit mask extraction from target address */
7769bb4bb4Scarlsonj #define	ACE_F_MAPPING		0x0010
7869bb4bb4Scarlsonj #define	ACE_F_MYADDR		0x0020	/* IP claims to own this address */
7969bb4bb4Scarlsonj #define	ACE_F_UNVERIFIED	0x0040	/* DAD not yet complete */
8069bb4bb4Scarlsonj #define	ACE_F_AUTHORITY		0x0080	/* check for duplicate MACs */
8169bb4bb4Scarlsonj #define	ACE_F_DEFEND		0x0100	/* single transmit (area_flags only) */
8269bb4bb4Scarlsonj #define	ACE_F_OLD		0x0200	/* should revalidate when IP asks */
8369bb4bb4Scarlsonj #define	ACE_F_FAST		0x0400	/* fast probe enabled */
8469bb4bb4Scarlsonj #define	ACE_F_DELAYED		0x0800	/* rescheduled on arp_defend_rate */
8569bb4bb4Scarlsonj #define	ACE_F_DAD_ABORTED	0x1000	/* DAD was aborted on link down */
867c478bd9Sstevel@tonic-gate 
87e61a481dSZhi-Jun Robin Fu /* ared_flags */
88e61a481dSZhi-Jun Robin Fu #define	ARED_F_PRESERVE_PERM	0x0001	/* preserve permanent ace */
89e61a481dSZhi-Jun Robin Fu 
907c478bd9Sstevel@tonic-gate /* ARP Command Structures */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /* arc_t - Common command overlay */
937c478bd9Sstevel@tonic-gate typedef struct ar_cmd_s {
947c478bd9Sstevel@tonic-gate 	uint32_t	arc_cmd;
957c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_offset;
967c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_length;
977c478bd9Sstevel@tonic-gate } arc_t;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate  * NOTE: when using area_t for an AR_ENTRY_SQUERY, the area_hw_addr_offset
1017c478bd9Sstevel@tonic-gate  * field isn't what you might think. See comments in ip_multi.c where
1027c478bd9Sstevel@tonic-gate  * the routine ill_create_squery() is called, and also in the routine
1037c478bd9Sstevel@tonic-gate  * itself, to see how this field is used *only* when the area_t holds
1047c478bd9Sstevel@tonic-gate  * an AR_ENTRY_SQUERY.
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate typedef	struct ar_entry_add_s {
1077c478bd9Sstevel@tonic-gate 	uint32_t	area_cmd;
1087c478bd9Sstevel@tonic-gate 	uint32_t	area_name_offset;
1097c478bd9Sstevel@tonic-gate 	uint32_t	area_name_length;
1107c478bd9Sstevel@tonic-gate 	uint32_t	area_proto;
1117c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_offset;
1127c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_length;
1137c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_mask_offset;
1147c478bd9Sstevel@tonic-gate 	uint32_t	area_flags;		/* Same values as ace_flags */
1157c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_offset;
1167c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_length;
1177c478bd9Sstevel@tonic-gate } area_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate typedef	struct ar_entry_delete_s {
1207c478bd9Sstevel@tonic-gate 	uint32_t	ared_cmd;
1217c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_offset;
1227c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_length;
1237c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto;
1247c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_offset;
1257c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_length;
126e61a481dSZhi-Jun Robin Fu 	uint32_t	ared_flags;
1277c478bd9Sstevel@tonic-gate } ared_t;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate typedef	struct ar_entry_query_s {
1307c478bd9Sstevel@tonic-gate 	uint32_t	areq_cmd;
1317c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_offset;
1327c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_length;
1337c478bd9Sstevel@tonic-gate 	uint32_t	areq_proto;
1347c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_offset;
1357c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_length;
1367c478bd9Sstevel@tonic-gate 	uint32_t	areq_flags;
1377c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_offset;
1387c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_length;
1397c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_count;	/* 0 ==> cache lookup only */
1407c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_interval; /* # of milliseconds; 0: default */
1417c478bd9Sstevel@tonic-gate 		/* # ofquests to buffer; 0: default */
1427c478bd9Sstevel@tonic-gate 	uint32_t	areq_max_buffered;
1437c478bd9Sstevel@tonic-gate 	uchar_t	areq_sap[8];		/* to insert in returned template */
1447c478bd9Sstevel@tonic-gate } areq_t;
1457c478bd9Sstevel@tonic-gate 
1464f255b44Sapersson #define	AR_EQ_DEFAULT_XMIT_COUNT	6
1474f255b44Sapersson #define	AR_EQ_DEFAULT_XMIT_INTERVAL	1000
1484f255b44Sapersson #define	AR_EQ_DEFAULT_MAX_BUFFERED	4
1494f255b44Sapersson 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Structure used with AR_ENTRY_LLAQUERY to map from the link_addr
1527c478bd9Sstevel@tonic-gate  * (in Neighbor Discovery option format excluding the option type and
1537c478bd9Sstevel@tonic-gate  * length) to a hardware address.
1547c478bd9Sstevel@tonic-gate  * The response has the same format as for an AR_ENTRY_SQUERY - an M_CTL with
1557c478bd9Sstevel@tonic-gate  * arel_hw_addr updated.
1567c478bd9Sstevel@tonic-gate  * An IPv6 address will be passed in AR_ENTRY_LLAQUERY so that atmip
1577c478bd9Sstevel@tonic-gate  * can send it in AR_CLIENT_NOTIFY messages.
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate typedef	struct ar_entry_llaquery_s {
1607c478bd9Sstevel@tonic-gate 	uint32_t	arel_cmd;
1617c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_offset;
1627c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_length;
1637c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_offset;
1647c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_length;
1657c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_offset;
1667c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_length;
1677c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_offset;
1687c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_length;
1697c478bd9Sstevel@tonic-gate } arel_t;
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate typedef	struct ar_mapping_add_s {
1727c478bd9Sstevel@tonic-gate 	uint32_t	arma_cmd;
1737c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_offset;
1747c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_length;
1757c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto;
1767c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_offset;
1777c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_length;
1787c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_mask_offset;
1797c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_extract_mask_offset;
1807c478bd9Sstevel@tonic-gate 	uint32_t	arma_flags;
1817c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_offset;
1827c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_length;
1837c478bd9Sstevel@tonic-gate 		/* Offset were we start placing */
1847c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_mapping_start;
1857c478bd9Sstevel@tonic-gate 					/* the mask&proto_addr */
1867c478bd9Sstevel@tonic-gate } arma_t;
1877c478bd9Sstevel@tonic-gate 
188*e11c3f44Smeem /* Structure used to notify ARP of changes to IPMP group topology */
189*e11c3f44Smeem typedef	struct ar_ipmp_event_s {
190*e11c3f44Smeem 	uint32_t	arie_cmd;
191*e11c3f44Smeem 	uint32_t	arie_name_offset;
192*e11c3f44Smeem 	uint32_t	arie_name_length;
193*e11c3f44Smeem 	char		arie_grifname[LIFNAMSIZ];
194*e11c3f44Smeem } arie_t;
195*e11c3f44Smeem 
1967c478bd9Sstevel@tonic-gate /* Structure used to notify clients of interesting conditions. */
1977c478bd9Sstevel@tonic-gate typedef struct ar_client_notify_s {
1987c478bd9Sstevel@tonic-gate 	uint32_t	arcn_cmd;
1997c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_offset;
2007c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_length;
2017c478bd9Sstevel@tonic-gate 	uint32_t	arcn_code;			/* Notification code. */
2027c478bd9Sstevel@tonic-gate } arcn_t;
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate /* Client Notification Codes */
2057c478bd9Sstevel@tonic-gate #define	AR_CN_BOGON	1
2067c478bd9Sstevel@tonic-gate #define	AR_CN_ANNOUNCE	2
20769bb4bb4Scarlsonj #define	AR_CN_READY	3		/* DAD complete; address usable */
20869bb4bb4Scarlsonj #define	AR_CN_FAILED	4		/* DAD failed; address unusable */
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate /* ARP Header */
2117c478bd9Sstevel@tonic-gate typedef struct arh_s {
2127c478bd9Sstevel@tonic-gate 	uchar_t	arh_hardware[2];
2137c478bd9Sstevel@tonic-gate 	uchar_t	arh_proto[2];
2147c478bd9Sstevel@tonic-gate 	uchar_t	arh_hlen;
2157c478bd9Sstevel@tonic-gate 	uchar_t	arh_plen;
2167c478bd9Sstevel@tonic-gate 	uchar_t	arh_operation[2];
2177c478bd9Sstevel@tonic-gate 	/* The sender and target hw/proto pairs follow */
2187c478bd9Sstevel@tonic-gate } arh_t;
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2217c478bd9Sstevel@tonic-gate }
2227c478bd9Sstevel@tonic-gate #endif
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate #endif	/* _INET_ARP_H */
225