aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSUZUKI, Shinsuke <suz@kame.net>2006-07-30 10:24:19 +0000
committerSUZUKI, Shinsuke <suz@kame.net>2006-07-30 10:24:19 +0000
commitd9f9f7c2dcd7bfe811180c5d81bead4559a4fb2e (patch)
tree28c050fe90de341a51f758995cf2f982ff76333b
parent0f9655313ebb4d789165c167262d8becba6e5d01 (diff)
* supported the following options:
NIS server option, NIS domain option (RFC3898) NIS+ server option, NIS+ domain option (RFC3898) BCMCS server option, BCMCS domain option (RFC4280) * changed the name of the enviromental variable for SIP server address (new_sip_servers). * removed a configure option to control the NTP option number. (since one year has been passed since its official assignment)
-rw-r--r--CHANGES10
-rw-r--r--Makefile.in7
-rw-r--r--cfparse.y138
-rw-r--r--cftoken.l6
-rw-r--r--common.c562
-rw-r--r--config.c250
-rw-r--r--config.h9
-rwxr-xr-xconfigure134
-rw-r--r--configure.in75
-rw-r--r--dhcp6.h50
-rw-r--r--dhcp6c.824
-rw-r--r--dhcp6c.c2
-rw-r--r--dhcp6c.conf.554
-rw-r--r--dhcp6c_script.c158
-rw-r--r--dhcp6s.816
-rw-r--r--dhcp6s.c49
-rw-r--r--dhcp6s.conf.545
17 files changed, 939 insertions, 650 deletions
diff --git a/CHANGES b/CHANGES
index cbf4a58..8c100e3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+2006-07-30 SUZUKI, Shinsuke <suz@kame.net>
+ * supported the following options:
+ NIS server option, NIS domain option (RFC3898)
+ NIS+ server option, NIS+ domain option (RFC3898)
+ BCMCS server option, BCMCS domain option (RFC4280)
+ * changed the name of the enviromental variable for SIP server
+ address (new_sip_servers).
+ * removed a configure option to control the NTP option number.
+ (since one year has been passed since its official assignment)
+
2006-07-29 SUZUKI, Shinsuke <suz@kame.net>
* dhcp6s and dhcp6relay dumps process-id file, like dhcp6c
diff --git a/Makefile.in b/Makefile.in
index e82b5f9..352133b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -25,7 +25,7 @@
# SUCH DAMAGE.
#
-# $Id: Makefile.in,v 1.8 2006-07-13 14:19:51 suzsuz Exp $
+# $Id: Makefile.in,v 1.9 2006-07-30 10:24:19 suzsuz Exp $
# $KAME: Makefile.in,v 1.45 2005/10/16 16:25:38 suz Exp $
#
@@ -51,11 +51,6 @@ bindir= @bindir@
sbindir=@sbindir@
mandir= @mandir@
-CFLAGS+= @DHCPOPT_DNS@ @DH6OPT_DNSNAME@ \
- @DH6OPT_IA_PD@ @DH6OPT_IA_PD_PREFIX@ \
- @DH6OPT_REFRESHTIME@ \
- -DCONF_DH6OPT_NTP=@dhcpopt_ntp@ \
-
GENSRCS=cfparse.c cftoken.c
CLIENTOBJS= dhcp6c.o common.o config.o prefixconf.o dhcp6c_ia.o timer.o \
dhcp6c_script.o if.o base64.o auth.o dhcp6_ctl.o addrconf.o lease.o \
diff --git a/cfparse.y b/cfparse.y
index dcd7a28..4385b39 100644
--- a/cfparse.y
+++ b/cfparse.y
@@ -88,6 +88,9 @@ static struct cf_namelist *authinfolist_head, *keylist_head;
static struct cf_namelist *ianalist_head;
struct cf_list *cf_dns_list, *cf_dns_name_list, *cf_ntp_list;
struct cf_list *cf_sip_list, *cf_sip_name_list;
+struct cf_list *cf_nis_list, *cf_nis_name_list;
+struct cf_list *cf_nisp_list, *cf_nisp_name_list;
+struct cf_list *cf_bcmcs_list, *cf_bcmcs_name_list;
long long cf_refreshtime = -1;
extern int yylex __P((void));
@@ -106,6 +109,9 @@ static void cleanup_cflist __P((struct cf_list *));
%token HOST HOSTNAME DUID
%token OPTION RAPID_COMMIT IA_PD DNS_SERVERS DNS_NAME NTP_SERVERS REFRESHTIME
%token SIP_SERVERS SIP_NAME
+%token NIS_SERVERS NIS_NAME
+%token NISP_SERVERS NISP_NAME
+%token BCMCS_SERVERS BCMCS_NAME
%token INFO_ONLY
%token SCRIPT DELAYEDKEY
%token AUTHENTICATION PROTOCOL ALGORITHM DELAYED RECONFIG HMACMD5 MONOCOUNTER
@@ -238,6 +244,78 @@ option_statement:
cf_sip_name_list->tail = l->tail;
}
}
+ | OPTION NIS_SERVERS address_list EOS
+ {
+ if (cf_nis_list == NULL)
+ cf_nis_list = $3;
+ else {
+ cf_nis_list->tail->next = $3;
+ cf_nis_list->tail = $3->tail;
+ }
+ }
+ | OPTION NIS_NAME QSTRING EOS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, CFLISTENT_GENERIC, $3, NULL);
+
+ if (cf_nis_name_list == NULL) {
+ cf_nis_name_list = l;
+ cf_nis_name_list->tail = l;
+ cf_nis_name_list->next = NULL;
+ } else {
+ cf_nis_name_list->tail->next = l;
+ cf_nis_name_list->tail = l->tail;
+ }
+ }
+ | OPTION NISP_SERVERS address_list EOS
+ {
+ if (cf_nisp_list == NULL)
+ cf_nisp_list = $3;
+ else {
+ cf_nisp_list->tail->next = $3;
+ cf_nisp_list->tail = $3->tail;
+ }
+ }
+ | OPTION NISP_NAME QSTRING EOS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, CFLISTENT_GENERIC, $3, NULL);
+
+ if (cf_nisp_name_list == NULL) {
+ cf_nisp_name_list = l;
+ cf_nisp_name_list->tail = l;
+ cf_nisp_name_list->next = NULL;
+ } else {
+ cf_nisp_name_list->tail->next = l;
+ cf_nisp_name_list->tail = l->tail;
+ }
+ }
+ | OPTION BCMCS_SERVERS address_list EOS
+ {
+ if (cf_bcmcs_list == NULL)
+ cf_bcmcs_list = $3;
+ else {
+ cf_bcmcs_list->tail->next = $3;
+ cf_bcmcs_list->tail = $3->tail;
+ }
+ }
+ | OPTION BCMCS_NAME QSTRING EOS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, CFLISTENT_GENERIC, $3, NULL);
+
+ if (cf_bcmcs_name_list == NULL) {
+ cf_bcmcs_name_list = l;
+ cf_bcmcs_name_list->tail = l;
+ cf_bcmcs_name_list->next = NULL;
+ } else {
+ cf_bcmcs_name_list->tail->next = l;
+ cf_bcmcs_name_list->tail = l->tail;
+ }
+ }
| OPTION REFRESHTIME NUMBER EOS
{
if (cf_refreshtime == -1) {
@@ -618,6 +696,54 @@ dhcpoption:
/* currently no value */
$$ = l;
}
+ | NIS_SERVERS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_NIS, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
+ | NIS_NAME
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_NISNAME, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
+ | NISP_SERVERS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_NISP, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
+ | NISP_NAME
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_NISPNAME, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
+ | BCMCS_SERVERS
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_BCMCS, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
+ | BCMCS_NAME
+ {
+ struct cf_list *l;
+
+ MAKE_CFLIST(l, DHCPOPT_BCMCSNAME, NULL, NULL);
+ /* currently no value */
+ $$ = l;
+ }
;
rangeparam:
@@ -1121,6 +1247,18 @@ cleanup()
cf_dns_name_list = NULL;
cleanup_cflist(cf_ntp_list);
cf_ntp_list = NULL;
+ cleanup_cflist(cf_nis_list);
+ cf_nis_list = NULL;
+ cleanup_cflist(cf_nis_name_list);
+ cf_nis_name_list = NULL;
+ cleanup_cflist(cf_nisp_list);
+ cf_nisp_list = NULL;
+ cleanup_cflist(cf_nisp_name_list);
+ cf_nisp_name_list = NULL;
+ cleanup_cflist(cf_bcmcs_list);
+ cf_bcmcs_list = NULL;
+ cleanup_cflist(cf_bcmcs_name_list);
+ cf_bcmcs_name_list = NULL;
}
static void
diff --git a/cftoken.l b/cftoken.l
index 1b6d47e..12487de 100644
--- a/cftoken.l
+++ b/cftoken.l
@@ -198,6 +198,12 @@ ecl \}
<S_CNF>sip-server-address { DECHO; return (SIP_SERVERS); }
<S_CNF>sip-server-domain-name { DECHO; return (SIP_NAME); }
<S_CNF>ntp-servers { DECHO; return (NTP_SERVERS); }
+<S_CNF>nis-server-address { DECHO; return (NIS_SERVERS); }
+<S_CNF>nis-server-domain-name { DECHO; return (NIS_NAME); }
+<S_CNF>nisp-server-address { DECHO; return (NISP_SERVERS); }
+<S_CNF>nisp-server-domain-name { DECHO; return (NISP_NAME); }
+<S_CNF>bcmcs-server-address { DECHO; return (BCMCS_SERVERS); }
+<S_CNF>bcmcs-server-domain-name { DECHO; return (BCMCS_NAME); }
<S_CNF>refreshtime { DECHO; return (REFRESHTIME); }
/* generic options */
diff --git a/common.c b/common.c
index 4419960..2040b02 100644
--- a/common.c
+++ b/common.c
@@ -349,6 +349,178 @@ dhcp6_vbuf_cmp(vb1, vb2)
return (memcmp(vb1->dv_buf, vb2->dv_buf, vb1->dv_len));
}
+static int
+dhcp6_get_addr(optlen, cp, type, list)
+ int optlen;
+ void *cp;
+ dhcp6_listval_type_t type;
+ struct dhcp6_list *list;
+{
+ void *val;
+ int option;
+
+ if (optlen % sizeof(struct in6_addr) || optlen == 0) {
+ dprintf(LOG_INFO, FNAME,
+ "malformed DHCP option: type %d, len %d", type, optlen);
+ return -1;
+ }
+ for (val = cp; val < cp + optlen; val += sizeof(struct in6_addr)) {
+ struct in6_addr valaddr;
+
+ memcpy(&valaddr, val, sizeof(valaddr));
+ if (dhcp6_find_listval(list,
+ DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
+ dprintf(LOG_INFO, FNAME, "duplicated %s address (%s)",
+ dhcp6optstr(type), in6addr2str(&valaddr, 0));
+ continue;
+ }
+
+ if (dhcp6_add_listval(list, DHCP6_LISTVAL_ADDR6,
+ &valaddr, NULL) == NULL) {
+ dprintf(LOG_ERR, FNAME,
+ "failed to copy %s address", dhcp6optstr(type));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+dhcp6_set_addr(type, list, p, optep, len)
+ dhcp6_listval_type_t type;
+ struct dhcp6_list *list;
+ struct dhcp6opt **p, *optep;
+ int *len;
+{
+ struct in6_addr *in6;
+ char *tmpbuf;
+ struct dhcp6_listval *d;
+ int optlen;
+
+ if (TAILQ_EMPTY(list))
+ return 0;
+
+ tmpbuf = NULL;
+ optlen = dhcp6_count_list(list) * sizeof(struct in6_addr);
+ if ((tmpbuf = malloc(optlen)) == NULL) {
+ dprintf(LOG_ERR, FNAME,
+ "memory allocation failed for %s options",
+ dhcp6optstr(type));
+ return -1;
+ }
+ in6 = (struct in6_addr *)tmpbuf;
+ for (d = TAILQ_FIRST(list); d; d = TAILQ_NEXT(d, link), in6++)
+ memcpy(in6, &d->val_addr6, sizeof(*in6));
+ if (copy_option(type, optlen, tmpbuf, p, optep, len) != 0) {
+ free(tmpbuf);
+ return -1;
+ }
+
+ free(tmpbuf);
+ return 0;
+}
+
+static int
+dhcp6_get_domain(optlen, cp, type, list)
+ int optlen;
+ void *cp;
+ dhcp6_listval_type_t type;
+ struct dhcp6_list *list;
+{
+ void *val;
+
+ val = cp;
+ while (val < cp + optlen) {
+ struct dhcp6_vbuf vb;
+ char name[MAXDNAME + 1];
+
+ if (dnsdecode((u_char **)(void *)&val,
+ (u_char *)(cp + optlen), name, sizeof(name)) == NULL) {
+ dprintf(LOG_INFO, FNAME, "failed to "
+ "decode a %s domain name",
+ dhcp6optstr(type));
+ dprintf(LOG_INFO, FNAME,
+ "malformed DHCP option: type %d, len %d",
+ type, optlen);
+ return -1;
+ }
+
+ vb.dv_len = strlen(name) + 1;
+ vb.dv_buf = name;
+
+ if (dhcp6_add_listval(list,
+ DHCP6_LISTVAL_VBUF, &vb, NULL) == NULL) {
+ dprintf(LOG_ERR, FNAME, "failed to "
+ "copy a %s domain name", dhcp6optstr(type));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+dhcp6_set_domain(type, list, p, optep, len)
+ dhcp6_listval_type_t type;
+ struct dhcp6_list *list;
+ struct dhcp6opt **p, *optep;
+ int *len;
+{
+ int optlen = 0;
+ struct dhcp6_listval *d;
+ char *tmpbuf;
+ char name[MAXDNAME], *cp, *ep;
+
+ if (TAILQ_EMPTY(list))
+ return 0;
+
+ for (d = TAILQ_FIRST(list); d; d = TAILQ_NEXT(d, link))
+ optlen += (d->val_vbuf.dv_len + 1);
+
+ if (optlen == 0) {
+ return 0;
+ }
+
+ tmpbuf = NULL;
+ if ((tmpbuf = malloc(optlen)) == NULL) {
+ dprintf(LOG_ERR, FNAME, "memory allocation failed for "
+ "%s domain options", dhcp6optstr(type));
+ return -1;
+ }
+ cp = tmpbuf;
+ ep = cp + optlen;
+ for (d = TAILQ_FIRST(list); d; d = TAILQ_NEXT(d, link)) {
+ int nlen;
+
+ nlen = dnsencode((const char *)d->val_vbuf.dv_buf,
+ name, sizeof (name));
+ if (nlen < 0) {
+ dprintf(LOG_ERR, FNAME,
+ "failed to encode a %s domain name",
+ dhcp6optstr(type));
+ free(tmpbuf);
+ return -1;
+ }
+ if (ep - cp < nlen) {
+ dprintf(LOG_ERR, FNAME,
+ "buffer length for %s domain name is too short",
+ dhcp6optstr(type));
+ free(tmpbuf);
+ return -1;
+ }
+ memcpy(cp, name, nlen);
+ cp += nlen;
+ }
+ if (copy_option(type, optlen, tmpbuf, p, optep, len) != 0) {
+ free(tmpbuf);
+ return -1;
+ }
+ free(tmpbuf);
+
+ return 0;
+}
+
struct dhcp6_event *
dhcp6_create_event(ifp, state)
struct dhcp6_if *ifp;
@@ -1001,6 +1173,12 @@ dhcp6_init_options(optinfo)
TAILQ_INIT(&optinfo->dnsname_list);
TAILQ_INIT(&optinfo->ntp_list);
TAILQ_INIT(&optinfo->prefix_list);
+ TAILQ_INIT(&optinfo->nis_list);
+ TAILQ_INIT(&optinfo->nisname_list);
+ TAILQ_INIT(&optinfo->nisp_list);
+ TAILQ_INIT(&optinfo->nispname_list);
+ TAILQ_INIT(&optinfo->bcmcs_list);
+ TAILQ_INIT(&optinfo->bcmcsname_list);
optinfo->authproto = DHCP6_AUTHPROTO_UNDEF;
optinfo->authalgorithm = DHCP6_AUTHALG_UNDEF;
@@ -1032,6 +1210,12 @@ dhcp6_clear_options(optinfo)
dhcp6_clear_list(&optinfo->dnsname_list);
dhcp6_clear_list(&optinfo->ntp_list);
dhcp6_clear_list(&optinfo->prefix_list);
+ dhcp6_clear_list(&optinfo->nis_list);
+ dhcp6_clear_list(&optinfo->nisname_list);
+ dhcp6_clear_list(&optinfo->nisp_list);
+ dhcp6_clear_list(&optinfo->nispname_list);
+ dhcp6_clear_list(&optinfo->bcmcs_list);
+ dhcp6_clear_list(&optinfo->bcmcsname_list);
if (optinfo->relaymsg_msg != NULL)
free(optinfo->relaymsg_msg);
@@ -1072,6 +1256,18 @@ dhcp6_copy_options(dst, src)
goto fail;
if (dhcp6_copy_list(&dst->prefix_list, &src->prefix_list))
goto fail;
+ if (dhcp6_copy_list(&dst->nis_list, &src->nis_list))
+ goto fail;
+ if (dhcp6_copy_list(&dst->nisname_list, &src->nisname_list))
+ goto fail;
+ if (dhcp6_copy_list(&dst->nisp_list, &src->nisp_list))
+ goto fail;
+ if (dhcp6_copy_list(&dst->nispname_list, &src->nispname_list))
+ goto fail;
+ if (dhcp6_copy_list(&dst->bcmcs_list, &src->bcmcs_list))
+ goto fail;
+ if (dhcp6_copy_list(&dst->bcmcsname_list, &src->bcmcsname_list))
+ goto fail;
dst->elapsed_time = src->elapsed_time;
dst->refreshtime = src->refreshtime;
dst->pref = src->pref;
@@ -1364,130 +1560,59 @@ dhcp6_get_options(p, ep, optinfo)
optinfo->ifidopt_len = optlen;
break;
case DH6OPT_SIP_SERVER_D:
- val = cp;
- while (val < cp + optlen) {
- struct dhcp6_vbuf vb;
- char name[MAXDNAME + 1];
-
- if (dnsdecode((u_char **)(void *)&val,
- (u_char *)(cp + optlen), name,
- sizeof(name)) == NULL) {
- dprintf(LOG_INFO, FNAME, "failed to "
- "decode a SIP domain name");
- goto malformed; /* or proceed? */
- }
-
- vb.dv_len = strlen(name) + 1;
- vb.dv_buf = name;
-
- if (dhcp6_add_listval(&optinfo->sipname_list,
- DHCP6_LISTVAL_VBUF, &vb, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
- "copy a SIP domain name");
- goto fail;
- }
- }
+ if (dhcp6_get_domain(optlen, cp, opt,
+ &optinfo->sipname_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_DNSNAME:
+ if (dhcp6_get_domain(optlen, cp, opt,
+ &optinfo->dnsname_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_NIS_DOMAIN_NAME:
+ if (dhcp6_get_domain(optlen, cp, opt,
+ &optinfo->nisname_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_NISP_DOMAIN_NAME:
+ if (dhcp6_get_domain(optlen, cp, opt,
+ &optinfo->nispname_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_BCMCS_SERVER_D:
+ if (dhcp6_get_domain(optlen, cp, opt,
+ &optinfo->bcmcsname_list) == -1)
+ goto fail;
break;
case DH6OPT_SIP_SERVER_A:
- if (optlen % sizeof(struct in6_addr) || optlen == 0)
- goto malformed;
- for (val = cp; val < cp + optlen;
- val += sizeof(struct in6_addr)) {
- memcpy(&valaddr, val, sizeof(valaddr));
- if (dhcp6_find_listval(&optinfo->sip_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
- dprintf(LOG_INFO, FNAME, "duplicated "
- "SIP server address (%s)",
- in6addr2str(&valaddr, 0));
- goto nextsip;
- }
-
- if (dhcp6_add_listval(&optinfo->sip_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, NULL)
- == NULL) {
- dprintf(LOG_ERR, FNAME,
- "failed to copy "
- "SIP server address");
- goto fail;
- }
- nextsip:
- ;
- }
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->sip_list) == -1)
+ goto fail;
break;
case DH6OPT_DNS:
- if (optlen % sizeof(struct in6_addr) || optlen == 0)
- goto malformed;
- for (val = cp; val < cp + optlen;
- val += sizeof(struct in6_addr)) {
- memcpy(&valaddr, val, sizeof(valaddr));
- if (dhcp6_find_listval(&optinfo->dns_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
- dprintf(LOG_INFO, FNAME, "duplicated "
- "DNS address (%s)",
- in6addr2str(&valaddr, 0));
- goto nextdns;
- }
-
- if (dhcp6_add_listval(&optinfo->dns_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, NULL)
- == NULL) {
- dprintf(LOG_ERR, FNAME,
- "failed to copy DNS address");
- goto fail;
- }
- nextdns:
- ;
- }
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->dns_list) == -1)
+ goto fail;
break;
- case DH6OPT_DNSNAME:
- val = cp;
- while (val < cp + optlen) {
- struct dhcp6_vbuf vb;
- char name[MAXDNAME + 1];
-
- if (dnsdecode((u_char **)(void *)&val,
- (u_char *)(cp + optlen), name,
- sizeof(name)) == NULL) {
- dprintf(LOG_INFO, FNAME, "failed to "
- "decode a DNS name");
- goto malformed; /* or proceed? */
- }
-
- vb.dv_len = strlen(name) + 1;
- vb.dv_buf = name;
-
- if (dhcp6_add_listval(&optinfo->dnsname_list,
- DHCP6_LISTVAL_VBUF, &vb, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
- "copy a DNS name");
- goto fail;
- }
- }
+ case DH6OPT_NIS_SERVERS:
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->nis_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_NISP_SERVERS:
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->nisp_list) == -1)
+ goto fail;
+ break;
+ case DH6OPT_BCMCS_SERVER_A:
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->bcmcs_list) == -1)
+ goto fail;
break;
case DH6OPT_NTP:
- if (optlen % sizeof(struct in6_addr) || optlen == 0)
- goto malformed;
- for (val = cp; val < cp + optlen;
- val += sizeof(struct in6_addr)) {
- memcpy(&valaddr, val, sizeof(valaddr));
- if (dhcp6_find_listval(&optinfo->ntp_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
- dprintf(LOG_INFO, FNAME, "duplicated "
- "NTP server address (%s)",
- in6addr2str(&valaddr, 0));
- goto nextntp;
- }
-
- if (dhcp6_add_listval(&optinfo->ntp_list,
- DHCP6_LISTVAL_ADDR6, &valaddr, NULL)
- == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
- "copy NTP server address");
- goto fail;
- }
- nextntp:
- ;
- }
+ if (dhcp6_get_addr(optlen, cp, opt,
+ &optinfo->ntp_list) == -1)
+ goto fail;
break;
case DH6OPT_IA_PD:
if (optlen + sizeof(struct dhcp6opt) <
@@ -2089,160 +2214,49 @@ dhcp6_set_options(type, optbp, optep, optinfo)
free(tmpbuf);
}
- optlen = 0;
- for (d = TAILQ_FIRST(&optinfo->sipname_list); d;
- d = TAILQ_NEXT(d, link)) {
- optlen += (d->val_vbuf.dv_len + 1);
- }
- if (optlen) {
- char name[MAXDNAME], *cp, *ep;
- tmpbuf = NULL;
+ if (dhcp6_set_domain(DH6OPT_SIP_SERVER_D, &optinfo->sipname_list,
+ &p, optep, &len) != 0)
+ goto fail;
- if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
- "memory allocation failed for "
- "SIP server domain options");
- goto fail;
- }
- cp = tmpbuf;
- ep = cp + optlen;
- for (d = TAILQ_FIRST(&optinfo->sipname_list); d;
- d = TAILQ_NEXT(d, link)) {
- int nlen;
-
- nlen = dnsencode((const char *)d->val_vbuf.dv_buf,
- name, sizeof (name));
- if (nlen < 0) {
- dprintf(LOG_ERR, FNAME,
- "failed to encode a SIP server "
- "domain name");
- goto fail;
- }
- if (ep - cp < nlen) {
- dprintf(LOG_ERR, FNAME,
- "buffer length for SIP server "
- "domain name is too short");
- goto fail;
- }
- memcpy(cp, name, nlen);
- cp += nlen;
- }
- if (copy_option(DH6OPT_SIP_SERVER_D, optlen, tmpbuf, &p,
- optep, &len) != 0) {
- goto fail;
- }
- free(tmpbuf);
- }
- if (!TAILQ_EMPTY(&optinfo->sip_list)) {
- struct in6_addr *in6;
+ if (dhcp6_set_addr(DH6OPT_SIP_SERVER_A, &optinfo->sip_list,
+ &p, optep, &len) != 0)
+ goto fail;
- tmpbuf = NULL;
- optlen = dhcp6_count_list(&optinfo->sip_list) *
- sizeof(struct in6_addr);
- if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
- "memory allocation failed for SIP server options");
- goto fail;
- }
- in6 = (struct in6_addr *)tmpbuf;
- for (d = TAILQ_FIRST(&optinfo->sip_list); d;
- d = TAILQ_NEXT(d, link), in6++) {
- memcpy(in6, &d->val_addr6, sizeof(*in6));
- }
- if (copy_option(DH6OPT_SIP_SERVER_A, optlen, tmpbuf, &p,
- optep, &len) != 0) {
- goto fail;
- }
- free(tmpbuf);
- }
+ if (dhcp6_set_addr(DH6OPT_DNS, &optinfo->sip_list,
+ &p, optep, &len) != 0)
+ goto fail;
- if (!TAILQ_EMPTY(&optinfo->dns_list)) {
- struct in6_addr *in6;
+ if (dhcp6_set_domain(DH6OPT_DNSNAME, &optinfo->dnsname_list,
+ &p, optep, &len) != 0)
+ goto fail;
- tmpbuf = NULL;
- optlen = dhcp6_count_list(&optinfo->dns_list) *
- sizeof(struct in6_addr);
- if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
- "memory allocation failed for DNS options");
- goto fail;
- }
- in6 = (struct in6_addr *)tmpbuf;
- for (d = TAILQ_FIRST(&optinfo->dns_list); d;
- d = TAILQ_NEXT(d, link), in6++) {
- memcpy(in6, &d->val_addr6, sizeof(*in6));
- }
- if (copy_option(DH6OPT_DNS, optlen, tmpbuf, &p,
- optep, &len) != 0) {
- goto fail;
- }
- free(tmpbuf);
- }
+ if (dhcp6_set_addr(DH6OPT_NIS_SERVERS, &optinfo->nis_list,
+ &p, optep, &len) != 0)
+ goto fail;
- optlen = 0;
- for (d = TAILQ_FIRST(&optinfo->dnsname_list); d;
- d = TAILQ_NEXT(d, link)) {
- optlen += (d->val_vbuf.dv_len + 1);
- }
- if (optlen) {
- char name[MAXDNAME], *cp, *ep;
- tmpbuf = NULL;
+ if (dhcp6_set_addr(DH6OPT_NISP_SERVERS, &optinfo->nisp_list,
+ &p, optep, &len) != 0)
+ goto fail;
- if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
- "memory allocation failed for DNS name options");
- goto fail;
- }
- cp = tmpbuf;
- ep = cp + optlen;
- for (d = TAILQ_FIRST(&optinfo->dnsname_list); d;
- d = TAILQ_NEXT(d, link)) {
- int nlen;
-
- nlen = dnsencode((const char *)d->val_vbuf.dv_buf,
- name, sizeof (name));
- if (nlen < 0) {
- dprintf(LOG_ERR, FNAME,
- "failed to encode a DNS name");
- goto fail;
- }
- if (ep - cp < nlen) {
- dprintf(LOG_ERR, FNAME,
- "buffer length for DNS name is too short");
- goto fail;
- }
- memcpy(cp, name, nlen);
- cp += nlen;
- }
- if (copy_option(DH6OPT_DNSNAME, optlen, tmpbuf, &p,
- optep, &len) != 0) {
- goto fail;
- }
- free(tmpbuf);
- }
+ if (dhcp6_set_domain(DH6OPT_NIS_DOMAIN_NAME, &optinfo->nisname_list,
+ &p, optep, &len) != 0)
+ goto fail;
- if (!TAILQ_EMPTY(&optinfo->ntp_list)) {
- struct in6_addr *in6;
+ if (dhcp6_set_domain(DH6OPT_NISP_DOMAIN_NAME, &optinfo->nispname_list,
+ &p, optep, &len) != 0)
+ goto fail;
- tmpbuf = NULL;
- optlen = dhcp6_count_list(&optinfo->ntp_list) *
- sizeof(struct in6_addr);
- if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
- "memory allocation failed for NTP options");
- goto fail;
- }
- in6 = (struct in6_addr *)tmpbuf;
- for (d = TAILQ_FIRST(&optinfo->ntp_list); d;
- d = TAILQ_NEXT(d, link), in6++) {
- memcpy(in6, &d->val_addr6, sizeof(*in6));
- }
- if (copy_option(DH6OPT_NTP, optlen, tmpbuf, &p,
- optep, &len) != 0) {
- goto fail;
- }
- free(tmpbuf);
- }
+ if (dhcp6_set_addr(DH6OPT_NTP, &optinfo->ntp_list,
+ &p, optep, &len) != 0)
+ goto fail;
+
+ if (dhcp6_set_domain(DH6OPT_BCMCS_SERVER_D, &optinfo->bcmcsname_list,
+ &p, optep, &len) != 0)
+ goto fail;
+
+ if (dhcp6_set_addr(DH6OPT_BCMCS_SERVER_A, &optinfo->bcmcs_list,
+ &p, optep, &len) != 0)
+ goto fail;
for (op = TAILQ_FIRST(&optinfo->iapd_list); op;
op = TAILQ_NEXT(op, link)) {
@@ -2841,7 +2855,7 @@ dhcp6optstr(type)
case DH6OPT_RECONF_MSG:
return ("reconfigure message");
case DH6OPT_SIP_SERVER_D:
- return ("SIP server domain name ");
+ return ("SIP domain name");
case DH6OPT_SIP_SERVER_A:
return ("SIP server address");
case DH6OPT_DNS:
@@ -2856,6 +2870,26 @@ dhcp6optstr(type)
return ("IA_PD prefix");
case DH6OPT_REFRESHTIME:
return ("information refresh time");
+ case DH6OPT_NIS_SERVERS:
+ return ("NIS servers");
+ case DH6OPT_NISP_SERVERS:
+ return ("NIS+ servers");
+ case DH6OPT_NIS_DOMAIN_NAME:
+ return ("NIS domain name");
+ case DH6OPT_NISP_DOMAIN_NAME:
+ return ("NIS+ domain name");
+ case DH6OPT_BCMCS_SERVER_D:
+ return ("BCMCS domain name");
+ case DH6OPT_BCMCS_SERVER_A:
+ return ("BCMCS server address");
+ case DH6OPT_GEOCONF_CIVIC:
+ return ("Geoconf Civic");
+ case DH6OPT_REMOTE_ID:
+ return ("remote ID");
+ case DH6OPT_SUBSCRIBER_ID:
+ return ("subscriber ID");
+ case DH6OPT_CLIENT_FQDN:
+ return ("client FQDN");
default:
snprintf(genstr, sizeof(genstr), "opt_%d", type);
return (genstr);
diff --git a/config.c b/config.c
index 49821b0..a35c50d 100644
--- a/config.c
+++ b/config.c
@@ -64,6 +64,9 @@ extern int errno;
struct prefix_ifconf *prefix_ifconflist;
struct dhcp6_list siplist, sipnamelist, dnslist, dnsnamelist, ntplist;
+struct dhcp6_list nislist, nisnamelist;
+struct dhcp6_list nisplist, nispnamelist;
+struct dhcp6_list bcmcslist, bcmcsnamelist;
long long optrefreshtime = -1;
static struct dhcp6_ifconf *dhcp6_ifconflist;
@@ -72,6 +75,9 @@ static struct host_conf *host_conflist0, *host_conflist;
static struct keyinfo *key_list, *key_list0;
static struct authinfo *auth_list, *auth_list0;
static struct dhcp6_list siplist0, sipnamelist0, dnslist0, dnsnamelist0, ntplist0;
+static struct dhcp6_list nislist0, nisnamelist0;
+static struct dhcp6_list nisplist0, nispnamelist0;
+static struct dhcp6_list bcmcslist0, bcmcsnamelist0;
static long long optrefreshtime0;
#ifndef DHCP6_DYNAMIC_HOSTCONF_MAX
#define DHCP6_DYNAMIC_HOSTCONF_MAX 1024
@@ -111,6 +117,9 @@ struct dhcp6_ifconf {
extern struct cf_list *cf_dns_list, *cf_dns_name_list, *cf_ntp_list;
extern struct cf_list *cf_sip_list, *cf_sip_name_list;
+extern struct cf_list *cf_nis_list, *cf_nis_name_list;
+extern struct cf_list *cf_nisp_list, *cf_nisp_name_list;
+extern struct cf_list *cf_bcmcs_list, *cf_bcmcs_name_list;
extern long long cf_refreshtime;
extern char *configfilename;
@@ -126,6 +135,8 @@ static void clear_hostconf __P((struct host_conf *));
static void clear_keys __P((struct keyinfo *));
static void clear_authinfo __P((struct authinfo *));
static int configure_duid __P((char *, struct duid *));
+static int configure_addr __P((struct cf_list *, struct dhcp6_list *, char *));
+static int configure_domain __P((struct cf_list *, struct dhcp6_list *, char *));
static int get_default_ifid __P((struct prefix_ifconf *));
static void clear_poolconf __P((struct pool_conf *));
static struct pool_conf *create_pool __P((char *, struct dhcp6_range *));
@@ -965,105 +976,125 @@ configure_global_option()
{
struct cf_list *cl;
- /* check against configuration restriction */
- if ((cf_dns_list && cf_dns_name_list) &&
- dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
- configfilename, cf_dns_list->line);
+ /* SIP Server address */
+ if (configure_addr(cf_sip_list, &siplist0, "SIP") < 0)
goto bad;
- }
- if ((cf_sip_list && cf_sip_name_list) &&
- dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
- configfilename, cf_sip_list->line);
+
+ /* SIP domain name */
+ if (configure_domain(cf_sip_name_list, &sipnamelist0, "SIP") < 0)
goto bad;
- }
- /* SIP Server address */
- TAILQ_INIT(&siplist0);
- for (cl = cf_sip_list; cl; cl = cl->next) {
- /* duplication check */
- if (dhcp6_find_listval(&siplist0, DHCP6_LISTVAL_ADDR6,
- cl->ptr, 0)) {
- dprintf(LOG_INFO, FNAME,
- "%s:%d duplicated SIP server: %s",
- configfilename, cl->line,
- in6addr2str((struct in6_addr *)cl->ptr, 0));
- goto bad;
- }
- if (dhcp6_add_listval(&siplist0, DHCP6_LISTVAL_ADDR6,
- cl->ptr, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a SIP server");
- goto bad;
- }
- }
+ /* DNS servers */
+ if (configure_addr(cf_dns_list, &dnslist0, "DNS") < 0)
+ goto bad;
- /* SIP Server domain name */
- TAILQ_INIT(&sipnamelist0);
- for (cl = cf_sip_name_list; cl; cl = cl->next) {
- char *name, *cp;
- struct dhcp6_vbuf name_vbuf;
+ /* DNS name */
+ if (configure_domain(cf_dns_name_list, &dnsnamelist0, "DNS") < 0)
+ goto bad;
- name = strdup(cl->ptr + 1);
- if (name == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy a SIP server domain name");
- goto bad;
- }
- cp = name + strlen(name) - 1;
- *cp = '\0'; /* clear the terminating quote */
+ /* NTP servers */
+ if (configure_addr(cf_ntp_list, &ntplist0, "NTP") < 0)
+ goto bad;
- name_vbuf.dv_buf = name;
- name_vbuf.dv_len = strlen(name) + 1;
+ /* NIS Server address */
+ if (configure_addr(cf_nis_list, &nislist0, "NIS") < 0)
+ goto bad;
- /* duplication check */
- if (dhcp6_find_listval(&sipnamelist0, DHCP6_LISTVAL_VBUF,
- &name_vbuf, 0)) {
- dprintf(LOG_INFO, FNAME,
- "%s:%d duplicated SIP name: %s",
- configfilename, cl->line, name_vbuf.dv_buf);
- dhcp6_vbuf_free(&name_vbuf);
- goto bad;
- }
+ /* NIS domain name */
+ if (configure_domain(cf_nis_name_list, &nisnamelist0, "NIS") < 0)
+ goto bad;
- /* add the name */
- if (dhcp6_add_listval(&sipnamelist0, DHCP6_LISTVAL_VBUF,
- &name_vbuf, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a SIP name");
- dhcp6_vbuf_free(&name_vbuf);
- goto bad;
- }
- dhcp6_vbuf_free(&name_vbuf);
+ /* NIS+ Server address */
+ if (configure_addr(cf_nisp_list, &nisplist0, "NISP") < 0)
+ goto bad;
+
+ /* NIS+ domain name */
+ if (configure_domain(cf_nisp_name_list, &nispnamelist0, "NISP") < 0)
+ goto bad;
+
+ /* BCMCS Server address */
+ if (configure_addr(cf_bcmcs_list, &bcmcslist0, "BCMCS") < 0)
+ goto bad;
+
+ /* BCMCS domain name */
+ if (configure_domain(cf_bcmcs_name_list, &bcmcsnamelist0, "BCMCS") < 0)
+ goto bad;
+
+ /* Lifetime for stateless options */
+ if (cf_refreshtime >= 0) {
+ optrefreshtime0 = cf_refreshtime;
}
- /* DNS servers */
- TAILQ_INIT(&dnslist0);
- for (cl = cf_dns_list; cl; cl = cl->next) {
+ return (0);
+
+ bad:
+ return (-1); /* no need to free intermediate list */
+}
+
+static int
+configure_addr(cf_addr_list, list0, optname)
+ struct cf_list *cf_addr_list;
+ struct dhcp6_list *list0;
+ char *optname;
+{
+ struct cf_list *cl;
+
+ /* check against configuration restriction */
+ if (cf_addr_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
+ dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ configfilename, cf_addr_list->line);
+ return -1;
+ }
+
+ TAILQ_INIT(list0);
+ for (cl = cf_addr_list; cl; cl = cl->next) {
/* duplication check */
- if (dhcp6_find_listval(&dnslist0, DHCP6_LISTVAL_ADDR6,
+ if (dhcp6_find_listval(list0, DHCP6_LISTVAL_ADDR6,
cl->ptr, 0)) {
dprintf(LOG_INFO, FNAME,
- "%s:%d duplicated DNS server: %s",
+ "%s:%d duplicated %s server: %s",
configfilename, cl->line,
+ optname,
in6addr2str((struct in6_addr *)cl->ptr, 0));
- goto bad;
+ return -1;
}
- if (dhcp6_add_listval(&dnslist0, DHCP6_LISTVAL_ADDR6,
+ if (dhcp6_add_listval(list0, DHCP6_LISTVAL_ADDR6,
cl->ptr, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a DNS server");
- goto bad;
+ dprintf(LOG_ERR, FNAME, "failed to add a %s server",
+ optname);
+ return -1;
}
}
- /* DNS name */
- TAILQ_INIT(&dnsnamelist0);
- for (cl = cf_dns_name_list; cl; cl = cl->next) {
+ return 0;
+}
+
+static int
+configure_domain(cf_name_list, list0, optname)
+ struct cf_list *cf_name_list;
+ struct dhcp6_list *list0;
+ char *optname;
+{
+ struct cf_list *cl;
+
+ /* check against configuration restriction */
+ if (cf_name_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
+ dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ configfilename, cf_name_list->line);
+ return -1;
+ }
+
+ TAILQ_INIT(list0);
+ for (cl = cf_name_list; cl; cl = cl->next) {
char *name, *cp;
struct dhcp6_vbuf name_vbuf;
name = strdup(cl->ptr + 1);
if (name == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy a DNS name");
- goto bad;
+ dprintf(LOG_ERR, FNAME,
+ "failed to copy a %s domain name",
+ optname);
+ return -1;
}
cp = name + strlen(name) - 1;
*cp = '\0'; /* clear the terminating quote */
@@ -1072,53 +1103,28 @@ configure_global_option()
name_vbuf.dv_len = strlen(name) + 1;
/* duplication check */
- if (dhcp6_find_listval(&dnsnamelist0, DHCP6_LISTVAL_VBUF,
+ if (dhcp6_find_listval(list0, DHCP6_LISTVAL_VBUF,
&name_vbuf, 0)) {
dprintf(LOG_INFO, FNAME,
- "%s:%d duplicated DNS name: %s",
- configfilename, cl->line, name_vbuf.dv_buf);
+ "%s:%d duplicated %s name: %s",
+ configfilename, cl->line, optname,
+ name_vbuf.dv_buf);
dhcp6_vbuf_free(&name_vbuf);
- goto bad;
+ return -1;
}
/* add the name */
- if (dhcp6_add_listval(&dnsnamelist0, DHCP6_LISTVAL_VBUF,
+ if (dhcp6_add_listval(list0, DHCP6_LISTVAL_VBUF,
&name_vbuf, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a DNS name");
+ dprintf(LOG_ERR, FNAME, "failed to add a %s name",
+ optname);
dhcp6_vbuf_free(&name_vbuf);
- goto bad;
+ return -1;
}
dhcp6_vbuf_free(&name_vbuf);
}
- /* NTP servers */
- TAILQ_INIT(&ntplist0);
- for (cl = cf_ntp_list; cl; cl = cl->next) {
- /* duplication check */
- if (dhcp6_find_listval(&ntplist0, DHCP6_LISTVAL_ADDR6,
- cl->ptr, 0)) {
- dprintf(LOG_INFO, FNAME,
- "%s:%d duplicated NTP server: %s",
- configfilename, cl->line,
- in6addr2str((struct in6_addr *)cl->ptr, 0));
- goto bad;
- }
- if (dhcp6_add_listval(&ntplist0, DHCP6_LISTVAL_ADDR6,
- cl->ptr, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add an NTP server");
- goto bad;
- }
- }
-
- /* Lifetime for stateless options */
- if (cf_refreshtime >= 0) {
- optrefreshtime0 = cf_refreshtime;
- }
-
- return (0);
-
- bad:
- return (-1); /* no need to free intermediate list */
+ return 0;
}
static int
@@ -1371,7 +1377,7 @@ configure_commit()
dhcp6_clear_list(&siplist);
dhcp6_move_list(&siplist, &siplist0);
- /* commit SIP server domain names */
+ /* commit SIP domain names */
dhcp6_clear_list(&sipnamelist);
dhcp6_move_list(&sipnamelist, &sipnamelist0);
@@ -1387,6 +1393,30 @@ configure_commit()
dhcp6_clear_list(&ntplist);
dhcp6_move_list(&ntplist, &ntplist0);
+ /* commit NIS server addresses */
+ dhcp6_clear_list(&nislist);
+ dhcp6_move_list(&nislist, &nislist0);
+
+ /* commit NIS domain names */
+ dhcp6_clear_list(&nisnamelist);
+ dhcp6_move_list(&nisnamelist, &nisnamelist0);
+
+ /* commit NIS+ server addresses */
+ dhcp6_clear_list(&nisplist);
+ dhcp6_move_list(&nisplist, &nisplist0);
+
+ /* commit NIS+ domain names */
+ dhcp6_clear_list(&nispnamelist);
+ dhcp6_move_list(&nispnamelist, &nispnamelist0);
+
+ /* commit BCMCS server addresses */
+ dhcp6_clear_list(&bcmcslist);
+ dhcp6_move_list(&bcmcslist, &bcmcslist0);
+
+ /* commit BCMCS domain names */
+ dhcp6_clear_list(&bcmcsnamelist);
+ dhcp6_move_list(&bcmcsnamelist, &bcmcsnamelist0);
+
/* commit information refresh time */
optrefreshtime = optrefreshtime0;
/* commit pool configuration */
diff --git a/config.h b/config.h
index 04c8785..c63679f 100644
--- a/config.h
+++ b/config.h
@@ -270,6 +270,9 @@ enum { DECL_SEND, DECL_ALLOW, DECL_INFO_ONLY, DECL_REQUEST, DECL_DUID,
DHCPOPT_DNS, DHCPOPT_DNSNAME,
DHCPOPT_IA_PD, DHCPOPT_IA_NA, DHCPOPT_NTP,
DHCPOPT_REFRESHTIME,
+ DHCPOPT_NIS, DHCPOPT_NISNAME,
+ DHCPOPT_NISP, DHCPOPT_NISPNAME,
+ DHCPOPT_BCMCS, DHCPOPT_BCMCSNAME,
CFLISTENT_GENERIC,
IACONF_PIF, IACONF_PREFIX, IACONF_ADDR,
DHCPOPT_SIP, DHCPOPT_SIPNAME,
@@ -289,6 +292,12 @@ extern struct dhcp6_list sipnamelist;
extern struct dhcp6_list dnslist;
extern struct dhcp6_list dnsnamelist;
extern struct dhcp6_list ntplist;
+extern struct dhcp6_list nislist;
+extern struct dhcp6_list nisnamelist;
+extern struct dhcp6_list nisplist;
+extern struct dhcp6_list nispnamelist;
+extern struct dhcp6_list bcmcslist;
+extern struct dhcp6_list bcmcsnamelist;
extern long long optrefreshtime;
extern struct dhcp6_if *ifinit __P((char *));
diff --git a/configure b/configure
index 5b4e7bf..05ad1cc 100755
--- a/configure
+++ b/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP YACC LEX LEXLIB LEX_OUTPUT_ROOT EGREP LIBOBJS localdbdir DHCPOPT_DNS DH6OPT_DNSNAME DH6OPT_IA_PD DH6OPT_IA_PD_PREFIX DH6OPT_REFRESHTIME DH6OPT_NTP LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP YACC LEX LEXLIB LEX_OUTPUT_ROOT EGREP LIBOBJS localdbdir LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -846,12 +846,6 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-localdbdir=VALUE where to put local DB files
- --with-opt-dns=VALUE specify DHCP option value for DNS
- --with-opt-dnsname=VALUE specify DHCP option value for DNS_NAME
- --with-opt-ia-pd=VALUE specify DHCP option value for IA_PD
- --with-opt-ia-pd-prefix=VALUE specify DHCP option value for IA_PD prefix
- --with-opt-refreshtime=VALUE specify DHCP option value for refresh time
- --with-opt-ntp=VALUE specify DHCP option value for NTP
Some influential environment variables:
CC C compiler command
@@ -5298,126 +5292,6 @@ _ACEOF
;;
esac
-echo "$as_me:$LINENO: checking for DHCP DNS option" >&5
-echo $ECHO_N "checking for DHCP DNS option... $ECHO_C" >&6
-
-# Check whether --with-opt-dns or --without-opt-dns was given.
-if test "${with_opt_dns+set}" = set; then
- withval="$with_opt_dns"
- dhcpopt_dns="$withval"
-else
- dhcpopt_dns=0
-fi;
-if test $dhcpopt_dns != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_dns" >&5
-echo "${ECHO_T}using $dhcpopt_dns" >&6
- DHCPOPT_DNS="-DDH6OPT_DNS=$dhcpopt_dns"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:$LINENO: checking for DHCP DNS_NAME option" >&5
-echo $ECHO_N "checking for DHCP DNS_NAME option... $ECHO_C" >&6
-
-# Check whether --with-opt-dnsname or --without-opt-dnsname was given.
-if test "${with_opt_dnsname+set}" = set; then
- withval="$with_opt_dnsname"
- dhcpopt_dnsname="$withval"
-else
- dhcpopt_dnsname=0
-fi;
-if test $dhcpopt_dnsname != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_dnsname" >&5
-echo "${ECHO_T}using $dhcpopt_dnsname" >&6
- DH6OPT_DNSNAME="-DDH6OPT_DNSNAME=$dhcpopt_dnsname"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:$LINENO: checking for DHCP IA_PD option" >&5
-echo $ECHO_N "checking for DHCP IA_PD option... $ECHO_C" >&6
-
-# Check whether --with-opt-ia-pd or --without-opt-ia-pd was given.
-if test "${with_opt_ia_pd+set}" = set; then
- withval="$with_opt_ia_pd"
- dhcpopt_ia_pd="$withval"
-else
- dhcpopt_ia_pd=0
-fi;
-if test $dhcpopt_ia_pd != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_ia_pd" >&5
-echo "${ECHO_T}using $dhcpopt_ia_pd" >&6
- DH6OPT_IA_PD="-DDH6OPT_IA_PD=$dhcpopt_ia_pd"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:$LINENO: checking for DHCP IA_PD_PREFIX option" >&5
-echo $ECHO_N "checking for DHCP IA_PD_PREFIX option... $ECHO_C" >&6
-
-# Check whether --with-opt-ia-pd-prefix or --without-opt-ia-pd-prefix was given.
-if test "${with_opt_ia_pd_prefix+set}" = set; then
- withval="$with_opt_ia_pd_prefix"
- dhcpopt_ia_pd_prefix="$withval"
-else
- dhcpopt_ia_pd_prefix=0
-fi;
-if test $dhcpopt_ia_pd_prefix != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_ia_pd_prefix" >&5
-echo "${ECHO_T}using $dhcpopt_ia_pd_prefix" >&6
- DH6OPT_IA_PD_PREFIX="-DDH6OPT_IA_PD_PREFIX=$dhcpopt_ia_pd_prefix"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:$LINENO: checking for DHCP information refresh time option" >&5
-echo $ECHO_N "checking for DHCP information refresh time option... $ECHO_C" >&6
-
-# Check whether --with-opt-refreshtime or --without-opt-refreshtime was given.
-if test "${with_opt_refreshtime+set}" = set; then
- withval="$with_opt_refreshtime"
- dhcpopt_refreshtime="$withval"
-else
- dhcpopt_refreshtime=0
-fi;
-if test $dhcpopt_refreshtime != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_refresh" >&5
-echo "${ECHO_T}using $dhcpopt_refresh" >&6
- DH6OPT_REFRESHTIME="-DDH6OPT_REFRESHTIME=$dhcpopt_refreshtime"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-echo "$as_me:$LINENO: checking for DHCP NTP option" >&5
-echo $ECHO_N "checking for DHCP NTP option... $ECHO_C" >&6
-
-# Check whether --with-opt-ntp or --without-opt-ntp was given.
-if test "${with_opt_ntp+set}" = set; then
- withval="$with_opt_ntp"
- dhcpopt_ntp="$withval"
-else
- dhcpopt_ntp=0
-fi;
-if test $dhcpopt_ntp != 0 ; then
- echo "$as_me:$LINENO: result: using $dhcpopt_ntp" >&5
-echo "${ECHO_T}using $dhcpopt_ntp" >&6
- DH6OPT_NTP="-DDH6OPT_NTP=$dhcpopt_ntp"
-
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
for ac_header in stdarg.h
@@ -6225,12 +6099,6 @@ s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@localdbdir@,$localdbdir,;t t
-s,@DHCPOPT_DNS@,$DHCPOPT_DNS,;t t
-s,@DH6OPT_DNSNAME@,$DH6OPT_DNSNAME,;t t
-s,@DH6OPT_IA_PD@,$DH6OPT_IA_PD,;t t
-s,@DH6OPT_IA_PD_PREFIX@,$DH6OPT_IA_PD_PREFIX,;t t
-s,@DH6OPT_REFRESHTIME@,$DH6OPT_REFRESHTIME,;t t
-s,@DH6OPT_NTP@,$DH6OPT_NTP,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/configure.in b/configure.in
index edf4f0e..624061f 100644
--- a/configure.in
+++ b/configure.in
@@ -144,81 +144,6 @@ case $pred_func_id in
;;
esac
-dnl DHCP option type values that have been assigned very recently:
-dnl These values may need be configurable for interoperability with
-dnl prior experimental implementations.
-AC_MSG_CHECKING(for DHCP DNS option)
-AC_ARG_WITH(opt-dns,
-[ --with-opt-dns=VALUE specify DHCP option value for DNS],
- dhcpopt_dns="$withval", dhcpopt_dns=0)
-if test $dhcpopt_dns != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_dns)
- DHCPOPT_DNS="-DDH6OPT_DNS=$dhcpopt_dns"
- AC_SUBST(DHCPOPT_DNS)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for DHCP DNS_NAME option)
-AC_ARG_WITH(opt-dnsname,
-[ --with-opt-dnsname=VALUE specify DHCP option value for DNS_NAME],
- dhcpopt_dnsname="$withval", dhcpopt_dnsname=0)
-if test $dhcpopt_dnsname != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_dnsname)
- DH6OPT_DNSNAME="-DDH6OPT_DNSNAME=$dhcpopt_dnsname"
- AC_SUBST(DH6OPT_DNSNAME)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for DHCP IA_PD option)
-AC_ARG_WITH(opt-ia-pd,
-[ --with-opt-ia-pd=VALUE specify DHCP option value for IA_PD],
- dhcpopt_ia_pd="$withval", dhcpopt_ia_pd=0)
-if test $dhcpopt_ia_pd != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_ia_pd)
- DH6OPT_IA_PD="-DDH6OPT_IA_PD=$dhcpopt_ia_pd"
- AC_SUBST(DH6OPT_IA_PD)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for DHCP IA_PD_PREFIX option)
-AC_ARG_WITH(opt-ia-pd-prefix,
-[ --with-opt-ia-pd-prefix=VALUE specify DHCP option value for IA_PD prefix],
- dhcpopt_ia_pd_prefix="$withval", dhcpopt_ia_pd_prefix=0)
-if test $dhcpopt_ia_pd_prefix != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_ia_pd_prefix)
- DH6OPT_IA_PD_PREFIX="-DDH6OPT_IA_PD_PREFIX=$dhcpopt_ia_pd_prefix"
- AC_SUBST(DH6OPT_IA_PD_PREFIX)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for DHCP information refresh time option)
-AC_ARG_WITH(opt-refreshtime,
-[ --with-opt-refreshtime=VALUE specify DHCP option value for refresh time],
- dhcpopt_refreshtime="$withval", dhcpopt_refreshtime=0)
-if test $dhcpopt_refreshtime != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_refresh)
- DH6OPT_REFRESHTIME="-DDH6OPT_REFRESHTIME=$dhcpopt_refreshtime"
- AC_SUBST(DH6OPT_REFRESHTIME)
-else
- AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(for DHCP NTP option)
-AC_ARG_WITH(opt-ntp,
-[ --with-opt-ntp=VALUE specify DHCP option value for NTP],
- dhcpopt_ntp="$withval", dhcpopt_ntp=0)
-if test $dhcpopt_ntp != 0 ; then
- AC_MSG_RESULT(using $dhcpopt_ntp)
- DH6OPT_NTP="-DDH6OPT_NTP=$dhcpopt_ntp"
- AC_SUBST(DH6OPT_NTP)
-else
- AC_MSG_RESULT(no)
-fi
-
dnl DHCP option type values not officially defined
dnl (no such option now)
diff --git a/dhcp6.h b/dhcp6.h
index b868bab..b030c53 100644
--- a/dhcp6.h
+++ b/dhcp6.h
@@ -164,11 +164,17 @@ struct dhcp6_optinfo {
struct dhcp6_list reqopt_list; /* options in option request */
struct dhcp6_list stcode_list; /* status code */
struct dhcp6_list sip_list; /* SIP server list */
- struct dhcp6_list sipname_list; /* SIP server domain list */
+ struct dhcp6_list sipname_list; /* SIP domain list */
struct dhcp6_list dns_list; /* DNS server list */
struct dhcp6_list dnsname_list; /* Domain Search list */
struct dhcp6_list ntp_list; /* NTP server list */
struct dhcp6_list prefix_list; /* prefix list */
+ struct dhcp6_list nis_list; /* NIS server list */
+ struct dhcp6_list nisname_list; /* NIS domain list */
+ struct dhcp6_list nisp_list; /* NIS+ server list */
+ struct dhcp6_list nispname_list; /* NIS+ domain list */
+ struct dhcp6_list bcmcs_list; /* BCMC server list */
+ struct dhcp6_list bcmcsname_list; /* BCMC domain list */
struct dhcp6_vbuf relay_msg; /* relay message */
#define relaymsg_len relay_msg.dv_len
@@ -262,67 +268,25 @@ struct dhcp6_relay {
#define DH6OPT_INTERFACE_ID 18
#define DH6OPT_RECONF_MSG 19
-/*
- * The following values have been assigned by IANA very recently. In order to
- * ensure interoperability with prior experimental implementation, we still
- * provide a way to configure these values. It is highly recommended to use
- * the standard values whenever possible, of course.
- */
-#ifndef DH6OPT_SIP_SERVER_D
#define DH6OPT_SIP_SERVER_D 21
-#endif
-#ifndef DH6OPT_SIP_SERVER_A
#define DH6OPT_SIP_SERVER_A 22
-#endif
-#ifndef DH6OPT_DNS
#define DH6OPT_DNS 23
-#endif
-#ifndef DH6OPT_DNSNAME
#define DH6OPT_DNSNAME 24
-#endif
-#ifndef DH6OPT_IA_PD
#define DH6OPT_IA_PD 25
-#endif
-#ifndef DH6OPT_IA_PD_PREFIX
#define DH6OPT_IA_PD_PREFIX 26
-#endif
-#ifndef DH6OPT_NIS_SERVERS
#define DH6OPT_NIS_SERVERS 27
-#endif
-#ifndef DH6OPT_NISP_SERVERS
#define DH6OPT_NISP_SERVERS 28
-#endif
-#ifndef DH6OPT_NIS_DOMAIN_NAME
#define DH6OPT_NIS_DOMAIN_NAME 29
-#endif
-#ifndef DH6OPT_NISP_DOMAIN_NAME
#define DH6OPT_NISP_DOMAIN_NAME 30
-#endif
-#ifndef DH6OPT_NTP
#define DH6OPT_NTP 31
-#endif
-#ifndef DH6OPT_REFRESHTIME
#define DH6OPT_REFRESHTIME 32
#define DH6OPT_REFRESHTIME_UNDEF -1
-#endif
-#ifndef DH6OPT_BCMCS_SERVER_D
#define DH6OPT_BCMCS_SERVER_D 33
-#endif
-#ifndef DH6OPT_BCMCS_SERVER_A
#define DH6OPT_BCMCS_SERVER_A 34
-#endif
-#ifndef DH6OPT_GEOCONF_CIVIC
#define DH6OPT_GEOCONF_CIVIC 36
-#endif
-#ifndef DH6OPT_REMOTE_ID
#define DH6OPT_REMOTE_ID 37
-#endif
-#ifndef DH6OPT_SUBSCRIBER_ID
#define DH6OPT_SUBSCRIBER_ID 38
-#endif
-#ifndef DH6OPT_CLIENT_FQDN
#define DH6OPT_CLIENT_FQDN 39
-#endif
/* The followings are KAME specific. */
diff --git a/dhcp6c.8 b/dhcp6c.8
index 93535b4..d82f184 100644
--- a/dhcp6c.8
+++ b/dhcp6c.8
@@ -140,12 +140,30 @@ which provides DNS name search path.
A list of available NTP servers,
each of which is an IPv6 numeric address and is separated by a white
space character.
-.It Ic new_sip_name_servers
+.It Ic new_sip_servers
A list of available SIP server addresses,
each of which is an IPv6 numeric address and is separated by a white
space character.
.It Ic new_sip_name
A list of SIP server domain names.
+.It Ic new_nis_servers
+A list of available NIS server addresses,
+each of which is an IPv6 numeric address and is separated by a white
+space character.
+.It Ic new_nis_name
+A list of NIS domain names.
+.It Ic new_nisp_servers
+A list of available NIS+ server addresses,
+each of which is an IPv6 numeric address and is separated by a white
+space character.
+.It Ic new_nisp_name
+A list of NIS+ domain names.
+.It Ic new_bcmcs_servers
+A list of available BCMCS server addresses,
+each of which is an IPv6 numeric address and is separated by a white
+space character.
+.It Ic new_bcmcs_name
+A list of BCMCS server domain names.
.El
.Pp
Note that the daemon does not always provide all the parameters.
@@ -173,10 +191,6 @@ command first appeared in WIDE/KAME IPv6 protocol stack kit.
is incomplete and violates DHCPv6 protocol spec, in several aspects.
In particular, temporary address assignment is intentionally omitted.
.Pp
-Some of useful option type values are still not officially assigned.
-The current implementation uses experimental values,
-which may cause interoperability problems with other implementations.
-.Pp
Information Refresh Time Option is not recognied in Info-req mode, since
.Nm
terminates after it receives a REPLY message.
diff --git a/dhcp6c.c b/dhcp6c.c
index f95eb07..2c98e96 100644
--- a/dhcp6c.c
+++ b/dhcp6c.c
@@ -1822,7 +1822,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
for (d = TAILQ_FIRST(&optinfo->sipname_list); d;
d = TAILQ_NEXT(d, link), i++) {
- info_printf("SIP server domain name[%d] %s",
+ info_printf("SIP domain name[%d] %s",
i, d->val_vbuf.dv_buf);
}
}
diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
index 57b33c8..c849a21 100644
--- a/dhcp6c.conf.5
+++ b/dhcp6c.conf.5
@@ -90,6 +90,30 @@ means a SIP Server address option.
.Ic sip-server-domain-name
.Xc
means a SIP server domain name option.
+.It Xo
+.Ic nis-server-address
+.Xc
+means a NIS Server address option.
+.It Xo
+.Ic nis-server-domain-name
+.Xc
+means a NIS domain name option.
+.It Xo
+.Ic nisp-server-address
+.Xc
+means a NIS+ Server address option.
+.It Xo
+.Ic nisp-server-domain-name
+.Xc
+means a NIS+ domain name option.
+.It Xo
+.Ic bcmcs-server-address
+.Xc
+means a BCMCS Server address option.
+.It Xo
+.Ic bcmcs-server-domain-name
+.Xc
+means a BCMCS server domain name option.
.It Ic ia-pd Ar ID
means an IA_PD
.Pq Identity Association for Prefix Delegation
@@ -206,10 +230,34 @@ will reject this option unless it is explicitly built to accept the option.
.Xc
requests a list of SIP server addresses.
.It Xo
-.Ic sip-server-domain-name
+.Ic sip-domain-name
.Xc
requests a SIP server domain name.
.It Xo
+.Ic nis-server-address
+.Xc
+requests a list of NIS server addresses.
+.It Xo
+.Ic nis-domain-name
+.Xc
+requests a NIS domain name.
+.It Xo
+.Ic nisp-server-address
+.Xc
+requests a list of NIS+ server addresses.
+.It Xo
+.Ic nisp-domain-name
+.Xc
+requests a NIS+ domain name.
+.It Xo
+.Ic bcmcs-server-address
+.Xc
+requests a list of BCMCS server addresses.
+.It Xo
+.Ic bcmcs-domain-name
+.Xc
+requests a BCMCS domain name.
+.It Xo
.Ic refreshtime
.Xc
means an information refresh time option.
@@ -217,10 +265,6 @@ This can only be specified when sent with information-request
messages;
.Nm dhcp6c
will ignore this option for other messages.
-As of this writing, the option type for this option is not officially
-assigned.
-.Nm dhcp6c
-will reject this option unless it is explicitly built to accept the option.
.El
Multiple
.Ic request
diff --git a/dhcp6c_script.c b/dhcp6c_script.c
index 28179eb..b052f18 100644
--- a/dhcp6c_script.c
+++ b/dhcp6c_script.c
@@ -60,11 +60,17 @@
#include "config.h"
#include "common.h"
-static char sipserver_str[] = "new_sip_name_servers";
+static char sipserver_str[] = "new_sip_servers";
static char sipname_str[] = "new_sip_name";
static char dnsserver_str[] = "new_domain_name_servers";
static char dnsname_str[] = "new_domain_name";
static char ntpserver_str[] = "new_ntp_servers";
+static char nisserver_str[] = "new_nis_servers";
+static char nisname_str[] = "new_nis_name";
+static char nispserver_str[] = "new_nisp_servers";
+static char nispname_str[] = "new_nisp_name";
+static char bcmcsserver_str[] = "new_bcmcs_servers";
+static char bcmcsname_str[] = "new_bcmcs_name";
static int safefile __P((const char *));
@@ -76,6 +82,9 @@ client6_script(scriptpath, state, optinfo)
{
int i, dnsservers, ntpservers, dnsnamelen, envc, elen, ret = 0;
int sipservers, sipnamelen;
+ int nisservers, nisnamelen;
+ int nispservers, nispnamelen;
+ int bcmcsservers, bcmcsnamelen;
char **envp, *s;
char reason[] = "REASON=NBI";
struct dhcp6_listval *v;
@@ -91,6 +100,12 @@ client6_script(scriptpath, state, optinfo)
dnsnamelen = 0;
sipservers = 0;
sipnamelen = 0;
+ nisservers = 0;
+ nisnamelen = 0;
+ nispservers = 0;
+ nispnamelen = 0;
+ bcmcsservers = 0;
+ bcmcsnamelen = 0;
envc = 2; /* we at least include the reason and the terminator */
/* count the number of variables */
@@ -114,6 +129,33 @@ client6_script(scriptpath, state, optinfo)
}
envc += sipnamelen ? 1 : 0;
+ for (v = TAILQ_FIRST(&optinfo->nis_list); v; v = TAILQ_NEXT(v, link))
+ nisservers++;
+ envc += nisservers ? 1 : 0;
+ for (v = TAILQ_FIRST(&optinfo->nisname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ nisnamelen += v->val_vbuf.dv_len;
+ }
+ envc += nisnamelen ? 1 : 0;
+
+ for (v = TAILQ_FIRST(&optinfo->nisp_list); v; v = TAILQ_NEXT(v, link))
+ nispservers++;
+ envc += nispservers ? 1 : 0;
+ for (v = TAILQ_FIRST(&optinfo->nispname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ nispnamelen += v->val_vbuf.dv_len;
+ }
+ envc += nispnamelen ? 1 : 0;
+
+ for (v = TAILQ_FIRST(&optinfo->bcmcs_list); v; v = TAILQ_NEXT(v, link))
+ bcmcsservers++;
+ envc += bcmcsservers ? 1 : 0;
+ for (v = TAILQ_FIRST(&optinfo->bcmcsname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ bcmcsnamelen += v->val_vbuf.dv_len;
+ }
+ envc += bcmcsnamelen ? 1 : 0;
+
/* allocate an environments array */
if ((envp = malloc(sizeof (char *) * envc)) == NULL) {
dprintf(LOG_NOTICE, FNAME,
@@ -216,7 +258,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (sipname_str) + sipnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
dprintf(LOG_NOTICE, FNAME,
- "failed to allocate strings for SIP server domain name");
+ "failed to allocate strings for SIP domain name");
ret = -1;
goto clean;
}
@@ -228,6 +270,118 @@ client6_script(scriptpath, state, optinfo)
strlcat(s, " ", elen);
}
}
+
+ if (nisservers) {
+ elen = sizeof (nisserver_str) +
+ (INET6_ADDRSTRLEN + 1) * nisservers + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for NIS servers");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", nisserver_str);
+ for (v = TAILQ_FIRST(&optinfo->nis_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ char *addr;
+
+ addr = in6addr2str(&v->val_addr6, 0);
+ strlcat(s, addr, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+ if (nisnamelen) {
+ elen = sizeof (nisname_str) + nisnamelen + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for NIS domain name");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", nisname_str);
+ for (v = TAILQ_FIRST(&optinfo->nisname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ strlcat(s, v->val_vbuf.dv_buf, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+
+ if (nispservers) {
+ elen = sizeof (nispserver_str) +
+ (INET6_ADDRSTRLEN + 1) * nispservers + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for NIS+ servers");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", nispserver_str);
+ for (v = TAILQ_FIRST(&optinfo->nisp_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ char *addr;
+
+ addr = in6addr2str(&v->val_addr6, 0);
+ strlcat(s, addr, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+ if (nispnamelen) {
+ elen = sizeof (nispname_str) + nispnamelen + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for NIS+ domain name");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", nispname_str);
+ for (v = TAILQ_FIRST(&optinfo->nispname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ strlcat(s, v->val_vbuf.dv_buf, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+
+ if (bcmcsservers) {
+ elen = sizeof (bcmcsserver_str) +
+ (INET6_ADDRSTRLEN + 1) * bcmcsservers + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for BCMC servers");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", bcmcsserver_str);
+ for (v = TAILQ_FIRST(&optinfo->bcmcs_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ char *addr;
+
+ addr = in6addr2str(&v->val_addr6, 0);
+ strlcat(s, addr, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+ if (bcmcsnamelen) {
+ elen = sizeof (bcmcsname_str) + bcmcsnamelen + 1;
+ if ((s = envp[i++] = malloc(elen)) == NULL) {
+ dprintf(LOG_NOTICE, FNAME,
+ "failed to allocate strings for BCMC domain name");
+ ret = -1;
+ goto clean;
+ }
+ memset(s, 0, elen);
+ snprintf(s, elen, "%s=", bcmcsname_str);
+ for (v = TAILQ_FIRST(&optinfo->bcmcsname_list); v;
+ v = TAILQ_NEXT(v, link)) {
+ strlcat(s, v->val_vbuf.dv_buf, elen);
+ strlcat(s, " ", elen);
+ }
+ }
+
/* launch the script */
pid = fork();
if (pid < 0) {
diff --git a/dhcp6s.8 b/dhcp6s.8
index 1700c9c..69b6e99 100644
--- a/dhcp6s.8
+++ b/dhcp6s.8
@@ -63,6 +63,18 @@ A list of the NTP server addresses
A list of the SIP server addresses
.It
SIP Server domain name
+.It
+A list of the NIS server addresses
+.It
+NIS domain name
+.It
+A list of the NIS+ server addresses
+.It
+NIS+ domain name
+.It
+A list of the BCMCS server addresses
+.It
+BCMCS Server domain name
.El
.Pp
Command line options are as below:
@@ -153,8 +165,4 @@ To name a few:
.It
it does not assign temporary IPv6 addresses
.Pq nor will .
-.It
-Some of useful option type values are still not officially assigned.
-The current implementation uses experimental values,
-which may cause interoperability problems with other implementations.
.El
diff --git a/dhcp6s.c b/dhcp6s.c
index cc17fc6..d92ffef 100644
--- a/dhcp6s.c
+++ b/dhcp6s.c
@@ -235,6 +235,12 @@ main(argc, argv)
TAILQ_INIT(&siplist);
TAILQ_INIT(&sipnamelist);
TAILQ_INIT(&ntplist);
+ TAILQ_INIT(&nislist);
+ TAILQ_INIT(&nisnamelist);
+ TAILQ_INIT(&nisplist);
+ TAILQ_INIT(&nispnamelist);
+ TAILQ_INIT(&bcmcslist);
+ TAILQ_INIT(&bcmcsnamelist);
srandom(time(NULL) & getpid());
while ((ch = getopt(argc, argv, "c:dDfk:n:p:P:")) != -1) {
@@ -1106,10 +1112,10 @@ set_statelessinfo(type, optinfo)
int type;
struct dhcp6_optinfo *optinfo;
{
- /* SIP server domain name */
+ /* SIP domain name */
if (dhcp6_copy_list(&optinfo->sipname_list, &sipnamelist)) {
dprintf(LOG_ERR, FNAME,
- "failed to copy SIP server domain list");
+ "failed to copy SIP domain list");
return (-1);
}
@@ -1137,6 +1143,45 @@ set_statelessinfo(type, optinfo)
return (-1);
}
+ /* NIS domain name */
+ if (dhcp6_copy_list(&optinfo->nisname_list, &nisnamelist)) {
+ dprintf(LOG_ERR, FNAME,
+ "failed to copy NIS domain list");
+ return (-1);
+ }
+
+ /* NIS server */
+ if (dhcp6_copy_list(&optinfo->nis_list, &nislist)) {
+ dprintf(LOG_ERR, FNAME, "failed to copy NIS servers");
+ return (-1);
+ }
+
+ /* NIS+ domain name */
+ if (dhcp6_copy_list(&optinfo->nispname_list, &nispnamelist)) {
+ dprintf(LOG_ERR, FNAME,
+ "failed to copy NIS+ domain list");
+ return (-1);
+ }
+
+ /* NIS+ server */
+ if (dhcp6_copy_list(&optinfo->nisp_list, &nisplist)) {
+ dprintf(LOG_ERR, FNAME, "failed to copy NIS+ servers");
+ return (-1);
+ }
+
+ /* BCMCS domain name */
+ if (dhcp6_copy_list(&optinfo->bcmcsname_list, &bcmcsnamelist)) {
+ dprintf(LOG_ERR, FNAME,
+ "failed to copy BCMCS domain list");
+ return (-1);
+ }
+
+ /* BCMCS server */
+ if (dhcp6_copy_list(&optinfo->bcmcs_list, &bcmcslist)) {
+ dprintf(LOG_ERR, FNAME, "failed to copy BCMCS servers");
+ return (-1);
+ }
+
/*
* Information refresh time. Only include in a response to
* an Information-request message.
diff --git a/dhcp6s.conf.5 b/dhcp6s.conf.5
index 93727f4..0d4f51c 100644
--- a/dhcp6s.conf.5
+++ b/dhcp6s.conf.5
@@ -127,6 +127,51 @@ provides a domain name of a SIP server.
Multiple names in the path can be specified by a sequence of these
statements.
.It Xo
+.Ic nis-server-address Ar nis-server-address Op Ar nis-server-addresses... ;
+.Xc
+provides NIS server address(es).
+Each
+.Ar nis-server-address
+must be a numeric IPv6 address.
+Multiple server addresses can also be specified by a sequence of
+these statements.
+.It Xo
+.Ic nis-server-domain-name Ar \(dqnis-server-domain-name\(dq ;
+.Xc
+provides a domain name of a NIS server.
+Multiple names in the path can be specified by a sequence of these
+statements.
+.It Xo
+.Ic nisp-server-address Ar nisp-server-address Op Ar nisp-server-addresses... ;
+.Xc
+provides NIS+ server address(es).
+Each
+.Ar nisp-server-address
+must be a numeric IPv6 address.
+Multiple server addresses can also be specified by a sequence of
+these statements.
+.It Xo
+.Ic nisp-server-domain-name Ar \(dqnisp-server-domain-name\(dq ;
+.Xc
+provides a domain name of a NIS+ server.
+Multiple names in the path can be specified by a sequence of these
+statements.
+.It Xo
+.Ic bcmcs-server-address Ar bcmcs-server-address Op Ar bcmcs-server-addresses... ;
+.Xc
+provides BCMCS server address(es).
+Each
+.Ar bcmcs-server-address
+must be a numeric IPv6 address.
+Multiple server addresses can also be specified by a sequence of
+these statements.
+.It Xo
+.Ic bcmcs-server-domain-name Ar \(dqbcmcs-server-domain-name\(dq ;
+.Xc
+provides a domain name of a BCMCS server.
+Multiple names in the path can be specified by a sequence of these
+statements.
+.It Xo
.Ic refreshtime Ar interval ;
.Xc
specifies the refresh time of stateless information that does not have