Lines Matching refs:ncuh

316 nwam_ncu_get_parent_ncp_name(nwam_ncu_handle_t ncuh, char **parentnamep)
322 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_PARENT_NCP,
348 nwam_make_dlmgmt_ncu(nwam_ncu_handle_t ncuh, nwam_ncu_handle_t *copyncuhp)
354 if ((err = nwam_ncu_get_name(ncuh, &linkname)) != NWAM_SUCCESS)
359 if ((err = nwam_ncu_copy(ncuh, tmpname, copyncuhp)) != NWAM_SUCCESS) {
377 nwam_ncu_link_commit(nwam_ncu_handle_t ncuh, const char *ncpname,
388 if ((err = nwam_make_dlmgmt_ncu(ncuh, &copyncuh)) != NWAM_SUCCESS)
712 nwam_ncu_get_read_only(nwam_ncu_handle_t ncuh, boolean_t *readp)
717 assert(ncuh != NULL && readp != NULL);
719 if ((err = nwam_ncu_get_ncp(ncuh, &ncph)) != NWAM_SUCCESS)
949 nwam_make_ncu_from_dlmgmt(nwam_ncu_handle_t ncuh, const char *ncpname)
955 if ((err = nwam_ncu_name_to_typed_name(ncuh->nwh_name,
960 (void) strlcpy(ncuh->nwh_name, typedname, sizeof (ncuh->nwh_name));
969 err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_CLASS, &val);
972 (void) nwam_set_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_CLASS,
978 err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_TYPE, &val);
981 (void) nwam_set_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_TYPE,
987 if (nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_PARENT_NCP, &val)
990 (void) nwam_set_prop_value(ncuh->nwh_data,
1008 nwam_make_ncu_from_ipmgmt(nwam_ncu_handle_t ncuh, const char *ncpname)
1031 if ((err = nwam_get_prop_value(ncuh->nwh_data, IPADM_PROP_FAMILY,
1036 (void) strlcpy(ifname, ncuh->nwh_name, sizeof (ifname));
1040 (void) strlcpy(ncuh->nwh_name, typedname, sizeof (ncuh->nwh_name));
1065 (err = nwam_set_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IP_VERSION,
1067 (err = nwam_delete_prop(ncuh->nwh_data, IPADM_PROP_FAMILY))
1077 if (nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_TYPE, &vals)
1080 (void) nwam_set_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_TYPE,
1086 if (nwam_get_prop_value(ncuh->nwh_data, IPADM_PROP_CLASS, &vals)
1088 (void) nwam_set_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_CLASS,
1090 (void) nwam_delete_prop(ncuh->nwh_data, IPADM_PROP_CLASS);
1096 if (nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_PARENT_NCP, &vals)
1099 (void) nwam_set_prop_value(ncuh->nwh_data,
1106 if (nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_ENABLED, &vals)
1109 (void) nwam_set_prop_value(ncuh->nwh_data,
1194 (err = nwam_set_prop_value(ncuh->nwh_data,
1214 (err = nwam_set_prop_value(ncuh->nwh_data,
1252 (err = nwam_set_prop_value(ncuh->nwh_data,
1270 err = nwam_set_prop_value(ncuh->nwh_data,
1366 nwam_ncu_handle_t ncuh;
1373 if ((err = nwam_lists_to_handle(idp, objp, NWAM_OBJECT_TYPE_NCU, &ncuh))
1389 if (ncu_no_autoconf(ncpname, ncuh->nwh_name)) {
1398 err = nwam_make_ncu_from_dlmgmt(ncuh, ncpname);
1401 nwam_free(ncuh, B_FALSE);
1412 *cbobj = ncuh;
1416 nwam_free(ncuh, B_FALSE);
1423 nwam_ncu_handle_t ncuh;
1431 if ((err = nwam_lists_to_handle(idp, objp, NWAM_OBJECT_TYPE_NCU, &ncuh))
1439 if (ipadm_is_loopback(ncuh->nwh_name)) {
1454 if (dladm_name2info(dlh, ncuh->nwh_name, NULL, NULL, &dlclass, NULL)
1466 if (ncu_no_autoconf(ncpname, ncuh->nwh_name)) {
1471 err = nwam_make_ncu_from_ipmgmt(ncuh, ncpname);
1476 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_CLASS,
1491 *cbobj = ncuh;
1497 nwam_free(ncuh, B_FALSE);
1571 nwam_ncu_handle_t ncuh;
1599 if (nwam_ncu_read(ncph, name, type, 0, &ncuh) == NWAM_SUCCESS) {
1600 nwam_ncu_free(ncuh);
1773 nwam_ncu_add_data(nwam_ncu_handle_t ncuh, nvlist_t *data)
1777 assert(ncuh != NULL);
1779 if (ncuh->nwh_data != NULL)
1780 err = nvlist_merge(ncuh->nwh_data, data, 0);
1782 ncuh->nwh_data = data;
1788 nwam_ncu_get_data(nwam_ncu_handle_t ncuh, nvlist_t **data)
1790 assert(ncuh != NULL);
1792 *data = ncuh->nwh_data;
1798 nwam_ncu_get_name(nwam_ncu_handle_t ncuh, char **namep)
1802 assert(ncuh != NULL && namep != NULL);
1804 return (nwam_ncu_typed_name_to_name(ncuh->nwh_name, &type, namep));
1874 nwam_ncu_free(nwam_ncu_handle_t ncuh)
1876 nwam_free(ncuh, B_TRUE);
1923 nwam_ncu_delete_prop(nwam_ncu_handle_t ncuh, const char *propname,
1930 assert(ncuh != NULL && propname != NULL);
1932 if ((err = nwam_ncu_get_read_only(ncuh, &ro_ncu)) != NWAM_SUCCESS ||
1938 if ((err = nwam_ncu_is_advanced(ncuh, &advanced)) == NWAM_SUCCESS &&
1946 if ((err = nwam_dup_object_list(ncuh->nwh_data, &olddata))
1949 if ((err = nwam_delete_prop(ncuh->nwh_data, propname))
1951 nwam_free_object_list(ncuh->nwh_data);
1952 ncuh->nwh_data = olddata;
1955 if ((err = nwam_ncu_validate(ncuh, NULL)) != NWAM_SUCCESS) {
1956 nwam_free_object_list(ncuh->nwh_data);
1957 ncuh->nwh_data = olddata;
1966 nwam_ncu_set_prop_value(nwam_ncu_handle_t ncuh, const char *propname,
1973 assert(ncuh != NULL && propname != NULL && value != NULL);
1975 if ((err = nwam_ncu_get_read_only(ncuh, &ro_ncu)) != NWAM_SUCCESS ||
1981 if ((err = nwam_ncu_is_advanced(ncuh, &advanced)) == NWAM_SUCCESS &&
1985 err = nwam_ncu_get_ncp(ncuh, &ncph);
2007 if ((err = nwam_ncu_validate_prop(ncuh, propname, value))
2011 return (nwam_set_prop_value(ncuh->nwh_data, propname, value));
2015 nwam_ncu_get_prop_value(nwam_ncu_handle_t ncuh, const char *propname,
2018 assert(ncuh != NULL);
2020 return (nwam_get_prop_value(ncuh->nwh_data, propname, valuep));
2024 nwam_ncu_walk_props(nwam_ncu_handle_t ncuh,
2028 return (nwam_walk_props(ncuh, cb, data, flags, retp));
2032 nwam_ncu_get_ncp(nwam_ncu_handle_t ncuh, nwam_ncp_handle_t *ncphp)
2037 if ((err = nwam_ncu_get_parent_ncp_name(ncuh, &parentname))
2080 nwam_ncu_interface_commit(nwam_ncu_handle_t ncuh, const char *ncpname,
2110 (void) nvlist_add_string(ncuh->nwh_data, "ipadm-error",
2112 (void) nvlist_add_string(ncuh->nwh_data, "ipadm-call",
2117 if ((err = nwam_ncu_get_name(ncuh, &ifname)) != NWAM_SUCCESS)
2151 if ((err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IP_VERSION,
2176 if ((err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_TYPE,
2186 if ((err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_PARENT_NCP,
2196 if ((err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_ENABLED,
2206 err = nwam_get_prop_value(ncuh->nwh_data,
2220 err = nwam_get_prop_value(ncuh->nwh_data,
2238 err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IPV4_ADDRSRC,
2272 err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IPV4_ADDR,
2309 err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IPV6_ADDRSRC,
2350 err = nwam_get_prop_value(ncuh->nwh_data, NWAM_NCU_PROP_IPV6_ADDR,
2391 (void) nvlist_add_string(ncuh->nwh_data, "ipadm-error",
2393 (void) nvlist_add_string(ncuh->nwh_data, "ipadm-call", fnstr);
2422 (void) nwam_request_action(ncuh->nwh_object_type, ncuh->nwh_name,
2429 nwam_ncu_commit(nwam_ncu_handle_t ncuh, uint64_t flags)
2436 assert(ncuh != NULL && ncuh->nwh_data != NULL);
2438 if ((err = nwam_ncu_get_read_only(ncuh, &read_only)) != NWAM_SUCCESS)
2443 if ((err = nwam_ncu_is_advanced(ncuh, &advanced)) == NWAM_SUCCESS &&
2447 if ((err = nwam_ncu_validate(ncuh, NULL)) != NWAM_SUCCESS ||
2448 (err = nwam_ncu_typed_name_to_name(ncuh->nwh_name, &type, &ncuname))
2450 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2458 err = nwam_ncu_link_commit(ncuh, ncpname, flags);
2460 err = nwam_ncu_interface_commit(ncuh, ncpname, flags);
2470 nwam_ncu_get_ncu_type(nwam_ncu_handle_t ncuh, nwam_ncu_type_t *typep)
2476 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_TYPE, &typeval))
2490 nwam_ncu_get_ncu_class(nwam_ncu_handle_t ncuh, nwam_ncu_class_t *classp)
2496 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_CLASS,
2512 nwam_ncu_is_manual(nwam_ncu_handle_t ncuh, boolean_t *manualp)
2518 assert(ncuh != NULL);
2520 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_ACTIVATION_MODE,
2537 nwam_ncu_is_enabled(nwam_ncu_handle_t ncuh, boolean_t *enabledp)
2542 assert(ncuh != NULL);
2544 if ((err = nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_ENABLED,
2556 nwam_ncu_enable(nwam_ncu_handle_t ncuh)
2563 assert(ncuh != NULL);
2570 if ((err = nwam_ncu_get_read_only(ncuh, &read_only)) != NWAM_SUCCESS ||
2571 (err = nwam_ncu_is_advanced(ncuh, &advanced)) != NWAM_SUCCESS)
2577 if ((err = nwam_ncu_get_ncu_type(ncuh, &type)) != NWAM_SUCCESS)
2581 if ((err = nwam_ncu_is_manual(ncuh, &manual)) != NWAM_SUCCESS)
2588 if ((err = nwam_ncu_is_enabled(ncuh, &enabled)) != NWAM_SUCCESS ||
2589 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2597 err = nwam_enable(ncpname, ncuh);
2607 nwam_ncu_disable(nwam_ncu_handle_t ncuh)
2614 assert(ncuh != NULL);
2621 if ((err = nwam_ncu_get_read_only(ncuh, &read_only)) != NWAM_SUCCESS ||
2622 (err = nwam_ncu_is_advanced(ncuh, &advanced)) != NWAM_SUCCESS)
2628 if ((err = nwam_ncu_get_ncu_type(ncuh, &type)) != NWAM_SUCCESS)
2632 if ((err = nwam_ncu_is_manual(ncuh, &manual)) != NWAM_SUCCESS)
2639 if ((err = nwam_ncu_is_enabled(ncuh, &enabled)) != NWAM_SUCCESS ||
2640 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2648 err = nwam_disable(ncpname, ncuh);
2654 nwam_ncu_offline(nwam_ncu_handle_t ncuh)
2660 assert(ncuh != NULL);
2663 if ((err = nwam_ncu_is_enabled(ncuh, &enabled)) != NWAM_SUCCESS ||
2664 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2671 err = nwam_offline(ncpname, ncuh);
2677 nwam_ncu_online(nwam_ncu_handle_t ncuh)
2683 assert(ncuh != NULL);
2686 if ((err = nwam_ncu_is_enabled(ncuh, &enabled)) != NWAM_SUCCESS ||
2687 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2694 err = nwam_online(ncpname, ncuh);
2700 nwam_ncu_destroy(nwam_ncu_handle_t ncuh, uint64_t flags)
2708 assert(ncuh != NULL);
2710 if ((err = nwam_ncu_get_read_only(ncuh, &read_only)) != NWAM_SUCCESS)
2715 if ((err = nwam_ncu_is_advanced(ncuh, &advanced)) == NWAM_SUCCESS &&
2719 if ((err = nwam_ncu_get_ncu_type(ncuh, &type)) != NWAM_SUCCESS ||
2720 (err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
2729 if ((err = nwam_make_dlmgmt_ncu(ncuh, &copyncuh))
2747 * ncuh is not freed. However, if the flag is not specified,
2748 * copyncuh has been freed. ncuh must also be freed. On
2755 nwam_ncu_free(ncuh);
2765 if ((err = nwam_ncu_get_name(ncuh, &ifname)) != NWAM_SUCCESS)
2786 (void) nwam_request_action(ncuh->nwh_object_type,
2787 ncuh->nwh_name, ncpname, NWAM_ACTION_DESTROY);
2789 /* If NWAM_FLAG_DO_NOT_FREE is not specified, free ncuh */
2791 nwam_ncu_free(ncuh);
2836 nwam_ncu_validate_prop_membership(nwam_ncu_handle_t ncuh, const char *propname)
2844 if (nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_TYPE, &typeval)
2854 if (nwam_ncu_get_prop_value(ncuh, NWAM_NCU_PROP_CLASS, &classval)
2886 nwam_ncu_validate_prop(nwam_ncu_handle_t ncuh, const char *propname,
2891 assert(ncuh != NULL && propname != NULL);
2894 if ((err = nwam_ncu_validate_prop_membership(ncuh, propname))
2898 return (nwam_validate_prop(ncu_prop_table, ncuh, propname, value));
3069 nwam_ncu_validate(nwam_ncu_handle_t ncuh, const char **errpropp)
3071 return (nwam_validate(ncu_prop_table, ncuh, errpropp));
3100 nwam_ncu_get_state(nwam_ncu_handle_t ncuh, nwam_state_t *statep,
3107 assert(ncuh != NULL);
3109 if ((err = nwam_ncu_get_ncp(ncuh, &ncph)) != NWAM_SUCCESS)
3117 if ((err = nwam_ncu_get_parent_ncp_name(ncuh, &ncpname))
3121 err = nwam_request_state(NWAM_OBJECT_TYPE_NCU, ncuh->nwh_name, ncpname,
3134 nwam_ncu_is_advanced(nwam_ncu_handle_t ncuh, boolean_t *advancedp)
3141 if ((err = nwam_ncu_get_ncu_type(ncuh, &type)) != NWAM_SUCCESS ||
3142 (err = nwam_ncu_get_ncu_class(ncuh, &class)) != NWAM_SUCCESS)
3165 nwam_ncu_handle_t ncuh = NULL;
3199 DATALINK_CLASS_PHYS, 0, &ncuh) == NWAM_SUCCESS) {
3200 (void) nwam_ncu_commit(ncuh, 0);
3201 nwam_ncu_free(ncuh);
3224 nwam_ncu_handle_t ncuh;
3241 if (nwam_ncu_read(ncph, arg->ncu_name, arg->ncu_type, 0, &ncuh)
3246 nwam_ncu_free(ncuh);
3249 err = arg->ncu_online ? nwam_ncu_online(ncuh) : nwam_ncu_offline(ncuh);
3255 if (nwam_ncu_get_state(ncuh, &state, &aux)
3262 nwam_ncu_free(ncuh);
3265 nwam_ncu_free(ncuh);
3268 nwam_ncu_free(ncuh);