summaryrefslogtreecommitdiff
path: root/usr/src/lib/libdladm
diff options
context:
space:
mode:
authorSowmini Varadhan <Sowmini.Varadhan@oracle.COM>2010-07-01 17:10:52 -0400
committerSowmini Varadhan <Sowmini.Varadhan@oracle.COM>2010-07-01 17:10:52 -0400
commit550b6e4083768ca350e9e7c3a1ebbf720b23dcad (patch)
tree68629051e97e6173c4b53d2483015eeea30cacbc /usr/src/lib/libdladm
parentbf7fda8965eb0f1d22b8e7bf1684b99227cd2b64 (diff)
downloadillumos-joyent-550b6e4083768ca350e9e7c3a1ebbf720b23dcad.tar.gz
PSARC 2010/166 layer-3 net properties for exclusive-IP zones
6944327 need to support address and defrouter resources for exclusive-IP zones
Diffstat (limited to 'usr/src/lib/libdladm')
-rw-r--r--usr/src/lib/libdladm/common/linkprop.c16
1 files changed, 13 insertions, 3 deletions
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;