From 550b6e4083768ca350e9e7c3a1ebbf720b23dcad Mon Sep 17 00:00:00 2001 From: Sowmini Varadhan Date: Thu, 1 Jul 2010 17:10:52 -0400 Subject: PSARC 2010/166 layer-3 net properties for exclusive-IP zones 6944327 need to support address and defrouter resources for exclusive-IP zones --- usr/src/lib/libdladm/common/linkprop.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'usr/src/lib/libdladm') diff --git a/usr/src/lib/libdladm/common/linkprop.c b/usr/src/lib/libdladm/common/linkprop.c index e37ab46f11..b9f38012ed 100644 --- a/usr/src/lib/libdladm/common/linkprop.c +++ b/usr/src/lib/libdladm/common/linkprop.c @@ -4503,11 +4503,13 @@ dladm_linkprop_is_set(dladm_handle_t handle, datalink_id_t linkid, uint_t valcnt = DLADM_MAX_PROP_VALCNT; int i; dladm_status_t status = DLADM_STATUS_OK; + size_t bufsize; *is_set = B_FALSE; - if ((buf = malloc((sizeof (char *) + DLADM_PROP_VAL_MAX) * - DLADM_MAX_PROP_VALCNT)) == NULL) + bufsize = (sizeof (char *) + DLADM_PROP_VAL_MAX) * + DLADM_MAX_PROP_VALCNT; + if ((buf = calloc(1, bufsize)) == NULL) return (DLADM_STATUS_NOMEM); propvals = (char **)(void *)buf; @@ -4522,7 +4524,15 @@ dladm_linkprop_is_set(dladm_handle_t handle, datalink_id_t linkid, goto done; } - if ((strcmp(prop_name, "pool") == 0) && (strlen(*propvals) != 0)) { + /* + * valcnt is always set to 1 by get_pool(), hence we need to check + * for a non-null string to see if it is set. For protection and + * allowed-ips, we can check either the *propval or the valcnt. + */ + if ((strcmp(prop_name, "pool") == 0 || + strcmp(prop_name, "protection") == 0 || + strcmp(prop_name, "allowed-ips") == 0) && + (strlen(*propvals) != 0)) { *is_set = B_TRUE; } else if ((strcmp(prop_name, "cpus") == 0) && (valcnt != 0)) { *is_set = B_TRUE; -- cgit v1.2.3