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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 */
25 #include <arpa/inet.h>
26 #include <errno.h>
27 #include <getopt.h>
28 #include <inet/ip.h>
29 #include <inet/iptun.h>
30 #include <inet/tunables.h>
31 #include <libdladm.h>
32 #include <libdliptun.h>
33 #include <libdllink.h>
34 #include <libinetutil.h>
35 #include <libipadm.h>
36 #include <locale.h>
37 #include <netdb.h>
38 #include <netinet/in.h>
39 #include <ofmt.h>
40 #include <stdarg.h>
41 #include <stddef.h>
42 #include <stdio.h>
43 #include <stdlib.h>
71 /* interface management related sub-commands */
72 { "create-if", do_create_if, "\tcreate-if\t[-t] <interface>" },
73 { "disable-if", do_disable_if, "\tdisable-if\t-t <interface>" },
74 { "enable-if", do_enable_if, "\tenable-if\t-t <interface>" },
75 { "delete-if", do_delete_if, "\tdelete-if\t<interface>" },
76 { "show-if", do_show_if,
77 "\tshow-if\t\t[[-p] -o <field>,...] [<interface>]\n" },
78 { "set-ifprop", do_set_ifprop,
79 "\tset-ifprop\t[-t] -p <prop>=<value[,...]> -m <protocol> "
80 "<interface>" },
81 { "reset-ifprop", do_reset_ifprop,
82 "\treset-ifprop\t[-t] -p <prop> -m <protocol> <interface>" },
83 { "show-ifprop", do_show_ifprop,
84 "\tshow-ifprop\t[[-c] -o <field>,...] [-p <prop>,...]\n"
85 "\t\t\t[-m <protocol>] [interface]\n" },
86
87 /* address management related sub-commands */
88 { "create-addr", do_create_addr,
89 "\tcreate-addr\t[-t] -T static [-d] "
90 "-a{local|remote}=addr[/prefixlen]\n\t\t\t<addrobj>\n"
91 "\tcreate-addr\t[-t] -T dhcp [-w <seconds> | forever] <addrobj>\n"
92 "\tcreate-addr\t[-t] -T addrconf [-i interface-id]\n"
93 "\t\t\t[-p {stateful|stateless}={yes|no}] <addrobj>" },
94 { "down-addr", do_down_addr, "\tdown-addr\t[-t] <addrobj>" },
95 { "up-addr", do_up_addr, "\tup-addr\t\t[-t] <addrobj>" },
96 { "disable-addr", do_disable_addr, "\tdisable-addr\t-t <addrobj>" },
97 { "enable-addr", do_enable_addr, "\tenable-addr\t-t <addrobj>" },
98 { "refresh-addr", do_refresh_addr, "\trefresh-addr\t[-i] <addrobj>" },
99 { "delete-addr", do_delete_addr, "\tdelete-addr\t[-r] <addrobj>" },
100 { "show-addr", do_show_addr,
101 "\tshow-addr\t[[-p] -o <field>,...] [<addrobj>]\n" },
102 { "set-addrprop", do_set_addrprop,
103 "\tset-addrprop\t[-t] -p <prop>=<value[,...]> <addrobj>" },
104 { "reset-addrprop", do_reset_addrprop,
105 "\treset-addrprop\t[-t] -p <prop> <addrobj>" },
106 { "show-addrprop", do_show_addrprop,
107 "\tshow-addrprop\t[[-c] -o <field>,...] [-p <prop>,...] "
108 "<addrobj>\n" },
109
110 /* protocol properties related sub-commands */
111 { "set-prop", do_set_prop,
144 };
145
146 static const struct option set_ifprop_longopts[] = {
147 {"module", required_argument, 0, 'm' },
148 {"prop", required_argument, 0, 'p' },
149 {"temporary", no_argument, 0, 't' },
150 { 0, 0, 0, 0 }
151 };
152
153 static const struct option addr_misc_longopts[] = {
154 {"inform", no_argument, 0, 'i' },
155 {"release", no_argument, 0, 'r' },
156 {"temporary", no_argument, 0, 't' },
157 { 0, 0, 0, 0 }
158 };
159
160 static const struct option addr_longopts[] = {
161 {"address", required_argument, 0, 'a' },
162 {"down", no_argument, 0, 'd' },
163 {"interface-id", required_argument, 0, 'i' },
164 {"prop", required_argument, 0, 'p' },
165 {"temporary", no_argument, 0, 't' },
166 {"type", required_argument, 0, 'T' },
167 {"wait", required_argument, 0, 'w' },
168 { 0, 0, 0, 0 }
169 };
170
171 static const struct option show_addr_longopts[] = {
172 {"parsable", no_argument, 0, 'p' },
173 {"output", required_argument, 0, 'o' },
174 { 0, 0, 0, 0 }
175 };
176
177 static const struct option show_if_longopts[] = {
178 {"parsable", no_argument, 0, 'p' },
179 {"output", required_argument, 0, 'o' },
180 { 0, 0, 0, 0 }
181 };
182
183 /* callback functions to print show-* subcommands output */
184 static ofmt_cb_t print_prop_cb;
615 {
616 show_prop_state_t *statep = arg;
617
618 statep->sps_pname = pname;
619 statep->sps_proto = proto;
620 statep->sps_status = IPADM_SUCCESS;
621 ofmt_print(statep->sps_ofmt, arg);
622
623 /*
624 * if an object is not found or operation is not supported then
625 * stop the walker.
626 */
627 if (statep->sps_status == IPADM_NOTFOUND ||
628 statep->sps_status == IPADM_NOTSUP)
629 return (_B_FALSE);
630 return (_B_TRUE);
631 }
632
633 /*
634 * Properties to be displayed is in `statep->sps_proplist'. If it is NULL,
635 * for all the properties for the specified object, relavant information, will
636 * be displayed. Otherwise, for the selected property set, display relevant
637 * information
638 */
639 static void
640 show_properties(void *arg, int prop_class)
641 {
642 show_prop_state_t *statep = arg;
643 nvlist_t *nvl = statep->sps_proplist;
644 uint_t proto = statep->sps_proto;
645 nvpair_t *curr_nvp;
646 char *buf, *name;
647 ipadm_status_t status;
648
649 /* allocate sufficient buffer to hold a property value */
650 if ((buf = malloc(MAXPROPVALLEN)) == NULL)
651 die("insufficient memory");
652 statep->sps_propval = buf;
653
654 /* if no properties were specified, display all the properties */
655 if (nvl == NULL) {
656 (void) ipadm_walk_proptbl(proto, prop_class, show_property,
1241 }
1242 }
1243
1244 /*
1245 * Creates static, dhcp or addrconf addresses and associates the created
1246 * addresses with the specified address object name.
1247 */
1248 static void
1249 do_create_addr(int argc, char *argv[], const char *use)
1250 {
1251 ipadm_status_t status;
1252 int option;
1253 uint32_t flags =
1254 IPADM_OPT_PERSIST|IPADM_OPT_ACTIVE|IPADM_OPT_UP|IPADM_OPT_V46;
1255 char *cp;
1256 char *atype = NULL;
1257 char *static_arg = NULL;
1258 char *addrconf_arg = NULL;
1259 char *interface_id = NULL;
1260 char *wait = NULL;
1261 boolean_t s_opt = _B_FALSE; /* static addr options */
1262 boolean_t auto_opt = _B_FALSE; /* Addrconf options */
1263 boolean_t dhcp_opt = _B_FALSE; /* dhcp options */
1264
1265 opterr = 0;
1266 while ((option = getopt_long(argc, argv, ":T:a:di:p:w:t",
1267 addr_longopts, NULL)) != -1) {
1268 switch (option) {
1269 case 'T':
1270 atype = optarg;
1271 break;
1272 case 'a':
1273 static_arg = optarg;
1274 s_opt = _B_TRUE;
1275 break;
1276 case 'd':
1277 flags &= ~IPADM_OPT_UP;
1278 s_opt = _B_TRUE;
1279 break;
1280 case 'i':
1281 interface_id = optarg;
1282 auto_opt = _B_TRUE;
1283 break;
1284 case 'p':
1285 addrconf_arg = optarg;
1286 auto_opt = _B_TRUE;
1287 break;
1288 case 'w':
1289 wait = optarg;
1290 dhcp_opt = _B_TRUE;
1291 break;
1292 case 't':
1293 flags &= ~IPADM_OPT_PERSIST;
1294 break;
1295 default:
1296 die_opterr(optopt, option, use);
1297 }
1298 }
1299 if (atype == NULL || optind != (argc - 1)) {
1300 die("Invalid arguments\nusage: %s", use);
1301 } else if ((cp = strchr(argv[optind], '/')) == NULL ||
1302 strlen(++cp) == 0) {
1303 die("invalid address object name: %s\nusage: %s",
1304 argv[optind], use);
1305 }
1306
1307 /*
1308 * Allocate and initialize the addrobj based on the address type.
1309 */
1310 if (strcmp(atype, "static") == 0) {
1311 if (static_arg == NULL || auto_opt || dhcp_opt) {
1312 die("Invalid arguments for type %s\nusage: %s",
1313 atype, use);
1314 }
1315 process_static_addrargs(use, static_arg, argv[optind]);
1316 } else if (strcmp(atype, "dhcp") == 0) {
1317 if (auto_opt || s_opt) {
1318 die("Invalid arguments for type %s\nusage: %s",
1319 atype, use);
1320 }
1321
1322 /* Initialize the addrobj for dhcp addresses. */
1323 status = ipadm_create_addrobj(IPADM_ADDR_DHCP, argv[optind],
1324 &ipaddr);
1325 if (status != IPADM_SUCCESS) {
1326 die("Error in creating address object: %s",
1327 ipadm_status2str(status));
1328 }
1329 if (wait != NULL) {
1330 int32_t ipadm_wait;
1331
1332 if (strcmp(wait, "forever") == 0) {
1333 ipadm_wait = IPADM_DHCP_WAIT_FOREVER;
1334 } else {
1335 char *end;
1336 long timeout = strtol(wait, &end, 10);
1337
1338 if (*end != '\0' || timeout < 0)
1339 die("Invalid argument");
1340 ipadm_wait = (int32_t)timeout;
1341 }
1342 status = ipadm_set_wait_time(ipaddr, ipadm_wait);
1343 if (status != IPADM_SUCCESS) {
1344 die("Error in setting wait time: %s",
1345 ipadm_status2str(status));
1346 }
1347 }
1348 } else if (strcmp(atype, "addrconf") == 0) {
1349 if (dhcp_opt || s_opt) {
1350 die("Invalid arguments for type %s\nusage: %s",
1351 atype, use);
1352 }
1353
1354 /* Initialize the addrobj for dhcp addresses. */
1355 status = ipadm_create_addrobj(IPADM_ADDR_IPV6_ADDRCONF,
1356 argv[optind], &ipaddr);
1357 if (status != IPADM_SUCCESS) {
1358 die("Error in creating address object: %s",
1359 ipadm_status2str(status));
1360 }
1361 if (interface_id != NULL) {
1362 status = ipadm_set_interface_id(ipaddr, interface_id);
1363 if (status != IPADM_SUCCESS) {
1364 die("Error in setting interface ID: %s",
1365 ipadm_status2str(status));
1366 }
1367 }
1368 if (addrconf_arg)
1369 process_addrconf_addrargs(use, addrconf_arg);
1370 } else {
1371 die("Invalid address type %s", atype);
1372 }
1373
1374 status = ipadm_create_addr(iph, ipaddr, flags);
|
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
25 */
26 #include <arpa/inet.h>
27 #include <errno.h>
28 #include <getopt.h>
29 #include <inet/ip.h>
30 #include <inet/iptun.h>
31 #include <inet/tunables.h>
32 #include <libdladm.h>
33 #include <libdliptun.h>
34 #include <libdllink.h>
35 #include <libinetutil.h>
36 #include <libipadm.h>
37 #include <locale.h>
38 #include <netdb.h>
39 #include <netinet/in.h>
40 #include <ofmt.h>
41 #include <stdarg.h>
42 #include <stddef.h>
43 #include <stdio.h>
44 #include <stdlib.h>
72 /* interface management related sub-commands */
73 { "create-if", do_create_if, "\tcreate-if\t[-t] <interface>" },
74 { "disable-if", do_disable_if, "\tdisable-if\t-t <interface>" },
75 { "enable-if", do_enable_if, "\tenable-if\t-t <interface>" },
76 { "delete-if", do_delete_if, "\tdelete-if\t<interface>" },
77 { "show-if", do_show_if,
78 "\tshow-if\t\t[[-p] -o <field>,...] [<interface>]\n" },
79 { "set-ifprop", do_set_ifprop,
80 "\tset-ifprop\t[-t] -p <prop>=<value[,...]> -m <protocol> "
81 "<interface>" },
82 { "reset-ifprop", do_reset_ifprop,
83 "\treset-ifprop\t[-t] -p <prop> -m <protocol> <interface>" },
84 { "show-ifprop", do_show_ifprop,
85 "\tshow-ifprop\t[[-c] -o <field>,...] [-p <prop>,...]\n"
86 "\t\t\t[-m <protocol>] [interface]\n" },
87
88 /* address management related sub-commands */
89 { "create-addr", do_create_addr,
90 "\tcreate-addr\t[-t] -T static [-d] "
91 "-a{local|remote}=addr[/prefixlen]\n\t\t\t<addrobj>\n"
92 "\tcreate-addr\t[-t] -T dhcp [-w <seconds> | forever]\n"
93 "\t\t\t[-1] [-h <hostname>] <addrobj>\n"
94 "\tcreate-addr\t[-t] -T addrconf [-i interface-id]\n"
95 "\t\t\t[-p {stateful|stateless}={yes|no}] <addrobj>" },
96 { "down-addr", do_down_addr, "\tdown-addr\t[-t] <addrobj>" },
97 { "up-addr", do_up_addr, "\tup-addr\t\t[-t] <addrobj>" },
98 { "disable-addr", do_disable_addr, "\tdisable-addr\t-t <addrobj>" },
99 { "enable-addr", do_enable_addr, "\tenable-addr\t-t <addrobj>" },
100 { "refresh-addr", do_refresh_addr, "\trefresh-addr\t[-i] <addrobj>" },
101 { "delete-addr", do_delete_addr, "\tdelete-addr\t[-r] <addrobj>" },
102 { "show-addr", do_show_addr,
103 "\tshow-addr\t[[-p] -o <field>,...] [<addrobj>]\n" },
104 { "set-addrprop", do_set_addrprop,
105 "\tset-addrprop\t[-t] -p <prop>=<value[,...]> <addrobj>" },
106 { "reset-addrprop", do_reset_addrprop,
107 "\treset-addrprop\t[-t] -p <prop> <addrobj>" },
108 { "show-addrprop", do_show_addrprop,
109 "\tshow-addrprop\t[[-c] -o <field>,...] [-p <prop>,...] "
110 "<addrobj>\n" },
111
112 /* protocol properties related sub-commands */
113 { "set-prop", do_set_prop,
146 };
147
148 static const struct option set_ifprop_longopts[] = {
149 {"module", required_argument, 0, 'm' },
150 {"prop", required_argument, 0, 'p' },
151 {"temporary", no_argument, 0, 't' },
152 { 0, 0, 0, 0 }
153 };
154
155 static const struct option addr_misc_longopts[] = {
156 {"inform", no_argument, 0, 'i' },
157 {"release", no_argument, 0, 'r' },
158 {"temporary", no_argument, 0, 't' },
159 { 0, 0, 0, 0 }
160 };
161
162 static const struct option addr_longopts[] = {
163 {"address", required_argument, 0, 'a' },
164 {"down", no_argument, 0, 'd' },
165 {"interface-id", required_argument, 0, 'i' },
166 {"primary", no_argument, 0, '1' },
167 {"prop", required_argument, 0, 'p' },
168 {"reqhost", required_argument, 0, 'h' },
169 {"temporary", no_argument, 0, 't' },
170 {"type", required_argument, 0, 'T' },
171 {"wait", required_argument, 0, 'w' },
172 { 0, 0, 0, 0 }
173 };
174
175 static const struct option show_addr_longopts[] = {
176 {"parsable", no_argument, 0, 'p' },
177 {"output", required_argument, 0, 'o' },
178 { 0, 0, 0, 0 }
179 };
180
181 static const struct option show_if_longopts[] = {
182 {"parsable", no_argument, 0, 'p' },
183 {"output", required_argument, 0, 'o' },
184 { 0, 0, 0, 0 }
185 };
186
187 /* callback functions to print show-* subcommands output */
188 static ofmt_cb_t print_prop_cb;
619 {
620 show_prop_state_t *statep = arg;
621
622 statep->sps_pname = pname;
623 statep->sps_proto = proto;
624 statep->sps_status = IPADM_SUCCESS;
625 ofmt_print(statep->sps_ofmt, arg);
626
627 /*
628 * if an object is not found or operation is not supported then
629 * stop the walker.
630 */
631 if (statep->sps_status == IPADM_NOTFOUND ||
632 statep->sps_status == IPADM_NOTSUP)
633 return (_B_FALSE);
634 return (_B_TRUE);
635 }
636
637 /*
638 * Properties to be displayed is in `statep->sps_proplist'. If it is NULL,
639 * for all the properties for the specified object, display relevant
640 * information. Otherwise, for the selected property set, display relevant
641 * information
642 */
643 static void
644 show_properties(void *arg, int prop_class)
645 {
646 show_prop_state_t *statep = arg;
647 nvlist_t *nvl = statep->sps_proplist;
648 uint_t proto = statep->sps_proto;
649 nvpair_t *curr_nvp;
650 char *buf, *name;
651 ipadm_status_t status;
652
653 /* allocate sufficient buffer to hold a property value */
654 if ((buf = malloc(MAXPROPVALLEN)) == NULL)
655 die("insufficient memory");
656 statep->sps_propval = buf;
657
658 /* if no properties were specified, display all the properties */
659 if (nvl == NULL) {
660 (void) ipadm_walk_proptbl(proto, prop_class, show_property,
1245 }
1246 }
1247
1248 /*
1249 * Creates static, dhcp or addrconf addresses and associates the created
1250 * addresses with the specified address object name.
1251 */
1252 static void
1253 do_create_addr(int argc, char *argv[], const char *use)
1254 {
1255 ipadm_status_t status;
1256 int option;
1257 uint32_t flags =
1258 IPADM_OPT_PERSIST|IPADM_OPT_ACTIVE|IPADM_OPT_UP|IPADM_OPT_V46;
1259 char *cp;
1260 char *atype = NULL;
1261 char *static_arg = NULL;
1262 char *addrconf_arg = NULL;
1263 char *interface_id = NULL;
1264 char *wait = NULL;
1265 char *reqhost = NULL;
1266 boolean_t s_opt = _B_FALSE; /* static addr options */
1267 boolean_t auto_opt = _B_FALSE; /* Addrconf options */
1268 boolean_t dhcp_opt = _B_FALSE; /* dhcp options */
1269 boolean_t primary_opt = _B_FALSE; /* dhcp primary option */
1270
1271 opterr = 0;
1272 while ((option = getopt_long(argc, argv, ":1T:a:dh:i:p:w:t",
1273 addr_longopts, NULL)) != -1) {
1274 switch (option) {
1275 case '1':
1276 primary_opt = _B_TRUE;
1277 break;
1278 case 'T':
1279 atype = optarg;
1280 break;
1281 case 'a':
1282 static_arg = optarg;
1283 s_opt = _B_TRUE;
1284 break;
1285 case 'd':
1286 flags &= ~IPADM_OPT_UP;
1287 s_opt = _B_TRUE;
1288 break;
1289 case 'h':
1290 reqhost = optarg;
1291 break;
1292 case 'i':
1293 interface_id = optarg;
1294 auto_opt = _B_TRUE;
1295 break;
1296 case 'p':
1297 addrconf_arg = optarg;
1298 auto_opt = _B_TRUE;
1299 break;
1300 case 'w':
1301 wait = optarg;
1302 dhcp_opt = _B_TRUE;
1303 break;
1304 case 't':
1305 flags &= ~IPADM_OPT_PERSIST;
1306 break;
1307 default:
1308 die_opterr(optopt, option, use);
1309 }
1310 }
1311 if (atype == NULL || optind != (argc - 1)) {
1312 die("Invalid arguments\nusage: %s", use);
1313 } else if ((cp = strchr(argv[optind], '/')) == NULL ||
1314 strlen(++cp) == 0) {
1315 die("invalid address object name: %s\nusage: %s",
1316 argv[optind], use);
1317 }
1318
1319 /*
1320 * Allocate and initialize the addrobj based on the address type.
1321 */
1322 if (strcmp(atype, "static") == 0) {
1323 if (static_arg == NULL || auto_opt || dhcp_opt
1324 || reqhost != NULL || primary_opt) {
1325 die("Invalid arguments for type %s\nusage: %s",
1326 atype, use);
1327 }
1328 process_static_addrargs(use, static_arg, argv[optind]);
1329 } else if (strcmp(atype, "dhcp") == 0) {
1330 if (auto_opt || s_opt) {
1331 die("Invalid arguments for type %s\nusage: %s",
1332 atype, use);
1333 }
1334
1335 /* Initialize the addrobj for dhcp addresses. */
1336 status = ipadm_create_addrobj(IPADM_ADDR_DHCP, argv[optind],
1337 &ipaddr);
1338 if (status != IPADM_SUCCESS) {
1339 die("Error in creating address object: %s",
1340 ipadm_status2str(status));
1341 }
1342 if (wait != NULL) {
1343 int32_t ipadm_wait;
1344
1345 if (strcmp(wait, "forever") == 0) {
1346 ipadm_wait = IPADM_DHCP_WAIT_FOREVER;
1347 } else {
1348 char *end;
1349 long timeout = strtol(wait, &end, 10);
1350
1351 if (*end != '\0' || timeout < 0)
1352 die("Invalid argument");
1353 ipadm_wait = (int32_t)timeout;
1354 }
1355 status = ipadm_set_wait_time(ipaddr, ipadm_wait);
1356 if (status != IPADM_SUCCESS) {
1357 die("Error in setting wait time: %s",
1358 ipadm_status2str(status));
1359 }
1360 }
1361 if (primary_opt) {
1362 status = ipadm_set_primary(ipaddr, _B_TRUE);
1363 if (status != IPADM_SUCCESS) {
1364 die("Error in setting primary flag: %s",
1365 ipadm_status2str(status));
1366 }
1367 }
1368 if (reqhost != NULL) {
1369 status = ipadm_set_reqhost(ipaddr, reqhost);
1370 if (status != IPADM_SUCCESS) {
1371 die("Error in setting reqhost: %s",
1372 ipadm_status2str(status));
1373 }
1374 }
1375 } else if (strcmp(atype, "addrconf") == 0) {
1376 if (dhcp_opt || s_opt || reqhost != NULL || primary_opt) {
1377 die("Invalid arguments for type %s\nusage: %s",
1378 atype, use);
1379 }
1380
1381 /* Initialize the addrobj for ipv6-addrconf addresses. */
1382 status = ipadm_create_addrobj(IPADM_ADDR_IPV6_ADDRCONF,
1383 argv[optind], &ipaddr);
1384 if (status != IPADM_SUCCESS) {
1385 die("Error in creating address object: %s",
1386 ipadm_status2str(status));
1387 }
1388 if (interface_id != NULL) {
1389 status = ipadm_set_interface_id(ipaddr, interface_id);
1390 if (status != IPADM_SUCCESS) {
1391 die("Error in setting interface ID: %s",
1392 ipadm_status2str(status));
1393 }
1394 }
1395 if (addrconf_arg)
1396 process_addrconf_addrargs(use, addrconf_arg);
1397 } else {
1398 die("Invalid address type %s", atype);
1399 }
1400
1401 status = ipadm_create_addr(iph, ipaddr, flags);
|