Print this page
Commit IPMP changes
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libipadm/common/libipadm_impl.h
+++ new/usr/src/lib/libipadm/common/libipadm_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2013 by Delphix. All rights reserved.
24 + * Copyright (c) 2014 Nexenta Systems, Inc. All rights reserved.
24 25 */
25 26
26 27 #ifndef _LIBIPADM_IMPL_H
27 28 #define _LIBIPADM_IMPL_H
28 29
29 30 #ifdef __cplusplus
30 31 extern "C" {
31 32 #endif
32 33
33 34 #include <sys/socket.h>
35 +#include <sys/list.h>
34 36 #include <net/if.h>
35 37 #include <libipadm.h>
36 38 #include <libdladm.h>
37 39 #include <ipadm_ipmgmt.h>
38 40 #include <inet/tunables.h>
39 41 #include <netinet/in.h>
40 42 #include <pthread.h>
41 43 #include <libinetutil.h>
42 44 #include <libsocket_priv.h>
43 45
44 46 #define IPADM_STRSIZE 256
45 47 #define IPADM_ONSTR "on"
46 48 #define IPADM_OFFSTR "off"
47 49 #define ARP_MOD_NAME "arp"
48 50 #define IPADM_LOGICAL_SEP ':'
49 51 #define IPV6_MIN_MTU 1280 /* rfc2460 */
50 52
51 53 /* mask for flags accepted by libipadm functions */
52 54 #define IPADM_COMMON_OPT_MASK (IPADM_OPT_ACTIVE | IPADM_OPT_PERSIST)
53 55
56 +typedef enum {
57 + IPADM_ADD_IPMP_MEMBER,
58 + IPADM_REMOVE_IPMP_MEMBER
59 +} ipadm_ipmp_operation_t;
60 +
54 61 /* Opaque library handle */
55 62 struct ipadm_handle {
56 63 int iph_sock; /* socket to interface */
57 64 int iph_sock6; /* socket to interface */
58 65 int iph_door_fd; /* door descriptor to ipmgmtd */
59 66 int iph_rtsock; /* routing socket */
60 67 dladm_handle_t iph_dlh; /* handle to libdladm library */
61 68 uint32_t iph_flags; /* internal flags */
62 69 pthread_mutex_t iph_lock; /* lock to set door_fd */
63 70 zoneid_t iph_zoneid; /* zoneid where handle was opened */
64 71 };
65 72
66 73 struct ipadm_addrobj_s {
67 74 char ipadm_ifname[LIFNAMSIZ];
68 75 int32_t ipadm_lifnum;
69 76 char ipadm_aobjname[IPADM_AOBJSIZ];
70 77 ipadm_addr_type_t ipadm_atype;
71 78 uint32_t ipadm_flags;
72 79 sa_family_t ipadm_af;
73 80 union {
74 81 struct {
75 82 char ipadm_ahname[MAXNAMELEN];
76 83 struct sockaddr_storage ipadm_addr;
77 84 uint32_t ipadm_prefixlen;
78 85 char ipadm_dhname[MAXNAMELEN];
79 86 struct sockaddr_storage ipadm_dstaddr;
80 87 } ipadm_static_addr_s;
81 88 struct {
82 89 struct sockaddr_in6 ipadm_intfid;
83 90 uint32_t ipadm_intfidlen;
84 91 boolean_t ipadm_stateless;
85 92 boolean_t ipadm_stateful;
86 93 } ipadm_ipv6_intfid_s;
87 94 struct {
88 95 boolean_t ipadm_primary;
89 96 int32_t ipadm_wait;
90 97 } ipadm_dhcp_s;
91 98 } ipadm_addr_u;
92 99 };
93 100
94 101 #define ipadm_static_addr ipadm_addr_u.ipadm_static_addr_s.ipadm_addr
95 102 #define ipadm_static_aname ipadm_addr_u.ipadm_static_addr_s.ipadm_ahname
96 103 #define ipadm_static_prefixlen ipadm_addr_u.ipadm_static_addr_s.ipadm_prefixlen
97 104 #define ipadm_static_dst_addr ipadm_addr_u.ipadm_static_addr_s.ipadm_dstaddr
98 105 #define ipadm_static_dname ipadm_addr_u.ipadm_static_addr_s.ipadm_dhname
99 106 #define ipadm_intfid ipadm_addr_u.ipadm_ipv6_intfid_s.ipadm_intfid
100 107 #define ipadm_intfidlen ipadm_addr_u.ipadm_ipv6_intfid_s.ipadm_intfidlen
101 108 #define ipadm_stateless ipadm_addr_u.ipadm_ipv6_intfid_s.ipadm_stateless
102 109 #define ipadm_stateful ipadm_addr_u.ipadm_ipv6_intfid_s.ipadm_stateful
103 110 #define ipadm_primary ipadm_addr_u.ipadm_dhcp_s.ipadm_primary
104 111 #define ipadm_wait ipadm_addr_u.ipadm_dhcp_s.ipadm_wait
105 112
106 113 /*
107 114 * Data structures and callback functions related to property management
108 115 */
109 116 struct ipadm_prop_desc;
110 117 typedef struct ipadm_prop_desc ipadm_prop_desc_t;
111 118
112 119 /* property set() callback */
113 120 typedef ipadm_status_t ipadm_pd_setf_t(ipadm_handle_t, const void *,
114 121 ipadm_prop_desc_t *, const void *, uint_t, uint_t);
115 122
116 123 /* property get() callback */
117 124 typedef ipadm_status_t ipadm_pd_getf_t(ipadm_handle_t, const void *,
118 125 ipadm_prop_desc_t *, char *, uint_t *, uint_t, uint_t);
119 126
120 127 struct ipadm_prop_desc {
121 128 char *ipd_name; /* property name */
122 129 char *ipd_old_name; /* for backward compatibility */
123 130 uint_t ipd_class; /* prop. class - global/perif/both */
124 131 uint_t ipd_proto; /* protocol to which property belongs */
125 132 uint_t ipd_flags; /* see below */
126 133 ipadm_pd_setf_t *ipd_set; /* set callback function */
127 134 ipadm_pd_getf_t *ipd_get_range; /* get range callback function */
128 135 ipadm_pd_getf_t *ipd_get; /* get value callback function */
129 136 };
130 137
131 138 /* ipd_flags values */
132 139 #define IPADMPROP_MULVAL 0x00000001 /* property multi-valued */
133 140
134 141 extern ipadm_prop_desc_t ipadm_addrprop_table[];
135 142 extern ipadm_pd_getf_t i_ipadm_get_onoff;
136 143
137 144 /* libipadm.c */
138 145 extern ipadm_status_t i_ipadm_get_flags(ipadm_handle_t, const char *,
139 146 sa_family_t, uint64_t *);
140 147 extern ipadm_status_t i_ipadm_set_flags(ipadm_handle_t, const char *,
141 148 sa_family_t, uint64_t, uint64_t);
142 149 extern ipadm_status_t i_ipadm_init_ifs(ipadm_handle_t, const char *,
↓ open down ↓ |
79 lines elided |
↑ open up ↑ |
143 150 nvlist_t **);
144 151 extern ipadm_status_t i_ipadm_init_ifobj(ipadm_handle_t, const char *,
145 152 nvlist_t *);
146 153 extern ipadm_status_t i_ipadm_init_addrobj(ipadm_handle_t, nvlist_t *);
147 154 extern ipadm_status_t i_ipadm_addr_persist(ipadm_handle_t,
148 155 const ipadm_addrobj_t, boolean_t, uint32_t);
149 156 extern ipadm_status_t i_ipadm_delete_addr(ipadm_handle_t, ipadm_addrobj_t);
150 157 extern int i_ipadm_strioctl(int, int, char *, int);
151 158 extern boolean_t i_ipadm_is_loopback(const char *);
152 159 extern boolean_t i_ipadm_is_vni(const char *);
153 -extern boolean_t i_ipadm_is_ipmp(ipadm_handle_t, const char *);
154 -extern boolean_t i_ipadm_is_under_ipmp(ipadm_handle_t, const char *);
155 160 extern boolean_t i_ipadm_is_6to4(ipadm_handle_t, char *);
156 161 extern boolean_t i_ipadm_validate_ifname(ipadm_handle_t, const char *);
157 162 extern ipadm_status_t ipadm_errno2status(int);
158 163 extern int ipadm_door_call(ipadm_handle_t, void *, size_t, void **,
159 164 size_t, boolean_t);
160 165 extern boolean_t ipadm_if_enabled(ipadm_handle_t, const char *,
161 166 sa_family_t);
167 +extern ipadm_status_t i_ipadm_call_ipmgmtd(ipadm_handle_t, void *,
168 + size_t, nvlist_t **);
162 169
163 170 /* ipadm_ndpd.c */
164 171 extern ipadm_status_t i_ipadm_create_ipv6addrs(ipadm_handle_t,
165 172 ipadm_addrobj_t, uint32_t);
166 173 extern ipadm_status_t i_ipadm_delete_ipv6addrs(ipadm_handle_t,
167 174 ipadm_addrobj_t);
168 175 extern ipadm_status_t i_ipadm_disable_autoconf(const char *);
169 176 extern ipadm_status_t i_ipadm_enable_autoconf(const char *);
170 177
171 178 /* ipadm_persist.c */
172 179 extern ipadm_status_t i_ipadm_add_ipaddr2nvl(nvlist_t *, ipadm_addrobj_t);
173 180 extern ipadm_status_t i_ipadm_add_ip6addr2nvl(nvlist_t *, ipadm_addrobj_t);
174 181 extern ipadm_status_t i_ipadm_add_intfid2nvl(nvlist_t *, ipadm_addrobj_t);
175 182 extern ipadm_status_t i_ipadm_add_dhcp2nvl(nvlist_t *, boolean_t, int32_t);
176 183
177 184 /* ipadm_prop.c */
178 185 extern ipadm_status_t i_ipadm_persist_propval(ipadm_handle_t,
179 186 ipadm_prop_desc_t *, const char *, const void *,
180 187 uint_t);
181 188 extern ipadm_status_t i_ipadm_get_persist_propval(ipadm_handle_t,
182 189 ipadm_prop_desc_t *, char *, uint_t *,
183 190 const void *);
184 191
185 192 /* ipadm_addr.c */
186 193 extern void i_ipadm_init_addr(ipadm_addrobj_t, const char *,
187 194 const char *, ipadm_addr_type_t);
188 195 extern ipadm_status_t i_ipadm_merge_prefixlen_from_nvl(nvlist_t *, nvlist_t *,
189 196 const char *);
190 197 extern ipadm_status_t i_ipadm_get_addrobj(ipadm_handle_t, ipadm_addrobj_t);
191 198 extern ipadm_status_t i_ipadm_enable_static(ipadm_handle_t, const char *,
192 199 nvlist_t *, sa_family_t);
193 200 extern ipadm_status_t i_ipadm_enable_dhcp(ipadm_handle_t, const char *,
194 201 nvlist_t *);
195 202 extern ipadm_status_t i_ipadm_enable_addrconf(ipadm_handle_t, const char *,
196 203 nvlist_t *);
197 204 extern void i_ipadm_addrobj2lifname(ipadm_addrobj_t, char *, int);
198 205 extern ipadm_status_t i_ipadm_nvl2in6_addr(nvlist_t *, char *,
199 206 in6_addr_t *);
200 207 extern ipadm_status_t i_ipadm_get_lif2addrobj(ipadm_handle_t,
201 208 ipadm_addrobj_t);
202 209 extern ipadm_status_t i_ipadm_lookupadd_addrobj(ipadm_handle_t,
203 210 ipadm_addrobj_t);
204 211 extern ipadm_status_t i_ipadm_setlifnum_addrobj(ipadm_handle_t,
205 212 ipadm_addrobj_t);
206 213 extern ipadm_status_t i_ipadm_do_addif(ipadm_handle_t, ipadm_addrobj_t);
207 214 extern ipadm_status_t i_ipadm_delete_addrobj(ipadm_handle_t,
208 215 const ipadm_addrobj_t, uint32_t);
209 216 extern boolean_t i_ipadm_name2atype(const char *, sa_family_t *,
210 217 ipadm_addr_type_t *);
211 218 extern ipadm_status_t i_ipadm_resolve_addr(const char *, sa_family_t,
212 219 struct sockaddr_storage *);
213 220
214 221 /* ipadm_if.c */
215 222 extern ipadm_status_t i_ipadm_create_if(ipadm_handle_t, char *, sa_family_t,
216 223 uint32_t);
217 224 extern ipadm_status_t i_ipadm_delete_if(ipadm_handle_t, const char *,
218 225 sa_family_t, uint32_t);
↓ open down ↓ |
47 lines elided |
↑ open up ↑ |
219 226 extern ipadm_status_t i_ipadm_plumb_if(ipadm_handle_t, char *, sa_family_t,
220 227 uint32_t);
221 228 extern ipadm_status_t i_ipadm_unplumb_if(ipadm_handle_t, const char *,
222 229 sa_family_t);
223 230 extern ipadm_status_t i_ipadm_if_pexists(ipadm_handle_t, const char *,
224 231 sa_family_t, boolean_t *);
225 232 extern ipadm_status_t i_ipadm_delete_ifobj(ipadm_handle_t, const char *,
226 233 sa_family_t, boolean_t);
227 234 extern int i_ipadm_get_lnum(const char *);
228 235
236 +extern ipadm_status_t i_ipadm_set_groupname_active(ipadm_handle_t,
237 + const char *, const char *);
238 +extern ipadm_status_t i_ipadm_get_groupname_active(ipadm_handle_t,
239 + const char *, char *, size_t);
240 +extern boolean_t i_ipadm_is_under_ipmp(ipadm_handle_t, const char *);
241 +extern boolean_t i_ipadm_is_ipmp(ipadm_handle_t, const char *);
229 242 #ifdef __cplusplus
230 243 }
231 244 #endif
232 245
233 246 #endif /* _LIBIPADM_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX