--- dhcp6c_script.c.patched 2025-03-26 18:11:52.914835315 -0700 +++ dhcp6c_script.c 2025-03-26 18:26:10.503421359 -0700 @@ -71,6 +71,7 @@ static char nispname_str[] = "new_nisp_name"; static char bcmcsserver_str[] = "new_bcmcs_servers"; static char bcmcsname_str[] = "new_bcmcs_name"; +static char iapd_str[] = "new_iapd"; int client6_script(scriptpath, state, optinfo) @@ -83,9 +84,10 @@ int nisservers, nisnamelen; int nispservers, nispnamelen; int bcmcsservers, bcmcsnamelen; + int iapdservers; char **envp, *s; char reason[] = "REASON=NBI"; - struct dhcp6_listval *v; + struct dhcp6_listval *v, *siav; pid_t pid, wpid; /* if a script is not specified, do nothing */ @@ -104,6 +106,7 @@ nispnamelen = 0; bcmcsservers = 0; bcmcsnamelen = 0; + iapdservers = 0; envc = 2; /* we at least include the reason and the terminator */ /* count the number of variables */ @@ -115,6 +118,9 @@ dnsnamelen += v->val_vbuf.dv_len; } envc += dnsnamelen ? 1 : 0; + for (v = TAILQ_FIRST(&optinfo->iapd_list); v; v = TAILQ_NEXT(v, link)) + iapdservers++; + envc += iapdservers ? 1 : 0; for (v = TAILQ_FIRST(&optinfo->ntp_list); v; v = TAILQ_NEXT(v, link)) ntpservers++; envc += ntpservers ? 1 : 0; @@ -194,6 +200,35 @@ strlcat(s, " ", elen); } } + if (iapdservers) { + elen = sizeof (iapd_str) + + (INET6_ADDRSTRLEN + 1) * iapdservers + 1; + if ((s = envp[i++] = malloc(elen)) == NULL) { + debug_printf(LOG_NOTICE, FNAME, + "failed to allocate strings for PD"); + ret = -1; + goto clean; + } + memset(s, 0, elen); + snprintf(s, elen, "%s=", iapd_str); + for (v = TAILQ_FIRST(&optinfo->iapd_list); v; + v = TAILQ_NEXT(v, link)) { + char *addr,*addr2 ; + for (siav = TAILQ_FIRST(&v->sublist); siav; + siav = TAILQ_NEXT(siav, link)) { + switch (siav->type) { + case DHCP6_LISTVAL_PREFIX6: + addr = in6addr2str(&siav->val_prefix6.addr, 0) ; + strlcat(s, addr, elen); + sprintf(addr,"/%d,pltime=%lu,vltime=%lu", + siav->uv.uv_prefix6.plen, siav->uv.uv_prefix6.pltime, + siav->uv.uv_prefix6.vltime) ; + strlcat(s, addr, elen); + strlcat(s, " ", elen); + } + } + } + } if (ntpservers) { elen = sizeof (ntpserver_str) + (INET6_ADDRSTRLEN + 1) * ntpservers + 1;