xref: /titanic_50/usr/src/uts/common/inet/arp.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1992,1997-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #ifndef	_INET_ARP_H
29*7c478bd9Sstevel@tonic-gate #define	_INET_ARP_H
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
34*7c478bd9Sstevel@tonic-gate extern "C" {
35*7c478bd9Sstevel@tonic-gate #endif
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #define	ARP_REQUEST	1
38*7c478bd9Sstevel@tonic-gate #define	ARP_RESPONSE	2
39*7c478bd9Sstevel@tonic-gate #define	RARP_REQUEST	3
40*7c478bd9Sstevel@tonic-gate #define	RARP_RESPONSE	4
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #define	AR_IOCTL		(((unsigned)'A' & 0xFF)<<8)
43*7c478bd9Sstevel@tonic-gate #define	CMD_IN_PROGRESS		0x10000
44*7c478bd9Sstevel@tonic-gate /*
45*7c478bd9Sstevel@tonic-gate  * The following ARP commands are private, and not part of a supported
46*7c478bd9Sstevel@tonic-gate  * interface. They are subject to change without notice in any release.
47*7c478bd9Sstevel@tonic-gate  */
48*7c478bd9Sstevel@tonic-gate #define	AR_ENTRY_ADD		(AR_IOCTL + 1)
49*7c478bd9Sstevel@tonic-gate #define	AR_ENTRY_DELETE		(AR_IOCTL + 2)
50*7c478bd9Sstevel@tonic-gate #define	AR_ENTRY_QUERY		(AR_IOCTL + 3)
51*7c478bd9Sstevel@tonic-gate #define	AR_XMIT_REQUEST		(AR_IOCTL + 4)
52*7c478bd9Sstevel@tonic-gate #define	AR_XMIT_TEMPLATE	(AR_IOCTL + 5)
53*7c478bd9Sstevel@tonic-gate #define	AR_ENTRY_SQUERY		(AR_IOCTL + 6)
54*7c478bd9Sstevel@tonic-gate #define	AR_MAPPING_ADD		(AR_IOCTL + 7)
55*7c478bd9Sstevel@tonic-gate #define	AR_CLIENT_NOTIFY	(AR_IOCTL + 8)
56*7c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_UP		(AR_IOCTL + 9)
57*7c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_DOWN	(AR_IOCTL + 10)
58*7c478bd9Sstevel@tonic-gate #define	AR_XMIT_RESPONSE	(AR_IOCTL + 11)
59*7c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_ON		(AR_IOCTL + 12)
60*7c478bd9Sstevel@tonic-gate #define	AR_INTERFACE_OFF	(AR_IOCTL + 13)
61*7c478bd9Sstevel@tonic-gate #define	AR_DLPIOP_DONE		(AR_IOCTL + 14)
62*7c478bd9Sstevel@tonic-gate #define	AR_ENTRY_LLAQUERY	(AR_IOCTL + 15)
63*7c478bd9Sstevel@tonic-gate /*
64*7c478bd9Sstevel@tonic-gate  * This is not an ARP command per se, it is used to interface between
65*7c478bd9Sstevel@tonic-gate  * ARP and IP during close.
66*7c478bd9Sstevel@tonic-gate  */
67*7c478bd9Sstevel@tonic-gate #define	AR_ARP_CLOSING		(AR_IOCTL + 16)
68*7c478bd9Sstevel@tonic-gate 
69*7c478bd9Sstevel@tonic-gate /*
70*7c478bd9Sstevel@tonic-gate  * The following ACE flags are private, and not part of a supported
71*7c478bd9Sstevel@tonic-gate  * interface. They are subject to change without notice in any release.
72*7c478bd9Sstevel@tonic-gate  */
73*7c478bd9Sstevel@tonic-gate #define	ACE_F_PERMANENT		0x1
74*7c478bd9Sstevel@tonic-gate #define	ACE_F_PUBLISH		0x2
75*7c478bd9Sstevel@tonic-gate #define	ACE_F_DYING		0x4
76*7c478bd9Sstevel@tonic-gate #define	ACE_F_RESOLVED		0x8
77*7c478bd9Sstevel@tonic-gate /* Using bit mask extraction from target address */
78*7c478bd9Sstevel@tonic-gate #define	ACE_F_MAPPING		0x10
79*7c478bd9Sstevel@tonic-gate #define	ACE_F_MYADDR		0x20	/* Strong check for duplicate MACs */
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate /* ARP Cmd Table entry */
82*7c478bd9Sstevel@tonic-gate typedef struct arct_s {
83*7c478bd9Sstevel@tonic-gate 	pfi_t	arct_pfi;
84*7c478bd9Sstevel@tonic-gate 	uint32_t	arct_cmd;
85*7c478bd9Sstevel@tonic-gate 	int	arct_min_len;
86*7c478bd9Sstevel@tonic-gate 	uint32_t	arct_flags;
87*7c478bd9Sstevel@tonic-gate 	int		arct_priv_req;	/* Privilege required for this cmd */
88*7c478bd9Sstevel@tonic-gate 	const char	*arct_txt;
89*7c478bd9Sstevel@tonic-gate } arct_t;
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate /* ARP Command Structures */
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /* arc_t - Common command overlay */
94*7c478bd9Sstevel@tonic-gate typedef struct ar_cmd_s {
95*7c478bd9Sstevel@tonic-gate 	uint32_t	arc_cmd;
96*7c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_offset;
97*7c478bd9Sstevel@tonic-gate 	uint32_t	arc_name_length;
98*7c478bd9Sstevel@tonic-gate } arc_t;
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate /*
101*7c478bd9Sstevel@tonic-gate  * The following ARP command structures are private, and not
102*7c478bd9Sstevel@tonic-gate  * part of a supported interface. They are subject to change
103*7c478bd9Sstevel@tonic-gate  * without notice in any release.
104*7c478bd9Sstevel@tonic-gate  */
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /*
107*7c478bd9Sstevel@tonic-gate  * NOTE: when using area_t for an AR_ENTRY_SQUERY, the area_hw_addr_offset
108*7c478bd9Sstevel@tonic-gate  * field isn't what you might think. See comments in ip_multi.c where
109*7c478bd9Sstevel@tonic-gate  * the routine ill_create_squery() is called, and also in the routine
110*7c478bd9Sstevel@tonic-gate  * itself, to see how this field is used *only* when the area_t holds
111*7c478bd9Sstevel@tonic-gate  * an AR_ENTRY_SQUERY.
112*7c478bd9Sstevel@tonic-gate  */
113*7c478bd9Sstevel@tonic-gate typedef	struct ar_entry_add_s {
114*7c478bd9Sstevel@tonic-gate 	uint32_t	area_cmd;
115*7c478bd9Sstevel@tonic-gate 	uint32_t	area_name_offset;
116*7c478bd9Sstevel@tonic-gate 	uint32_t	area_name_length;
117*7c478bd9Sstevel@tonic-gate 	uint32_t	area_proto;
118*7c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_offset;
119*7c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_addr_length;
120*7c478bd9Sstevel@tonic-gate 	uint32_t	area_proto_mask_offset;
121*7c478bd9Sstevel@tonic-gate 	uint32_t	area_flags;		/* Same values as ace_flags */
122*7c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_offset;
123*7c478bd9Sstevel@tonic-gate 	uint32_t	area_hw_addr_length;
124*7c478bd9Sstevel@tonic-gate } area_t;
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate typedef	struct ar_entry_delete_s {
127*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_cmd;
128*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_offset;
129*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_name_length;
130*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto;
131*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_offset;
132*7c478bd9Sstevel@tonic-gate 	uint32_t	ared_proto_addr_length;
133*7c478bd9Sstevel@tonic-gate } ared_t;
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate typedef	struct ar_entry_query_s {
136*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_cmd;
137*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_offset;
138*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_name_length;
139*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_proto;
140*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_offset;
141*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_target_addr_length;
142*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_flags;
143*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_offset;
144*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_sender_addr_length;
145*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_count;	/* 0 ==> cache lookup only */
146*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_xmit_interval; /* # of milliseconds; 0: default */
147*7c478bd9Sstevel@tonic-gate 		/* # ofquests to buffer; 0: default */
148*7c478bd9Sstevel@tonic-gate 	uint32_t	areq_max_buffered;
149*7c478bd9Sstevel@tonic-gate 	uchar_t	areq_sap[8];		/* to insert in returned template */
150*7c478bd9Sstevel@tonic-gate } areq_t;
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate /*
153*7c478bd9Sstevel@tonic-gate  * Structure used with AR_ENTRY_LLAQUERY to map from the link_addr
154*7c478bd9Sstevel@tonic-gate  * (in Neighbor Discovery option format excluding the option type and
155*7c478bd9Sstevel@tonic-gate  * length) to a hardware address.
156*7c478bd9Sstevel@tonic-gate  * The response has the same format as for an AR_ENTRY_SQUERY - an M_CTL with
157*7c478bd9Sstevel@tonic-gate  * arel_hw_addr updated.
158*7c478bd9Sstevel@tonic-gate  * An IPv6 address will be passed in AR_ENTRY_LLAQUERY so that atmip
159*7c478bd9Sstevel@tonic-gate  * can send it in AR_CLIENT_NOTIFY messages.
160*7c478bd9Sstevel@tonic-gate  */
161*7c478bd9Sstevel@tonic-gate typedef	struct ar_entry_llaquery_s {
162*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_cmd;
163*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_offset;
164*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_name_length;
165*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_offset;
166*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_link_addr_length;
167*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_offset;
168*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_hw_addr_length;
169*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_offset;
170*7c478bd9Sstevel@tonic-gate 	uint32_t	arel_ip_addr_length;
171*7c478bd9Sstevel@tonic-gate } arel_t;
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate typedef	struct ar_mapping_add_s {
174*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_cmd;
175*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_offset;
176*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_name_length;
177*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto;
178*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_offset;
179*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_addr_length;
180*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_mask_offset;
181*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_proto_extract_mask_offset;
182*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_flags;
183*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_offset;
184*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_addr_length;
185*7c478bd9Sstevel@tonic-gate 		/* Offset were we start placing */
186*7c478bd9Sstevel@tonic-gate 	uint32_t	arma_hw_mapping_start;
187*7c478bd9Sstevel@tonic-gate 					/* the mask&proto_addr */
188*7c478bd9Sstevel@tonic-gate } arma_t;
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate /* Structure used to notify clients of interesting conditions. */
191*7c478bd9Sstevel@tonic-gate typedef struct ar_client_notify_s {
192*7c478bd9Sstevel@tonic-gate 	uint32_t	arcn_cmd;
193*7c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_offset;
194*7c478bd9Sstevel@tonic-gate 	uint32_t	arcn_name_length;
195*7c478bd9Sstevel@tonic-gate 	uint32_t	arcn_code;			/* Notification code. */
196*7c478bd9Sstevel@tonic-gate } arcn_t;
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /* Client Notification Codes */
199*7c478bd9Sstevel@tonic-gate /*
200*7c478bd9Sstevel@tonic-gate  * The following Client Notification codes are private, and not
201*7c478bd9Sstevel@tonic-gate  * part of a supported interface. They are subject to change
202*7c478bd9Sstevel@tonic-gate  * without notice in any release.
203*7c478bd9Sstevel@tonic-gate  */
204*7c478bd9Sstevel@tonic-gate #define	AR_CN_BOGON	1
205*7c478bd9Sstevel@tonic-gate #define	AR_CN_ANNOUNCE	2
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate /* ARP Header */
208*7c478bd9Sstevel@tonic-gate typedef struct arh_s {
209*7c478bd9Sstevel@tonic-gate 	uchar_t	arh_hardware[2];
210*7c478bd9Sstevel@tonic-gate 	uchar_t	arh_proto[2];
211*7c478bd9Sstevel@tonic-gate 	uchar_t	arh_hlen;
212*7c478bd9Sstevel@tonic-gate 	uchar_t	arh_plen;
213*7c478bd9Sstevel@tonic-gate 	uchar_t	arh_operation[2];
214*7c478bd9Sstevel@tonic-gate 	/* The sender and target hw/proto pairs follow */
215*7c478bd9Sstevel@tonic-gate } arh_t;
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
218*7c478bd9Sstevel@tonic-gate }
219*7c478bd9Sstevel@tonic-gate #endif
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate #endif	/* _INET_ARP_H */
222