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