Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.
@@ -20,10 +20,11 @@
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
*/
#include <assert.h>
#include <ctype.h>
#include <libgen.h>
@@ -37,10 +38,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <libdladm.h>
+#include <libipadm.h>
#include "libnwam_impl.h"
#include <libnwam_priv.h>
#include <libnwam.h>
@@ -71,10 +73,11 @@
static nwam_error_t valid_link_autopush(nwam_value_t);
static nwam_error_t valid_link_mtu(nwam_value_t);
static nwam_error_t valid_ip_version(nwam_value_t);
static nwam_error_t valid_addrsrc_v4(nwam_value_t);
static nwam_error_t valid_addrsrc_v6(nwam_value_t);
+static nwam_error_t valid_reqhost(nwam_value_t);
struct nwam_prop_table_entry ncu_prop_table_entries[] = {
{NWAM_NCU_PROP_TYPE, NWAM_VALUE_TYPE_UINT64, B_FALSE, 1, 1, valid_type,
"specifies the NCU type - valid values are \'datalink\' and \'ip\'",
NWAM_FLAG_NCU_TYPE_ALL, NWAM_FLAG_NCU_CLASS_ALL},
@@ -147,11 +150,20 @@
"specifies static IPv6 host address(es)",
NWAM_FLAG_NCU_TYPE_INTERFACE, NWAM_FLAG_NCU_CLASS_ALL_INTERFACE},
{NWAM_NCU_PROP_IPV6_DEFAULT_ROUTE, NWAM_VALUE_TYPE_STRING, B_FALSE, 0,
1, nwam_valid_route_v6,
"specifies per-interface default IPv6 route",
- NWAM_FLAG_NCU_TYPE_INTERFACE, NWAM_FLAG_NCU_CLASS_ALL_INTERFACE}
+ NWAM_FLAG_NCU_TYPE_INTERFACE, NWAM_FLAG_NCU_CLASS_ALL_INTERFACE},
+ {NWAM_NCU_PROP_IP_PRIMARY, NWAM_VALUE_TYPE_BOOLEAN, B_FALSE, 0,
+ 1, nwam_valid_boolean,
+ "specifies the status of an interface as primary for the delivery"
+ " of client-wide configuration data",
+ NWAM_FLAG_NCU_TYPE_INTERFACE, NWAM_FLAG_NCU_CLASS_ALL_INTERFACE},
+ {NWAM_NCU_PROP_IP_REQHOST, NWAM_VALUE_TYPE_STRING, B_FALSE, 0,
+ 1, valid_reqhost,
+ "specifies a requested hostname for the interface",
+ NWAM_FLAG_NCU_TYPE_INTERFACE, NWAM_FLAG_NCU_CLASS_ALL_INTERFACE},
};
#define NWAM_NUM_NCU_PROPS (sizeof (ncu_prop_table_entries) / \
sizeof (*ncu_prop_table_entries))
@@ -1646,10 +1658,21 @@
return (NWAM_SUCCESS);
else
return (NWAM_ENTITY_INVALID_VALUE);
}
+static nwam_error_t
+valid_reqhost(nwam_value_t value)
+{
+ char *hostname;
+
+ if (nwam_value_get_string(value, &hostname) != NWAM_SUCCESS)
+ return (NWAM_ENTITY_INVALID_VALUE);
+ return (ipadm_is_valid_hostname(hostname) ? NWAM_SUCCESS
+ : NWAM_ENTITY_INVALID_VALUE);
+}
+
/* ARGSUSED0 */
static nwam_error_t
valid_link_mtu(nwam_value_t value)
{
return (NWAM_SUCCESS);