Print this page
7388 Support DHCP Client FQDN. Allow IAID/DUID for all v4.
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2016 Argo Technologie SA.
+ * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
*/
/*
* Contains DB walker functions, which are of type `db_wfunc_t';
*
*** 906,916 ****
* linklocal and non-linklocal nodes
*/
if (strcmp(head->am_aobjname,
nodep->am_aobjname) == 0 &&
(head->am_atype != IPADM_ADDR_IPV6_ADDRCONF ||
! head->am_linklocal == nodep->am_linklocal))
break;
}
if (head != NULL) {
/* update the node */
--- 907,918 ----
* linklocal and non-linklocal nodes
*/
if (strcmp(head->am_aobjname,
nodep->am_aobjname) == 0 &&
(head->am_atype != IPADM_ADDR_IPV6_ADDRCONF ||
! head->ipmgmt_am_linklocal ==
! nodep->ipmgmt_am_linklocal))
break;
}
if (head != NULL) {
/* update the node */
*** 918,931 ****
sizeof (head->am_ifname));
head->am_lnum = nodep->am_lnum;
head->am_family = nodep->am_family;
head->am_flags = nodep->am_flags;
head->am_atype = nodep->am_atype;
! if (head->am_atype == IPADM_ADDR_IPV6_ADDRCONF) {
! head->am_ifid = nodep->am_ifid;
! head->am_linklocal = nodep->am_linklocal;
! }
} else {
for (head = aobjmap.aobjmap_head; head != NULL;
head = head->am_next) {
if (strcmp(head->am_ifname,
nodep->am_ifname) == 0)
--- 920,931 ----
sizeof (head->am_ifname));
head->am_lnum = nodep->am_lnum;
head->am_family = nodep->am_family;
head->am_flags = nodep->am_flags;
head->am_atype = nodep->am_atype;
! (void) memcpy(&head->am_atype_cache, &nodep->am_atype_cache,
! sizeof (head->am_atype_cache));
} else {
for (head = aobjmap.aobjmap_head; head != NULL;
head = head->am_next) {
if (strcmp(head->am_ifname,
nodep->am_ifname) == 0)
*** 1066,1080 ****
(void) snprintf(strval, IPMGMT_STRSIZE, "%d", np->am_atype);
if ((err = nvlist_add_string(*nvl, ATYPE, strval)) != 0)
goto fail;
! if (np->am_atype == IPADM_ADDR_IPV6_ADDRCONF) {
struct sockaddr_in6 *in6;
! in6 = (struct sockaddr_in6 *)&np->am_ifid;
! if (np->am_linklocal &&
IN6_IS_ADDR_UNSPECIFIED(&in6->sin6_addr)) {
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
"default")) != 0)
goto fail;
} else {
--- 1066,1081 ----
(void) snprintf(strval, IPMGMT_STRSIZE, "%d", np->am_atype);
if ((err = nvlist_add_string(*nvl, ATYPE, strval)) != 0)
goto fail;
! switch (np->am_atype) {
! case IPADM_ADDR_IPV6_ADDRCONF: {
struct sockaddr_in6 *in6;
! in6 = &np->ipmgmt_am_ifid;
! if (np->ipmgmt_am_linklocal &&
IN6_IS_ADDR_UNSPECIFIED(&in6->sin6_addr)) {
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
"default")) != 0)
goto fail;
} else {
*** 1085,1098 ****
}
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
strval)) != 0)
goto fail;
}
! } else {
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
"")) != 0)
goto fail;
}
return (err);
fail:
nvlist_free(*nvl);
return (err);
--- 1086,1110 ----
}
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
strval)) != 0)
goto fail;
}
! }
! break;
! case IPADM_ADDR_DHCP: {
! if (np->ipmgmt_am_reqhost &&
! *np->ipmgmt_am_reqhost != '\0' &&
! (err = nvlist_add_string(*nvl, IPADM_NVP_REQHOST,
! np->ipmgmt_am_reqhost)) != 0)
! goto fail;
! }
! /* FALLTHRU */
! default:
if ((err = nvlist_add_string(*nvl, IPADM_NVP_IPNUMADDR,
"")) != 0)
goto fail;
+ break;
}
return (err);
fail:
nvlist_free(*nvl);
return (err);
*** 1136,1155 ****
node.am_flags = atoi(strval);
} else if (strcmp(ATYPE, name) == 0) {
node.am_atype = (ipadm_addr_type_t)atoi(strval);
} else if (strcmp(IPADM_NVP_IPNUMADDR, name) == 0) {
if (node.am_atype == IPADM_ADDR_IPV6_ADDRCONF) {
! in6 = (struct sockaddr_in6 *)&node.am_ifid;
if (strcmp(strval, "default") == 0) {
! bzero(in6, sizeof (node.am_ifid));
! node.am_linklocal = B_TRUE;
} else {
(void) inet_pton(AF_INET6, strval,
&in6->sin6_addr);
if (IN6_IS_ADDR_UNSPECIFIED(
&in6->sin6_addr))
! node.am_linklocal = B_TRUE;
}
}
}
}
--- 1148,1167 ----
node.am_flags = atoi(strval);
} else if (strcmp(ATYPE, name) == 0) {
node.am_atype = (ipadm_addr_type_t)atoi(strval);
} else if (strcmp(IPADM_NVP_IPNUMADDR, name) == 0) {
if (node.am_atype == IPADM_ADDR_IPV6_ADDRCONF) {
! in6 = &node.ipmgmt_am_ifid;
if (strcmp(strval, "default") == 0) {
! bzero(in6, sizeof (node.ipmgmt_am_ifid));
! node.ipmgmt_am_linklocal = B_TRUE;
} else {
(void) inet_pton(AF_INET6, strval,
&in6->sin6_addr);
if (IN6_IS_ADDR_UNSPECIFIED(
&in6->sin6_addr))
! node.ipmgmt_am_linklocal = B_TRUE;
}
}
}
}