Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_impl.h
+++ new/usr/src/cmd/cmd-inet/lib/ipmgmtd/ipmgmt_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 /*
23 23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 + * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
24 25 */
25 26
26 27 #ifndef _IPMGMT_IMPL_H
27 28 #define _IPMGMT_IMPL_H
28 29
29 30 #ifdef __cplusplus
30 31 extern "C" {
31 32 #endif
32 33
33 34 #include <net/if.h>
34 35 #include <libnvpair.h>
35 36 #include <libipadm.h>
36 37 #include <ipadm_ipmgmt.h>
37 38 #include <syslog.h>
38 39 #include <pthread.h>
39 40 #include <libscf.h>
40 41
41 42 #define IPMGMT_STRSIZE 256
42 43 #define IPMGMTD_FMRI "svc:/network/ip-interface-management:default"
43 44
44 45 /* ipmgmt_door.c */
45 46 extern void ipmgmt_handler(void *, char *, size_t, door_desc_t *, uint_t);
46 47
47 48 /* ipmgmt_util.c */
48 49 extern void ipmgmt_log(int, const char *, ...);
49 50 extern int ipmgmt_cpfile(const char *, const char *, boolean_t);
50 51
51 52 /* ipmgmt_persist.c */
52 53
53 54 /*
54 55 * following are the list of DB walker callback functions and the callback
55 56 * arguments for each of the callback functions used by the daemon
56 57 */
57 58 /* following functions take 'ipmgmt_prop_arg_t' as the callback argument */
58 59 extern db_wfunc_t ipmgmt_db_getprop, ipmgmt_db_resetprop;
59 60
60 61 /* following functions take ipadm_dbwrite_cbarg_t as callback argument */
61 62 extern db_wfunc_t ipmgmt_db_add, ipmgmt_db_update;
62 63
63 64 typedef struct {
64 65 char *cb_ifname;
65 66 ipadm_if_info_t *cb_ifinfo;
66 67 } ipmgmt_getif_cbarg_t;
67 68 extern db_wfunc_t ipmgmt_db_getif;
68 69
69 70 typedef struct {
70 71 char *cb_aobjname;
71 72 char *cb_ifname;
72 73 nvlist_t *cb_onvl;
73 74 int cb_ocnt;
74 75 } ipmgmt_getaddr_cbarg_t;
75 76 extern db_wfunc_t ipmgmt_db_getaddr;
76 77
77 78 typedef struct {
78 79 sa_family_t cb_family;
79 80 char *cb_ifname;
80 81 } ipmgmt_if_cbarg_t;
81 82 extern db_wfunc_t ipmgmt_db_setif, ipmgmt_db_resetif;
82 83
83 84 typedef struct {
84 85 char *cb_aobjname;
85 86 } ipmgmt_resetaddr_cbarg_t;
86 87 extern db_wfunc_t ipmgmt_db_resetaddr;
87 88
88 89 typedef struct {
89 90 sa_family_t cb_family;
90 91 nvlist_t *cb_invl;
91 92 nvlist_t *cb_onvl;
92 93 int cb_ocnt;
93 94 } ipmgmt_initif_cbarg_t;
94 95 extern db_wfunc_t ipmgmt_db_initif;
95 96
|
↓ open down ↓ |
62 lines elided |
↑ open up ↑ |
96 97 /*
97 98 * A linked list of address object nodes. Each node in the list tracks
98 99 * following information for the address object identified by `am_aobjname'.
99 100 * - interface on which the address is created
100 101 * - logical interface number on which the address is created
101 102 * - address family
102 103 * - `am_nextnum' identifies the next number to use to generate user part
103 104 * of `aobjname'.
104 105 * - address type (static, dhcp or addrconf)
105 106 * - `am_flags' indicates if this addrobj in active and/or persist config
106 - * - if `am_atype' is IPADM_ADDR_IPV6_ADDRCONF then `am_ifid' holds the
107 - * interface-id used to configure auto-configured addresses
107 + * - other, ipadm_addr_type_t-specific values are cached in
108 + * am_addr_cache (see type ipmgmt_addr_cache_u):
109 + * - ipv6: ipmgmt_am_linklocal (macro)
110 + * - ipv6: ipmgmt_am_ifid (macro)
111 + * - dhcp: ipmgmt_am_primary (macro)
112 + * - dhcp: ipmgmt_am_reqhost (macro)
108 113 */
109 114 typedef struct ipmgmt_aobjmap_s {
110 115 struct ipmgmt_aobjmap_s *am_next;
111 116 char am_aobjname[IPADM_AOBJSIZ];
112 117 char am_ifname[LIFNAMSIZ];
113 118 int32_t am_lnum;
114 119 sa_family_t am_family;
115 120 ipadm_addr_type_t am_atype;
116 121 uint32_t am_nextnum;
117 122 uint32_t am_flags;
118 - boolean_t am_linklocal;
119 - struct sockaddr_storage am_ifid;
123 + ipmgmt_addr_type_cache_u am_atype_cache;
120 124 } ipmgmt_aobjmap_t;
121 125
126 +#define ipmgmt_am_linklocal am_atype_cache.ipmgmt_ipv6_cache_s.ipmgmt_linklocal
127 +#define ipmgmt_am_ifid am_atype_cache.ipmgmt_ipv6_cache_s.ipmgmt_ifid
128 +#define ipmgmt_am_primary am_atype_cache.ipmgmt_dhcp_cache_s.ipmgmt_primary
129 +#define ipmgmt_am_reqhost am_atype_cache.ipmgmt_dhcp_cache_s.ipmgmt_reqhost
130 +
122 131 /* linked list of `aobjmap' nodes, protected by RW lock */
123 132 typedef struct ipmgmt_aobjmap_list_s {
124 133 ipmgmt_aobjmap_t *aobjmap_head;
125 134 pthread_rwlock_t aobjmap_rwlock;
126 135 } ipmgmt_aobjmap_list_t;
127 136
128 137 /* global `aobjmap' defined in ipmgmt_main.c */
129 138 extern ipmgmt_aobjmap_list_t aobjmap;
130 139
131 140 /* operations on the `aobjmap' linked list */
132 141 #define ADDROBJ_ADD 0x00000001
133 142 #define ADDROBJ_DELETE 0x00000002
134 143 #define ADDROBJ_LOOKUPADD 0x00000004
135 144 #define ADDROBJ_SETLIFNUM 0x00000008
136 145
137 146 /* Permanent data store for ipadm */
138 147 #define IPADM_DB_FILE "/etc/ipadm/ipadm.conf"
139 148 #define IPADM_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
140 149
141 150 /*
142 151 * With the initial integration of the daemon (PSARC 2010/080), the version
143 152 * of the ipadm data-store (/etc/ipadm/ipadm.conf) was 0. A subsequent fix
144 153 * needed an upgrade to the data-store and we bumped the version to 1.
145 154 */
146 155 #define IPADM_DB_VERSION 1
147 156
148 157 /*
149 158 * A temporary file created in SMF volatile filesystem. This file captures the
150 159 * in-memory copy of list `aobjmap' on disk. This is done to recover from
151 160 * daemon reboot (using svcadm) or crashes.
152 161 */
153 162 #define IPADM_TMPFS_DIR "/etc/svc/volatile/ipadm"
154 163 #define ADDROBJ_MAPPING_DB_FILE IPADM_TMPFS_DIR"/aobjmap.conf"
155 164
156 165 /*
157 166 * A temporary copy of the ipadm configuration file might need
158 167 * to be created if write requests are encountered during boottime
159 168 * and the root filesystem is mounted read-only.
160 169 */
161 170 #define IPADM_VOL_DB_FILE IPADM_TMPFS_DIR"/ipadm.conf"
162 171
163 172 /* SCF resources required to interact with svc.configd */
164 173 typedef struct scf_resources {
165 174 scf_handle_t *sr_handle;
166 175 scf_instance_t *sr_inst;
167 176 scf_propertygroup_t *sr_pg;
168 177 scf_property_t *sr_prop;
169 178 scf_value_t *sr_val;
170 179 scf_transaction_t *sr_tx;
171 180 scf_transaction_entry_t *sr_ent;
172 181 } scf_resources_t;
173 182
174 183 extern int ipmgmt_db_walk(db_wfunc_t *, void *, ipadm_db_op_t);
175 184 extern int ipmgmt_aobjmap_op(ipmgmt_aobjmap_t *, uint32_t);
176 185 extern boolean_t ipmgmt_aobjmap_init(void *, nvlist_t *, char *,
177 186 size_t, int *);
178 187 extern int ipmgmt_persist_aobjmap(ipmgmt_aobjmap_t *,
179 188 ipadm_db_op_t);
180 189 extern boolean_t ipmgmt_ngz_firstboot_postinstall();
181 190 extern int ipmgmt_persist_if(ipmgmt_if_arg_t *);
182 191 extern void ipmgmt_init_prop();
183 192 extern boolean_t ipmgmt_db_upgrade(void *, nvlist_t *, char *,
184 193 size_t, int *);
185 194 extern int ipmgmt_create_scf_resources(const char *,
186 195 scf_resources_t *);
187 196 extern void ipmgmt_release_scf_resources(scf_resources_t *);
188 197 extern boolean_t ipmgmt_needs_upgrade(scf_resources_t *);
189 198 extern void ipmgmt_update_dbver(scf_resources_t *);
190 199
191 200 #ifdef __cplusplus
192 201 }
193 202 #endif
194 203
195 204 #endif /* _IPMGMT_IMPL_H */
|
↓ open down ↓ |
64 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX