aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Corbier <jeremie.corbier@resel.enst-bretagne.fr>2010-03-25 10:07:03 +0100
committerBjørn Mork <bjorn@mork.no>2010-08-06 15:37:37 +0200
commitaeedae61d12778c4428a7e266913221269480162 (patch)
tree023ce3b78a8d62a129032fc6028d457f5e9199c1
parent2fa86d0c611b69e175c3b07116e9b67b85fe20ef (diff)
102_libc6-2.9-fixes.diff from the Debian package version 20080615-8:
"Fixes for recent libc releases." [ignoring changes to the build generated cftoken.c file] Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r--addrconf.c16
-rw-r--r--cftoken.l12
-rw-r--r--common.c226
-rw-r--r--common.h2
-rw-r--r--config.c268
-rwxr-xr-xconfigure50
-rw-r--r--configure.in7
-rw-r--r--dhcp6.h7
-rw-r--r--dhcp6_ctl.c40
-rw-r--r--dhcp6c.c246
-rw-r--r--dhcp6c_ia.c86
-rw-r--r--dhcp6c_script.c36
-rw-r--r--dhcp6relay.c118
-rw-r--r--dhcp6relay_script.c28
-rw-r--r--dhcp6s.c446
-rw-r--r--if.c12
-rw-r--r--lease.c14
-rw-r--r--prefixconf.c24
-rw-r--r--timer.c6
19 files changed, 853 insertions, 791 deletions
diff --git a/addrconf.c b/addrconf.c
index d98373f..98d03e5 100644
--- a/addrconf.c
+++ b/addrconf.c
@@ -122,7 +122,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
if (addr->vltime != DHCP6_DURATION_INFINITE &&
(addr->pltime == DHCP6_DURATION_INFINITE ||
addr->pltime > addr->vltime)) {
- dprintf(LOG_INFO, FNAME, "invalid address %s: "
+ debug_printf(LOG_INFO, FNAME, "invalid address %s: "
"pltime (%lu) is larger than vltime (%lu)",
in6addr2str(&addr->addr, 0),
addr->pltime, addr->vltime);
@@ -131,7 +131,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
if (iac_na == NULL) {
if ((iac_na = malloc(sizeof(*iac_na))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
+ debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
return (-1);
}
memset(iac_na, 0, sizeof(*iac_na));
@@ -152,7 +152,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
/* search for the given address, and make a new one if it fails */
if ((sa = find_addr(&iac_na->statefuladdr_head, addr)) == NULL) {
if ((sa = malloc(sizeof(*sa))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
+ debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
return (-1);
}
memset(sa, 0, sizeof(*sa));
@@ -169,7 +169,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
sa->addr.pltime = addr->pltime;
sa->addr.vltime = addr->vltime;
sa->dhcpif = dhcpifp;
- dprintf(LOG_DEBUG, FNAME, "%s an address %s pltime=%lu, vltime=%lu",
+ debug_printf(LOG_DEBUG, FNAME, "%s an address %s pltime=%lu, vltime=%lu",
sacreate ? "create" : "update",
in6addr2str(&addr->addr, 0), addr->pltime, addr->vltime);
@@ -194,7 +194,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
if (sa->timer == NULL) {
sa->timer = dhcp6_add_timer(addr_timo, sa);
if (sa->timer == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to add stateful addr timer");
remove_addr(sa); /* XXX */
return (-1);
@@ -233,7 +233,7 @@ remove_addr(sa)
{
int ret;
- dprintf(LOG_DEBUG, FNAME, "remove an address %s",
+ debug_printf(LOG_DEBUG, FNAME, "remove an address %s",
in6addr2str(&sa->addr.addr, 0));
if (sa->timer)
@@ -343,7 +343,7 @@ na_renew_data_free(evd)
struct dhcp6_list *ial;
if (evd->type != DHCP6_EVDATA_IANA) {
- dprintf(LOG_ERR, FNAME, "assumption failure");
+ debug_printf(LOG_ERR, FNAME, "assumption failure");
exit(1);
}
@@ -362,7 +362,7 @@ addr_timo(arg)
struct ia *ia;
void (*callback)__P((struct ia *));
- dprintf(LOG_DEBUG, FNAME, "address timeout for %s",
+ debug_printf(LOG_DEBUG, FNAME, "address timeout for %s",
in6addr2str(&sa->addr.addr, 0));
ia = sa->ctl->iacna_ia;
diff --git a/cftoken.l b/cftoken.l
index ece7fbb..ad4128d 100644
--- a/cftoken.l
+++ b/cftoken.l
@@ -340,10 +340,10 @@ cfdebug_print(w, t, l)
int l;
{
if (w) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"<%d>%s [%s] (%d)", yy_start, w, t, l);
} else {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"<%d>[%s] (%d)", yy_start, t, l);
}
}
@@ -359,7 +359,7 @@ yyerror0(int level, char *s, va_list ap)
if (bp < ep)
bp += vsnprintf(bp, ep - bp, s, ap);
- dprintf(level, FNAME, ebuf);
+ debug_printf(level, FNAME, ebuf);
}
void
@@ -397,7 +397,7 @@ cfswitch_buffer(incl)
FILE *fp;
if (incstackp >= MAX_INCLUDE_DEPTH) {
- dprintf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
+ debug_printf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
return (-1);
}
incstack[incstackp].path = configfilename;
@@ -406,7 +406,7 @@ cfswitch_buffer(incl)
fp = fopen(path, "r");
if (fp == NULL) {
- dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
path, strerror(errno));
if (errno == ENOENT)
return (0);
@@ -428,7 +428,7 @@ cfparse(conf)
{
configfilename = conf;
if ((yyin = fopen(configfilename, "r")) == NULL) {
- dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
configfilename, strerror(errno));
if (errno == ENOENT)
return (0);
diff --git a/common.c b/common.c
index f35399c..cc4abcc 100644
--- a/common.c
+++ b/common.c
@@ -265,7 +265,7 @@ dhcp6_add_listval(head, type, val, sublist)
struct dhcp6_listval *lv = NULL;
if ((lv = malloc(sizeof(*lv))) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to allocate memory for list entry");
goto fail;
}
@@ -298,7 +298,7 @@ dhcp6_add_listval(head, type, val, sublist)
goto fail;
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"unexpected list value type (%d)", type);
goto fail;
}
@@ -361,7 +361,7 @@ dhcp6_get_addr(optlen, cp, type, list)
void *val;
if (optlen % sizeof(struct in6_addr) || optlen == 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"malformed DHCP option: type %d, len %d", type, optlen);
return -1;
}
@@ -371,14 +371,14 @@ dhcp6_get_addr(optlen, cp, type, list)
memcpy(&valaddr, val, sizeof(valaddr));
if (dhcp6_find_listval(list,
DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
- dprintf(LOG_INFO, FNAME, "duplicated %s address (%s)",
+ debug_printf(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,
+ debug_printf(LOG_ERR, FNAME,
"failed to copy %s address", dhcp6optstr(type));
return -1;
}
@@ -405,7 +405,7 @@ dhcp6_set_addr(type, list, p, optep, len)
tmpbuf = NULL;
optlen = dhcp6_count_list(list) * sizeof(struct in6_addr);
if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation failed for %s options",
dhcp6optstr(type));
return -1;
@@ -438,10 +438,10 @@ dhcp6_get_domain(optlen, cp, type, list)
if (dnsdecode((u_char **)(void *)&val,
(u_char *)(cp + optlen), name, sizeof(name)) == NULL) {
- dprintf(LOG_INFO, FNAME, "failed to "
+ debug_printf(LOG_INFO, FNAME, "failed to "
"decode a %s domain name",
dhcp6optstr(type));
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"malformed DHCP option: type %d, len %d",
type, optlen);
return -1;
@@ -452,7 +452,7 @@ dhcp6_get_domain(optlen, cp, type, list)
if (dhcp6_add_listval(list,
DHCP6_LISTVAL_VBUF, &vb, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
+ debug_printf(LOG_ERR, FNAME, "failed to "
"copy a %s domain name", dhcp6optstr(type));
return -1;
}
@@ -485,7 +485,7 @@ dhcp6_set_domain(type, list, p, optep, len)
tmpbuf = NULL;
if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed for "
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed for "
"%s domain options", dhcp6optstr(type));
return -1;
}
@@ -497,14 +497,14 @@ dhcp6_set_domain(type, list, p, optep, len)
nlen = dnsencode((const char *)d->val_vbuf.dv_buf,
name, sizeof (name));
if (nlen < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to encode a %s domain name",
dhcp6optstr(type));
free(tmpbuf);
return -1;
}
if (ep - cp < nlen) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"buffer length for %s domain name is too short",
dhcp6optstr(type));
free(tmpbuf);
@@ -530,7 +530,7 @@ dhcp6_create_event(ifp, state)
struct dhcp6_event *ev;
if ((ev = malloc(sizeof(*ev))) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to allocate memory for an event");
return (NULL);
}
@@ -548,7 +548,7 @@ dhcp6_remove_event(ev)
{
struct dhcp6_serverinfo *sp, *sp_next;
- dprintf(LOG_DEBUG, FNAME, "removing an event on %s, state=%s",
+ debug_printf(LOG_DEBUG, FNAME, "removing an event on %s, state=%s",
ev->ifp->ifname, dhcp6_event_statestr(ev));
dhcp6_remove_evdata(ev);
@@ -562,7 +562,7 @@ dhcp6_remove_event(ev)
for (sp = ev->servers; sp; sp = sp_next) {
sp_next = sp->next;
- dprintf(LOG_DEBUG, FNAME, "removing server (ID: %s)",
+ debug_printf(LOG_DEBUG, FNAME, "removing server (ID: %s)",
duidstr(&sp->optinfo.serverID));
dhcp6_clear_options(&sp->optinfo);
if (sp->authparam != NULL)
@@ -649,14 +649,14 @@ dhcp6_auth_replaycheck(method, prev, current)
char bufcurrent[] = "ffff ffff ffff ffff";
if (method != DHCP6_AUTHRDM_MONOCOUNTER) {
- dprintf(LOG_ERR, FNAME, "unsupported replay detection "
+ debug_printf(LOG_ERR, FNAME, "unsupported replay detection "
"method (%d)", method);
return (-1);
}
(void)sprint_uint64(bufprev, sizeof(bufprev), prev);
(void)sprint_uint64(bufcurrent, sizeof(bufcurrent), current);
- dprintf(LOG_DEBUG, FNAME, "previous: %s, current: %s",
+ debug_printf(LOG_DEBUG, FNAME, "previous: %s, current: %s",
bufprev, bufcurrent);
prev = ntohq(prev);
@@ -667,7 +667,7 @@ dhcp6_auth_replaycheck(method, prev, current)
* whether the serial number is increasing or not.
*/
if (prev == (current ^ 0x8000000000000000ULL)) {
- dprintf(LOG_INFO, FNAME, "detected a singular point");
+ debug_printf(LOG_INFO, FNAME, "detected a singular point");
return (1);
}
@@ -688,7 +688,7 @@ getifaddr(addr, ifnam, prefix, plen, strong, ignoreflags)
int error = -1;
if (getifaddrs(&ifap) != 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"getifaddrs failed: %s", strerror(errno));
return (-1);
}
@@ -765,7 +765,7 @@ getifidfromaddr(addr, ifidp)
int retval = -1;
if (getifaddrs(&ifap) != 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"getifaddrs failed: %s", strerror(errno));
return (-1);
}
@@ -781,7 +781,7 @@ getifidfromaddr(addr, ifidp)
if (ifa != NULL) {
if ((ifid = if_nametoindex(ifa->ifa_name)) == 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"if_nametoindex failed for %s", ifa->ifa_name);
goto end;
}
@@ -999,20 +999,20 @@ get_duid(idfile, duid)
char tmpbuf[256]; /* DUID should be no more than 256 bytes */
if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
- dprintf(LOG_NOTICE, FNAME, "failed to open DUID file: %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to open DUID file: %s",
idfile);
if (fp) {
/* decode length */
if (fread(&len, sizeof(len), 1, fp) != 1) {
- dprintf(LOG_ERR, FNAME, "DUID file corrupted");
+ debug_printf(LOG_ERR, FNAME, "DUID file corrupted");
goto fail;
}
} else {
int l;
if ((l = gethwid(tmpbuf, sizeof(tmpbuf), NULL, &hwtype)) < 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to get a hardware address");
goto fail;
}
@@ -1022,18 +1022,18 @@ get_duid(idfile, duid)
memset(duid, 0, sizeof(*duid));
duid->duid_len = len;
if ((duid->duid_id = (char *)malloc(len)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to allocate memory");
+ debug_printf(LOG_ERR, FNAME, "failed to allocate memory");
goto fail;
}
/* copy (and fill) the ID */
if (fp) {
if (fread(duid->duid_id, len, 1, fp) != 1) {
- dprintf(LOG_ERR, FNAME, "DUID file corrupted");
+ debug_printf(LOG_ERR, FNAME, "DUID file corrupted");
goto fail;
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"extracted an existing DUID from %s: %s",
idfile, duidstr(duid));
} else {
@@ -1047,27 +1047,27 @@ get_duid(idfile, duid)
dp->dh6_duid1_time = htonl((u_long)(t64 & 0xffffffff));
memcpy((void *)(dp + 1), tmpbuf, (len - sizeof(*dp)));
- dprintf(LOG_DEBUG, FNAME, "generated a new DUID: %s",
+ debug_printf(LOG_DEBUG, FNAME, "generated a new DUID: %s",
duidstr(duid));
}
/* save the (new) ID to the file for next time */
if (!fp) {
if ((fp = fopen(idfile, "w+")) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to open DUID file for save");
goto fail;
}
if ((fwrite(&len, sizeof(len), 1, fp)) != 1) {
- dprintf(LOG_ERR, FNAME, "failed to save DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to save DUID");
goto fail;
}
if ((fwrite(duid->duid_id, len, 1, fp)) != 1) {
- dprintf(LOG_ERR, FNAME, "failed to save DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to save DUID");
goto fail;
}
- dprintf(LOG_DEBUG, FNAME, "saved generated DUID to %s",
+ debug_printf(LOG_DEBUG, FNAME, "saved generated DUID to %s",
idfile);
}
@@ -1104,7 +1104,7 @@ getifhwaddr(const char *ifname, char *buf, u_int16_t *hwtypep, int ppa)
dl_phys_addr_req_t dlpar;
dl_phys_addr_ack_t *dlpaa;
- dprintf(LOG_DEBUG, FNAME, "trying %s ppa %d", ifname, ppa);
+ debug_printf(LOG_DEBUG, FNAME, "trying %s ppa %d", ifname, ppa);
if (ifname[0] == '\0')
return (-1);
@@ -1239,7 +1239,7 @@ gethwid(buf, len, ifname, hwtypep)
if ((root = di_init("/", DINFOSUBTREE | DINFOMINOR |
DINFOPROP)) == DI_NODE_NIL) {
- dprintf(LOG_INFO, FNAME, "di_init failed");
+ debug_printf(LOG_INFO, FNAME, "di_init failed");
return (-1);
}
parms.buf = buf;
@@ -1283,7 +1283,7 @@ gethwid(buf, len, ifname, hwtypep)
default:
continue; /* XXX */
}
- dprintf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
+ debug_printf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
ifa->ifa_name);
memcpy(buf, LLADDR(sdl), sdl->sdl_alen);
l = sdl->sdl_alen; /* sdl will soon be freed */
@@ -1296,7 +1296,7 @@ gethwid(buf, len, ifname, hwtypep)
if (sll->sll_hatype != ARPHRD_ETHER)
continue;
*hwtypep = ARPHRD_ETHER;
- dprintf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
+ debug_printf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
ifa->ifa_name);
memcpy(buf, sll->sll_addr, sll->sll_halen);
l = sll->sll_halen; /* sll will soon be freed */
@@ -1512,12 +1512,12 @@ dhcp6_get_options(p, ep, optinfo)
cp = (char *)(p + 1);
np = (struct dhcp6opt *)(cp + optlen);
- dprintf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
+ debug_printf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
dhcp6optstr(opt), optlen);
/* option length field overrun */
if (np > ep) {
- dprintf(LOG_INFO, FNAME, "malformed DHCP options");
+ debug_printf(LOG_INFO, FNAME, "malformed DHCP options");
goto fail;
}
@@ -1527,10 +1527,10 @@ dhcp6_get_options(p, ep, optinfo)
goto malformed;
duid0.duid_len = optlen;
duid0.duid_id = cp;
- dprintf(LOG_DEBUG, "",
+ debug_printf(LOG_DEBUG, "",
" DUID: %s", duidstr(&duid0));
if (duidcpy(&optinfo->clientID, &duid0)) {
- dprintf(LOG_ERR, FNAME, "failed to copy DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy DUID");
goto fail;
}
break;
@@ -1539,9 +1539,9 @@ dhcp6_get_options(p, ep, optinfo)
goto malformed;
duid0.duid_len = optlen;
duid0.duid_id = cp;
- dprintf(LOG_DEBUG, "", " DUID: %s", duidstr(&duid0));
+ debug_printf(LOG_DEBUG, "", " DUID: %s", duidstr(&duid0));
if (duidcpy(&optinfo->serverID, &duid0)) {
- dprintf(LOG_ERR, FNAME, "failed to copy DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy DUID");
goto fail;
}
break;
@@ -1550,14 +1550,14 @@ dhcp6_get_options(p, ep, optinfo)
goto malformed;
memcpy(&val16, cp, sizeof(val16));
num16 = ntohs(val16);
- dprintf(LOG_DEBUG, "", " status code: %s",
+ debug_printf(LOG_DEBUG, "", " status code: %s",
dhcp6_stcodestr(num16));
/* need to check duplication? */
if (dhcp6_add_listval(&optinfo->stcode_list,
DHCP6_LISTVAL_STCODE, &num16, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy "
+ debug_printf(LOG_ERR, FNAME, "failed to copy "
"status code");
goto fail;
}
@@ -1574,13 +1574,13 @@ dhcp6_get_options(p, ep, optinfo)
memcpy(&opttype, val, sizeof(u_int16_t));
num = (int)ntohs(opttype);
- dprintf(LOG_DEBUG, "",
+ debug_printf(LOG_DEBUG, "",
" requested option: %s",
dhcp6optstr(num));
if (dhcp6_find_listval(&optinfo->reqopt_list,
DHCP6_LISTVAL_NUM, &num, 0)) {
- dprintf(LOG_INFO, FNAME, "duplicated "
+ debug_printf(LOG_INFO, FNAME, "duplicated "
"option type (%s)",
dhcp6optstr(opttype));
goto nextoption;
@@ -1588,7 +1588,7 @@ dhcp6_get_options(p, ep, optinfo)
if (dhcp6_add_listval(&optinfo->reqopt_list,
DHCP6_LISTVAL_NUM, &num, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to copy requested option");
goto fail;
}
@@ -1599,10 +1599,10 @@ dhcp6_get_options(p, ep, optinfo)
case DH6OPT_PREFERENCE:
if (optlen != 1)
goto malformed;
- dprintf(LOG_DEBUG, "", " preference: %d",
+ debug_printf(LOG_DEBUG, "", " preference: %d",
(int)*(u_char *)cp);
if (optinfo->pref != DH6OPT_PREF_UNDEF) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated preference option");
} else
optinfo->pref = (int)*(u_char *)cp;
@@ -1612,11 +1612,11 @@ dhcp6_get_options(p, ep, optinfo)
goto malformed;
memcpy(&val16, cp, sizeof(val16));
val16 = ntohs(val16);
- dprintf(LOG_DEBUG, "", " elapsed time: %lu",
+ debug_printf(LOG_DEBUG, "", " elapsed time: %lu",
(u_int32_t)val16);
if (optinfo->elapsed_time !=
DH6OPT_ELAPSED_TIME_UNDEF) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated elapsed time option");
} else
optinfo->elapsed_time = val16;
@@ -1637,7 +1637,7 @@ dhcp6_get_options(p, ep, optinfo)
* [RFC3315 Section 21.4.2]
*/
if (optinfo->authproto != DHCP6_AUTHPROTO_UNDEF) {
- dprintf(LOG_INFO, FNAME, "found more than one "
+ debug_printf(LOG_INFO, FNAME, "found more than one "
"authentication option");
goto fail;
}
@@ -1648,7 +1648,7 @@ dhcp6_get_options(p, ep, optinfo)
memcpy(&optinfo->authrd, cp, sizeof(optinfo->authrd));
cp += sizeof(optinfo->authrd);
- dprintf(LOG_DEBUG, "", " %s", sprint_auth(optinfo));
+ debug_printf(LOG_DEBUG, "", " %s", sprint_auth(optinfo));
authinfolen =
optlen - (sizeof(struct dhcp6opt_auth) - 4);
@@ -1670,7 +1670,7 @@ dhcp6_get_options(p, ep, optinfo)
optinfo->delayedauth_realmval =
malloc(optinfo->delayedauth_realmlen);
if (optinfo->delayedauth_realmval == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed "
+ debug_printf(LOG_WARNING, FNAME, "failed "
"allocate memory for auth realm");
goto fail;
}
@@ -1687,7 +1687,7 @@ dhcp6_get_options(p, ep, optinfo)
optinfo->delayedauth_offset = cp - bp;
cp += 16;
- dprintf(LOG_DEBUG, "", " auth key ID: %x, "
+ debug_printf(LOG_DEBUG, "", " auth key ID: %x, "
"offset=%d, realmlen=%d",
optinfo->delayedauth_keyid,
optinfo->delayedauth_offset,
@@ -1698,7 +1698,7 @@ dhcp6_get_options(p, ep, optinfo)
break;
#endif
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unsupported authentication protocol: %d",
*cp);
goto fail;
@@ -1779,14 +1779,14 @@ dhcp6_get_options(p, ep, optinfo)
ia.t1 = ntohl(optia.dh6_ia_t1);
ia.t2 = ntohl(optia.dh6_ia_t2);
- dprintf(LOG_DEBUG, "",
+ debug_printf(LOG_DEBUG, "",
" IA_PD: ID=%lu, T1=%lu, T2=%lu",
ia.iaid, ia.t1, ia.t2);
/* duplication check */
if (dhcp6_find_listval(&optinfo->iapd_list,
DHCP6_LISTVAL_IAPD, &ia, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated IA_PD %lu", ia.iaid);
break; /* ignore this IA_PD */
}
@@ -1813,7 +1813,7 @@ dhcp6_get_options(p, ep, optinfo)
goto malformed;
memcpy(&val32, cp, sizeof(val32));
val32 = ntohl(val32);
- dprintf(LOG_DEBUG, "",
+ debug_printf(LOG_DEBUG, "",
" information refresh time: %lu", val32);
if (val32 < DHCP6_IRT_MINIMUM) {
/*
@@ -1823,13 +1823,13 @@ dhcp6_get_options(p, ep, optinfo)
* [draft-ietf-dhc-lifetime-02.txt,
* Section 3.2]
*/
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"refresh time is too small (%d), adjusted",
val32);
val32 = DHCP6_IRT_MINIMUM;
}
if (optinfo->refreshtime != DH6OPT_REFRESHTIME_UNDEF) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated refresh time option");
} else
optinfo->refreshtime = (int64_t)val32;
@@ -1843,14 +1843,14 @@ dhcp6_get_options(p, ep, optinfo)
ia.t1 = ntohl(optia.dh6_ia_t1);
ia.t2 = ntohl(optia.dh6_ia_t2);
- dprintf(LOG_DEBUG, "",
+ debug_printf(LOG_DEBUG, "",
" IA_NA: ID=%lu, T1=%lu, T2=%lu",
ia.iaid, ia.t1, ia.t2);
/* duplication check */
if (dhcp6_find_listval(&optinfo->iana_list,
DHCP6_LISTVAL_IANA, &ia, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated IA_NA %lu", ia.iaid);
break; /* ignore this IA_NA */
}
@@ -1874,7 +1874,7 @@ dhcp6_get_options(p, ep, optinfo)
break;
default:
/* no option specific behavior */
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown or unexpected DHCP6 option %s, len %d",
dhcp6optstr(opt), optlen);
break;
@@ -1884,7 +1884,7 @@ dhcp6_get_options(p, ep, optinfo)
return (0);
malformed:
- dprintf(LOG_INFO, FNAME, "malformed DHCP option: type %d, len %d",
+ debug_printf(LOG_INFO, FNAME, "malformed DHCP option: type %d, len %d",
opt, optlen);
fail:
dhcp6_clear_options(optinfo);
@@ -1967,11 +1967,11 @@ copyin_option(type, p, ep, list)
cp = (char *)(p + 1);
np = (struct dhcp6opt *)(cp + optlen);
- dprintf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
+ debug_printf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
dhcp6optstr(opt), optlen);
if (np > ep) {
- dprintf(LOG_INFO, FNAME, "malformed DHCP option");
+ debug_printf(LOG_INFO, FNAME, "malformed DHCP option");
goto fail;
}
@@ -1979,7 +1979,7 @@ copyin_option(type, p, ep, list)
case DH6OPT_IA_PD_PREFIX:
/* check option context */
if (type != DH6OPT_IA_PD) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s is an invalid position for %s",
dhcp6optstr(type), dhcp6optstr(opt));
goto fail;
@@ -1991,7 +1991,7 @@ copyin_option(type, p, ep, list)
/* copy and convert option values */
memcpy(&opt_iapd_prefix, p, sizeof(opt_iapd_prefix));
if (opt_iapd_prefix.dh6_iapd_prefix_prefix_len > 128) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"invalid prefix length (%d)",
opt_iapd_prefix.dh6_iapd_prefix_prefix_len);
goto malformed;
@@ -2006,7 +2006,7 @@ copyin_option(type, p, ep, list)
/* clear padding bits in the prefix address */
prefix6_mask(&iapd_prefix.addr, iapd_prefix.plen);
- dprintf(LOG_DEBUG, FNAME, " IA_PD prefix: "
+ debug_printf(LOG_DEBUG, FNAME, " IA_PD prefix: "
"%s/%d pltime=%lu vltime=%lu",
in6addr2str(&iapd_prefix.addr, 0),
iapd_prefix.plen,
@@ -2014,7 +2014,7 @@ copyin_option(type, p, ep, list)
if (dhcp6_find_listval(list, DHCP6_LISTVAL_PREFIX6,
&iapd_prefix, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated IA_PD prefix "
"%s/%d pltime=%lu vltime=%lu",
in6addr2str(&iapd_prefix.addr, 0),
@@ -2041,7 +2041,7 @@ copyin_option(type, p, ep, list)
case DH6OPT_IAADDR:
/* check option context */
if (type != DH6OPT_IA_NA) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s is an invalid position for %s",
dhcp6optstr(type), dhcp6optstr(opt));
goto fail;
@@ -2057,14 +2057,14 @@ copyin_option(type, p, ep, list)
memcpy(&ia_addr.addr, &opt_ia_addr.dh6_ia_addr_addr,
sizeof(ia_addr.addr));
- dprintf(LOG_DEBUG, FNAME, " IA_NA address: "
+ debug_printf(LOG_DEBUG, FNAME, " IA_NA address: "
"%s pltime=%lu vltime=%lu",
in6addr2str(&ia_addr.addr, 0),
ia_addr.pltime, ia_addr.vltime);
if (dhcp6_find_listval(list,
DHCP6_LISTVAL_STATEFULADDR6, &ia_addr, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated IA_NA address"
"%s pltime=%lu vltime=%lu",
in6addr2str(&ia_addr.addr, 0),
@@ -2093,7 +2093,7 @@ copyin_option(type, p, ep, list)
type != DH6OPT_IA_PD_PREFIX &&
type != DH6OPT_IA_NA &&
type != DH6OPT_IAADDR) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s is an invalid position for %s",
dhcp6optstr(type), dhcp6optstr(opt));
goto nextoption; /* or discard the message? */
@@ -2107,13 +2107,13 @@ copyin_option(type, p, ep, list)
opt_stcode.dh6_stcode_code =
ntohs(opt_stcode.dh6_stcode_code);
- dprintf(LOG_DEBUG, "", " status code: %s",
+ debug_printf(LOG_DEBUG, "", " status code: %s",
dhcp6_stcodestr(opt_stcode.dh6_stcode_code));
/* duplication check */
if (dhcp6_find_listval(list, DHCP6_LISTVAL_STCODE,
&opt_stcode.dh6_stcode_code, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated status code (%d)",
opt_stcode.dh6_stcode_code);
goto nextoption;
@@ -2133,7 +2133,7 @@ copyin_option(type, p, ep, list)
return (0);
malformed:
- dprintf(LOG_INFO, "", " malformed DHCP option: type %d", opt);
+ debug_printf(LOG_INFO, "", " malformed DHCP option: type %d", opt);
fail:
dhcp6_clear_list(&sublist);
@@ -2221,7 +2221,7 @@ copy_option(type, len, val, optp, ep, totallenp)
struct dhcp6opt *opt = *optp, opth;
if ((void *)ep - (void *)optp < len + sizeof(struct dhcp6opt)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"option buffer short for %s", dhcp6optstr(type));
return (-1);
}
@@ -2233,7 +2233,7 @@ copy_option(type, len, val, optp, ep, totallenp)
*optp = (struct dhcp6opt *)((char *)(opt + 1) + len);
*totallenp += sizeof(struct dhcp6opt) + len;
- dprintf(LOG_DEBUG, FNAME, "set %s (len %d)", dhcp6optstr(type), len);
+ debug_printf(LOG_DEBUG, FNAME, "set %s (len %d)", dhcp6optstr(type), len);
return (0);
}
@@ -2269,21 +2269,21 @@ dhcp6_set_options(type, optbp, optep, optinfo)
tmpbuf = NULL;
if ((optlen = copyout_option(NULL, NULL, op)) < 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to count option length");
goto fail;
}
if ((void *)optep - (void *)p < optlen) {
- dprintf(LOG_INFO, FNAME, "short buffer");
+ debug_printf(LOG_INFO, FNAME, "short buffer");
goto fail;
}
if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"memory allocation failed for IA_NA options");
goto fail;
}
if (copyout_option(tmpbuf, tmpbuf + optlen, op) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to construct an IA_NA option");
goto fail;
}
@@ -2340,7 +2340,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
buflen = dhcp6_count_list(&optinfo->reqopt_list) *
sizeof(u_int16_t);
if ((tmpbuf = malloc(buflen)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation failed for options");
goto fail;
}
@@ -2355,7 +2355,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
*/
if (opt->val_num == DH6OPT_REFRESHTIME &&
type != DH6_INFORM_REQ) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"refresh time option is not requested "
"for %s", dhcp6msgstr(type));
}
@@ -2423,21 +2423,21 @@ dhcp6_set_options(type, optbp, optep, optinfo)
tmpbuf = NULL;
if ((optlen = copyout_option(NULL, NULL, op)) < 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to count option length");
goto fail;
}
if ((void *)optep - (void *)p < optlen) {
- dprintf(LOG_INFO, FNAME, "short buffer");
+ debug_printf(LOG_INFO, FNAME, "short buffer");
goto fail;
}
if ((tmpbuf = malloc(optlen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"memory allocation failed for IA_PD options");
goto fail;
}
if (copyout_option(tmpbuf, tmpbuf + optlen, op) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to construct an IA_PD option");
goto fail;
}
@@ -2492,13 +2492,13 @@ dhcp6_set_options(type, optbp, optep, optinfo)
break;
#endif
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"unexpected authentication protocol");
goto fail;
}
}
if ((auth = malloc(authlen)) == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed to allocate "
+ debug_printf(LOG_WARNING, FNAME, "failed to allocate "
"memory for authentication information");
goto fail;
}
@@ -2534,7 +2534,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
optinfo->delayedauth_offset =
((char *)p - (char *)optbp) + authlen - 16;
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"key ID %x, offset %d",
optinfo->delayedauth_keyid,
optinfo->delayedauth_offset);
@@ -2543,7 +2543,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
case DHCP6_AUTHPROTO_RECONFIG:
#endif
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"unexpected authentication protocol");
free(auth);
goto fail;
@@ -2695,7 +2695,7 @@ copyout_option(p, ep, optval)
* we encounter an unknown option. this should be an internal
* error.
*/
- dprintf(LOG_ERR, FNAME, "unknown option: code %d",
+ debug_printf(LOG_ERR, FNAME, "unknown option: code %d",
optval->type);
return (-1);
}
@@ -2721,7 +2721,7 @@ copyout_option(p, ep, optval)
if (!p)
return(optlen);
- dprintf(LOG_DEBUG, FNAME, "set %s", dhcp6optstr(opttype));
+ debug_printf(LOG_DEBUG, FNAME, "set %s", dhcp6optstr(opttype));
if (ep - p < headlen) /* check it just in case */
return (-1);
@@ -2812,7 +2812,7 @@ dhcp6_set_timeoparam(ev)
ev->max_retrans_cnt = REL_MAX_RC;
break;
default:
- dprintf(LOG_ERR, FNAME, "unexpected event state %d on %s",
+ debug_printf(LOG_ERR, FNAME, "unexpected event state %d on %s",
ev->state, ev->ifp->ifname);
exit(1);
}
@@ -2870,7 +2870,7 @@ dhcp6_reset_timer(ev)
statestr = dhcp6_event_statestr(ev);
- dprintf(LOG_DEBUG, FNAME, "reset a timer on %s, "
+ debug_printf(LOG_DEBUG, FNAME, "reset a timer on %s, "
"state=%s, timeo=%d, retrans=%d",
ev->ifp->ifname, statestr, ev->timeouts, ev->retrans);
}
@@ -2881,7 +2881,7 @@ duidcpy(dd, ds)
{
dd->duid_len = ds->duid_len;
if ((dd->duid_id = malloc(dd->duid_len)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
return (-1);
}
memcpy(dd->duid_id, ds->duid_id, dd->duid_len);
@@ -2929,17 +2929,17 @@ get_rdvalue(rdm, rdvalue, rdsize)
u_int32_t u32, l32;
if (rdm != DHCP6_AUTHRDM_MONOCOUNTER) {
- dprintf(LOG_INFO, FNAME, "unsupported RDM (%d)", rdm);
+ debug_printf(LOG_INFO, FNAME, "unsupported RDM (%d)", rdm);
return (-1);
}
if (rdsize != sizeof(u_int64_t)) {
- dprintf(LOG_INFO, FNAME, "unsupported RD size (%d)", rdsize);
+ debug_printf(LOG_INFO, FNAME, "unsupported RD size (%d)", rdsize);
return (-1);
}
#if defined(HAVE_CLOCK_GETTIME)
if (clock_gettime(CLOCK_REALTIME, &tp)) {
- dprintf(LOG_WARNING, FNAME, "clock_gettime failed: %s",
+ debug_printf(LOG_WARNING, FNAME, "clock_gettime failed: %s",
strerror(errno));
return (-1);
}
@@ -2952,7 +2952,7 @@ get_rdvalue(rdm, rdvalue, rdsize)
l32 = (u_int32_t)nsec;
#else
if (gettimeofday(&tv, NULL) != 0) {
- dprintf(LOG_WARNING, FNAME, "gettimeofday failed: %s",
+ debug_printf(LOG_WARNING, FNAME, "gettimeofday failed: %s",
strerror(errno));
return (-1);
}
@@ -3207,7 +3207,7 @@ setloglevel(debuglevel)
}
void
-dprintf(int level, const char *fname, const char *fmt, ...)
+debug_printf(int level, const char *fname, const char *fmt, ...)
{
va_list ap;
char logbuf[LINE_MAX];
@@ -3293,7 +3293,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
}
if ((s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
- dprintf(LOG_ERR, FNAME, "can't open a temporary socket: %s",
+ debug_printf(LOG_ERR, FNAME, "can't open a temporary socket: %s",
strerror(errno));
return (-1);
}
@@ -3311,7 +3311,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
if (ioctl(s, SIOGIFINDEX, &ifr) < 0) {
- dprintf(LOG_NOTICE, FNAME, "failed to get the index of %s: %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to get the index of %s: %s",
ifname, strerror(errno));
close(s);
return (-1);
@@ -3325,7 +3325,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
#endif
if (ioctl(s, ioctl_cmd, &req)) {
- dprintf(LOG_NOTICE, FNAME, "failed to %s an address on %s: %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to %s an address on %s: %s",
cmdstr, ifname, strerror(errno));
close(s);
return (-1);
@@ -3334,14 +3334,14 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
#ifdef __sun__
memcpy(&req.lifr_addr, addr, sizeof (*addr));
if (ioctl(s, SIOCSLIFADDR, &req) == -1) {
- dprintf(LOG_NOTICE, FNAME, "failed to %s new address on %s: %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to %s new address on %s: %s",
cmdstr, ifname, strerror(errno));
close(s);
return (-1);
}
#endif
- dprintf(LOG_DEBUG, FNAME, "%s an address %s/%d on %s", cmdstr,
+ debug_printf(LOG_DEBUG, FNAME, "%s an address %s/%d on %s", cmdstr,
addr2str((struct sockaddr *)addr), plen, ifname);
close(s);
@@ -3357,13 +3357,13 @@ safefile(path)
/* no setuid */
if (getuid() != geteuid()) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"setuid'ed execution not allowed");
return (-1);
}
if (lstat(path, &s) != 0) {
- dprintf(LOG_NOTICE, FNAME, "lstat failed: %s",
+ debug_printf(LOG_NOTICE, FNAME, "lstat failed: %s",
strerror(errno));
return (-1);
}
@@ -3371,7 +3371,7 @@ safefile(path)
/* the file must be owned by the running uid */
myuid = getuid();
if (s.st_uid != myuid) {
- dprintf(LOG_NOTICE, FNAME, "%s has invalid owner uid", path);
+ debug_printf(LOG_NOTICE, FNAME, "%s has invalid owner uid", path);
return (-1);
}
@@ -3379,7 +3379,7 @@ safefile(path)
case S_IFREG:
break;
default:
- dprintf(LOG_NOTICE, FNAME, "%s is an invalid file type 0x%o",
+ debug_printf(LOG_NOTICE, FNAME, "%s is an invalid file type 0x%o",
path, (s.st_mode & S_IFMT));
return (-1);
}
diff --git a/common.h b/common.h
index 7366c25..9fd8008 100644
--- a/common.h
+++ b/common.h
@@ -155,7 +155,7 @@ extern char *in6addr2str __P((struct in6_addr *, int));
extern int in6_addrscopebyif __P((struct in6_addr *, char *));
extern int in6_scope __P((struct in6_addr *));
extern void setloglevel __P((int));
-extern void dprintf __P((int, const char *, const char *, ...));
+extern void debug_printf __P((int, const char *, const char *, ...));
extern int get_duid __P((char *, struct duid *));
extern void dhcp6_init_options __P((struct dhcp6_optinfo *));
extern void dhcp6_clear_options __P((struct dhcp6_optinfo *));
diff --git a/config.c b/config.c
index 383c12a..3721545 100644
--- a/config.c
+++ b/config.c
@@ -156,13 +156,13 @@ configure_interface(iflist)
struct cf_list *cfl;
if (if_nametoindex(ifp->name) == 0) {
- dprintf(LOG_ERR, FNAME, "invalid interface(%s): %s",
+ debug_printf(LOG_ERR, FNAME, "invalid interface(%s): %s",
ifp->name, strerror(errno));
goto bad;
}
if ((ifc = malloc(sizeof(*ifc))) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation for %s failed", ifp->name);
goto bad;
}
@@ -171,7 +171,7 @@ configure_interface(iflist)
dhcp6_ifconflist = ifc;
if ((ifc->ifname = strdup(ifp->name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy ifname");
+ debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
goto bad;
}
@@ -183,7 +183,7 @@ configure_interface(iflist)
switch(cfl->type) {
case DECL_REQUEST:
if (dhcp6_mode != DHCP6_MODE_CLIENT) {
- dprintf(LOG_INFO, FNAME, "%s:%d "
+ debug_printf(LOG_INFO, FNAME, "%s:%d "
"client-only configuration",
configfilename,
cfl->line);
@@ -208,7 +208,7 @@ configure_interface(iflist)
break;
case DECL_INFO_ONLY:
if (dhcp6_mode != DHCP6_MODE_CLIENT) {
- dprintf(LOG_INFO, FNAME, "%s:%d "
+ debug_printf(LOG_INFO, FNAME, "%s:%d "
"client-only configuration",
configfilename, cfl->line);
goto bad;
@@ -217,7 +217,7 @@ configure_interface(iflist)
break;
case DECL_PREFERENCE:
if (dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_INFO, FNAME, "%s:%d "
+ debug_printf(LOG_INFO, FNAME, "%s:%d "
"server-only configuration",
configfilename, cfl->line);
goto bad;
@@ -225,7 +225,7 @@ configure_interface(iflist)
ifc->server_pref = (int)cfl->num;
if (ifc->server_pref < 0 ||
ifc->server_pref > 255) {
- dprintf(LOG_INFO, FNAME, "%s:%d "
+ debug_printf(LOG_INFO, FNAME, "%s:%d "
"bad value: %d",
configfilename, cfl->line,
ifc->server_pref);
@@ -234,13 +234,13 @@ configure_interface(iflist)
break;
case DECL_SCRIPT:
if (dhcp6_mode != DHCP6_MODE_CLIENT) {
- dprintf(LOG_INFO, FNAME, "%s:%d "
+ debug_printf(LOG_INFO, FNAME, "%s:%d "
"client-only configuration",
configfilename, cfl->line);
goto bad;
}
if (ifc->scriptpath) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s:%d duplicated configuration",
configfilename, cfl->line);
goto bad;
@@ -248,13 +248,13 @@ configure_interface(iflist)
cp = cfl->ptr;
ifc->scriptpath = strdup(cp + 1);
if (ifc->scriptpath == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to copy script path");
goto bad;
}
cp = ifc->scriptpath;
if (*cp != '/') {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"script must be an absolute path");
goto bad;
}
@@ -272,7 +272,7 @@ configure_interface(iflist)
if (strcmp(spec->name, pool->name) == 0)
break;
if (pool == NULL) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"pool '%s' not found",
configfilename, cfl->line,
spec->name);
@@ -281,7 +281,7 @@ configure_interface(iflist)
if (spec->vltime != DHCP6_DURATION_INFINITE &&
(spec->pltime == DHCP6_DURATION_INFINITE ||
spec->pltime > spec->vltime)) {
- dprintf(LOG_ERR, FNAME, "%s:%d ",
+ debug_printf(LOG_ERR, FNAME, "%s:%d ",
configfilename, cfl->line,
"specified a larger preferred lifetime "
"than valid lifetime");
@@ -289,17 +289,17 @@ configure_interface(iflist)
}
ifc->pool = *spec;
if ((ifc->pool.name = strdup(spec->name)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation failed");
goto bad;
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"pool '%s' is specified to the interface '%s'",
ifc->pool.name, ifc->ifname);
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid interface configuration",
configfilename, cfl->line);
goto bad;
@@ -338,7 +338,7 @@ configure_ia(ialist, iatype)
confsize = sizeof(struct iana_conf);
break;
default:
- dprintf(LOG_ERR, FNAME, "internal error");
+ debug_printf(LOG_ERR, FNAME, "internal error");
goto bad;
}
@@ -346,7 +346,7 @@ configure_ia(ialist, iatype)
struct cf_list *cfl;
if ((iac = malloc(confsize)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation for IA %s failed",
iap->name);
goto bad;
@@ -386,13 +386,13 @@ configure_ia(ialist, iatype)
if (add_prefix(&pdp->iapd_prefix_list,
"IAPD", DHCP6_LISTVAL_PREFIX6,
cfl->ptr)) {
- dprintf(LOG_NOTICE, FNAME, "failed "
+ debug_printf(LOG_NOTICE, FNAME, "failed "
"to configure prefix");
goto bad;
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid configuration",
configfilename, cfl->line);
goto bad;
@@ -404,20 +404,20 @@ configure_ia(ialist, iatype)
if (add_prefix(&nap->iana_address_list,
"IANA", DHCP6_LISTVAL_STATEFULADDR6,
cfl->ptr)) {
- dprintf(LOG_NOTICE, FNAME, "failed "
+ debug_printf(LOG_NOTICE, FNAME, "failed "
"to configure address");
goto bad;
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid configuration",
configfilename, cfl->line);
goto bad;
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid iatype %d",
configfilename, cfl->line, iatype);
goto bad;
@@ -443,7 +443,7 @@ add_pd_pif(iapdc, cfl0)
for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
pif = TAILQ_NEXT(pif, link)) {
if (strcmp(pif->ifname, cfl0->ptr) == 0) {
- dprintf(LOG_NOTICE, FNAME, "%s:%d "
+ debug_printf(LOG_NOTICE, FNAME, "%s:%d "
"duplicated prefix interface: %s",
configfilename, cfl0->line, cfl0->ptr);
return (0); /* ignore it */
@@ -451,7 +451,7 @@ add_pd_pif(iapdc, cfl0)
}
if ((pif = malloc(sizeof(*pif))) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation for %s failed", cfl0->ptr);
goto bad;
}
@@ -459,20 +459,20 @@ add_pd_pif(iapdc, cfl0)
/* validate and copy ifname */
if (if_nametoindex(cfl0->ptr) == 0) {
- dprintf(LOG_ERR, FNAME, "%s:%d invalid interface (%s): %s",
+ debug_printf(LOG_ERR, FNAME, "%s:%d invalid interface (%s): %s",
configfilename, cfl0->line,
cfl0->ptr, strerror(errno));
goto bad;
}
if ((pif->ifname = strdup(cfl0->ptr)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy ifname");
+ debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
goto bad;
}
pif->ifid_len = IFID_LEN_DEFAULT;
pif->sla_len = SLA_LEN_DEFAULT;
if (get_default_ifid(pif)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to get default IF ID for %s", pif->ifname);
goto bad;
}
@@ -485,14 +485,14 @@ add_pd_pif(iapdc, cfl0)
case IFPARAM_SLA_LEN:
pif->sla_len = (int)cfl->num;
if (pif->sla_len < 0 || pif->sla_len > 128) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid SLA length: %d",
configfilename, cfl->line, pif->sla_len);
goto bad;
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d internal error: "
+ debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
"invalid configuration",
configfilename, cfl->line);
goto bad;
@@ -520,7 +520,7 @@ configure_host(hostlist)
struct cf_list *cfl;
if ((hconf = malloc(sizeof(*hconf))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed "
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed "
"for host %s", host->name);
goto bad;
}
@@ -531,7 +531,7 @@ configure_host(hostlist)
host_conflist0 = hconf;
if ((hconf->name = strdup(host->name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy host name: %s",
+ debug_printf(LOG_ERR, FNAME, "failed to copy host name: %s",
host->name);
goto bad;
}
@@ -540,7 +540,7 @@ configure_host(hostlist)
switch(cfl->type) {
case DECL_DUID:
if (hconf->duid.duid_id) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"duplicated DUID for %s",
configfilename,
cfl->line, host->name);
@@ -548,14 +548,14 @@ configure_host(hostlist)
}
if ((configure_duid((char *)cfl->ptr,
&hconf->duid)) != 0) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"failed to configure "
"DUID for %s",
configfilename, cfl->line,
host->name);
goto bad;
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"configure DUID for %s: %s",
host->name, duidstr(&hconf->duid));
break;
@@ -563,7 +563,7 @@ configure_host(hostlist)
if (add_prefix(&hconf->prefix_list,
hconf->name, DHCP6_LISTVAL_PREFIX6,
cfl->ptr)) {
- dprintf(LOG_ERR, FNAME, "failed "
+ debug_printf(LOG_ERR, FNAME, "failed "
"to configure prefix for %s",
host->name);
goto bad;
@@ -573,7 +573,7 @@ configure_host(hostlist)
if (add_prefix(&hconf->addr_list,
hconf->name, DHCP6_LISTVAL_STATEFULADDR6,
cfl->ptr)) {
- dprintf(LOG_ERR, FNAME, "failed "
+ debug_printf(LOG_ERR, FNAME, "failed "
"to configure address for %s",
host->name);
goto bad;
@@ -581,7 +581,7 @@ configure_host(hostlist)
break;
case DECL_DELAYEDKEY:
if (hconf->delayedkey != NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d: duplicate key %s for %s"
" (ignored)", configfilename,
cfl->line, cfl->ptr, host->name);
@@ -590,12 +590,12 @@ configure_host(hostlist)
if ((hconf->delayedkey =
find_keybyname(key_list0, cfl->ptr))
== NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
+ debug_printf(LOG_ERR, FNAME, "failed to "
"find key information for %s",
cfl->ptr);
goto bad;
}
- dprintf(LOG_DEBUG, FNAME, "configure key for "
+ debug_printf(LOG_DEBUG, FNAME, "configure key for "
"delayed auth with %s (keyid=%08x)",
host->name, hconf->delayedkey->keyid);
break;
@@ -610,7 +610,7 @@ configure_host(hostlist)
if (strcmp(spec->name, pool->name) == 0)
break;
if (pool == NULL) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"pool '%s' not found",
configfilename, cfl->line,
spec->name);
@@ -619,7 +619,7 @@ configure_host(hostlist)
if (spec->vltime != DHCP6_DURATION_INFINITE &&
(spec->pltime == DHCP6_DURATION_INFINITE ||
spec->pltime > spec->vltime)) {
- dprintf(LOG_ERR, FNAME, "%s:%d ",
+ debug_printf(LOG_ERR, FNAME, "%s:%d ",
configfilename, cfl->line,
"specified a larger preferred lifetime "
"than valid lifetime");
@@ -627,17 +627,17 @@ configure_host(hostlist)
}
hconf->pool = *spec;
if ((hconf->pool.name = strdup(spec->name)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"memory allocation failed");
goto bad;
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"pool '%s' is specified to the host '%s'",
hconf->pool.name, hconf->name);
}
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid host configuration for %s",
configfilename, cfl->line,
host->name);
@@ -669,7 +669,7 @@ configure_keys(keylist)
struct cf_list *cfl;
if ((kinfo = malloc(sizeof(*kinfo))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed "
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed "
"for key %s", key->name);
goto bad;
}
@@ -678,7 +678,7 @@ configure_keys(keylist)
key_list0 = kinfo;
if ((kinfo->name = strdup(key->name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy key name: %s",
+ debug_printf(LOG_ERR, FNAME, "failed to copy key name: %s",
key->name);
goto bad;
}
@@ -689,7 +689,7 @@ configure_keys(keylist)
switch (cfl->type) {
case KEYPARAM_REALM:
if (kinfo->realm != NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate realm for key %s "
"(ignored)", configfilename,
cfl->line, key->name);
@@ -697,7 +697,7 @@ configure_keys(keylist)
}
kinfo->realm = qstrdup(cfl->ptr);
if (kinfo->realm == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to allocate memory for "
"realm");
goto bad;
@@ -706,7 +706,7 @@ configure_keys(keylist)
break;
case KEYPARAM_KEYID:
if (keyid != -1) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate realm for key %s "
"(ignored)",
configfilename, cfl->line);
@@ -714,7 +714,7 @@ configure_keys(keylist)
}
keyid = cfl->num;
if (keyid < 0 || keyid > 0xffffffff) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d key ID overflow",
configfilename, cfl->line);
goto bad;
@@ -723,7 +723,7 @@ configure_keys(keylist)
case KEYPARAM_SECRET:
/* duplicate check */
if (kinfo->secret != NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate secret "
"for key %s (ignored)",
configfilename, cfl->line,
@@ -733,7 +733,7 @@ configure_keys(keylist)
/* convert base64 string to binary secret */
if ((secretstr = qstrdup(cfl->ptr)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to make a copy of secret");
goto bad;
}
@@ -741,7 +741,7 @@ configure_keys(keylist)
secretlen = base64_decodestring(secretstr,
secret, sizeof(secret));
if (secretlen < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"%s:%d failed to parse base64 key",
configfilename, cfl->line);
free(secretstr);
@@ -752,7 +752,7 @@ configure_keys(keylist)
/* set the binary secret */
kinfo->secret = malloc(secretlen);
if (kinfo->secret == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to allocate memory "
"for secret");
goto bad;
@@ -762,7 +762,7 @@ configure_keys(keylist)
break;
case KEYPARAM_EXPIRE:
if (expire != NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate expire for key "
"%s (ignored)", configfilename,
cfl->line, key->name);
@@ -771,7 +771,7 @@ configure_keys(keylist)
expire = qstrdup(cfl->ptr);
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"%s:%d invalid key parameter for %s",
configfilename, cfl->line, key->name);
goto bad;
@@ -780,18 +780,18 @@ configure_keys(keylist)
/* check for mandatory parameters or use default */
if (kinfo->realm == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"realm not specified for key %s", key->name);
goto bad;
}
if (keyid == -1) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"key ID not specified for key %s", key->name);
goto bad;
}
kinfo->keyid = keyid;
if (kinfo->secret == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"secret not specified for key %s", key->name);
goto bad;
}
@@ -802,7 +802,7 @@ configure_keys(keylist)
struct tm *lt;
if (time(&now) == -1) {
- dprintf(LOG_ERR, FNAME, "cannot get "
+ debug_printf(LOG_ERR, FNAME, "cannot get "
"current time: %s",
strerror(errno));
goto bad;
@@ -815,14 +815,14 @@ configure_keys(keylist)
strptime(expire, "%m-%d %H:%M", lt)
== NULL &&
strptime(expire, "%H:%M", lt) == NULL) {
- dprintf(LOG_ERR, FNAME, "invalid "
+ debug_printf(LOG_ERR, FNAME, "invalid "
"expiration time: %s");
goto bad;
}
expire_time = mktime(lt);
if (expire_time < now) {
- dprintf(LOG_ERR, FNAME, "past "
+ debug_printf(LOG_ERR, FNAME, "past "
"expiration time specified: %s",
expire);
goto bad;
@@ -867,7 +867,7 @@ configure_authinfo(authlist)
struct cf_list *cfl;
if ((ainfo = malloc(sizeof(*ainfo))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed "
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed "
"for auth info %s", auth->name);
goto bad;
}
@@ -879,7 +879,7 @@ configure_authinfo(authlist)
ainfo->rdm = DHCP6_AUTHRDM_UNDEF;
if ((ainfo->name = strdup(auth->name)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to copy auth info name: %s", auth->name);
goto bad;
}
@@ -888,7 +888,7 @@ configure_authinfo(authlist)
switch (cfl->type) {
case AUTHPARAM_PROTO:
if (ainfo->protocol != DHCP6_AUTHPROTO_UNDEF) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate protocol "
"for auth info %s "
"(ignored)",
@@ -900,7 +900,7 @@ configure_authinfo(authlist)
break;
case AUTHPARAM_ALG:
if (ainfo->algorithm != DHCP6_AUTHALG_UNDEF) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate algorithm "
"for auth info %s "
"(ignored)",
@@ -912,7 +912,7 @@ configure_authinfo(authlist)
break;
case AUTHPARAM_RDM:
if (ainfo->rdm != DHCP6_AUTHRDM_UNDEF) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d duplicate RDM "
"for auth info %s "
"(ignored)",
@@ -923,13 +923,13 @@ configure_authinfo(authlist)
ainfo->rdm = (int)cfl->num;
break;
case AUTHPARAM_KEY:
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"%s:%d auth info specific keys "
"are not supported",
configfilename, cfl->line);
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"%s:%d invalid auth info parameter for %s",
configfilename, cfl->line, auth->name);
goto bad;
@@ -939,20 +939,20 @@ configure_authinfo(authlist)
/* check for mandatory parameters and consistency */
switch (ainfo->protocol) {
case DHCP6_AUTHPROTO_UNDEF:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"auth protocol is not specified for %s",
auth->name);
goto bad;
case DHCP6_AUTHPROTO_DELAYED:
if (dhcp6_mode != DHCP6_MODE_CLIENT) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"client-only auth protocol is specified");
goto bad;
}
break;
case DHCP6_AUTHPROTO_RECONFIG:
if (dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"server-only auth protocol is specified");
goto bad;
}
@@ -1039,7 +1039,7 @@ configure_addr(cf_addr_list, list0, optname)
/* check against configuration restriction */
if (cf_addr_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ debug_printf(LOG_INFO, FNAME, "%s:%d server-only configuration",
configfilename, cf_addr_list->line);
return -1;
}
@@ -1049,7 +1049,7 @@ configure_addr(cf_addr_list, list0, optname)
/* duplication check */
if (dhcp6_find_listval(list0, DHCP6_LISTVAL_ADDR6,
cl->ptr, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s:%d duplicated %s server: %s",
configfilename, cl->line,
optname,
@@ -1058,7 +1058,7 @@ configure_addr(cf_addr_list, list0, optname)
}
if (dhcp6_add_listval(list0, DHCP6_LISTVAL_ADDR6,
cl->ptr, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a %s server",
+ debug_printf(LOG_ERR, FNAME, "failed to add a %s server",
optname);
return -1;
}
@@ -1077,7 +1077,7 @@ configure_domain(cf_name_list, list0, optname)
/* check against configuration restriction */
if (cf_name_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ debug_printf(LOG_INFO, FNAME, "%s:%d server-only configuration",
configfilename, cf_name_list->line);
return -1;
}
@@ -1089,7 +1089,7 @@ configure_domain(cf_name_list, list0, optname)
name = strdup(cl->ptr + 1);
if (name == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to copy a %s domain name",
optname);
return -1;
@@ -1103,7 +1103,7 @@ configure_domain(cf_name_list, list0, optname)
/* duplication check */
if (dhcp6_find_listval(list0, DHCP6_LISTVAL_VBUF,
&name_vbuf, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s:%d duplicated %s name: %s",
configfilename, cl->line, optname,
name_vbuf.dv_buf);
@@ -1114,7 +1114,7 @@ configure_domain(cf_name_list, list0, optname)
/* add the name */
if (dhcp6_add_listval(list0, DHCP6_LISTVAL_VBUF,
&name_vbuf, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a %s name",
+ debug_printf(LOG_ERR, FNAME, "failed to add a %s name",
optname);
dhcp6_vbuf_free(&name_vbuf);
return -1;
@@ -1145,12 +1145,12 @@ configure_duid(str, duid)
goto bad;
duidlen += (slen / 3);
if (duidlen > 128) {
- dprintf(LOG_ERR, FNAME, "too long DUID (%d)", duidlen);
+ debug_printf(LOG_ERR, FNAME, "too long DUID (%d)", duidlen);
return (-1);
}
if ((idbuf = malloc(duidlen)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
return (-1);
}
@@ -1175,7 +1175,7 @@ configure_duid(str, duid)
bad:
if (idbuf)
free(idbuf);
- dprintf(LOG_ERR, FNAME, "assumption failure (bad string)");
+ debug_printf(LOG_ERR, FNAME, "assumption failure (bad string)");
return (-1);
}
@@ -1193,12 +1193,12 @@ get_default_ifid(pif)
#endif
if (pif->ifid_len < 64) {
- dprintf(LOG_NOTICE, FNAME, "ID length too short");
+ debug_printf(LOG_NOTICE, FNAME, "ID length too short");
return (-1);
}
if (getifaddrs(&ifap) < 0) {
- dprintf(LOG_ERR, FNAME, "getifaddrs failed: %s",
+ debug_printf(LOG_ERR, FNAME, "getifaddrs failed: %s",
strerror(errno));
return (-1);
}
@@ -1218,7 +1218,7 @@ get_default_ifid(pif)
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
if (sdl->sdl_alen < 6) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"link layer address is too short (%s)",
pif->ifname);
goto fail;
@@ -1233,7 +1233,7 @@ get_default_ifid(pif)
sll = (struct sockaddr_ll *)ifa->ifa_addr;
if (sll->sll_halen < 6) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"link layer address is too short (%s)",
pif->ifname);
goto fail;
@@ -1256,7 +1256,7 @@ get_default_ifid(pif)
}
if (ifa == NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"cannot find interface information for %s", pif->ifname);
goto fail;
}
@@ -1352,7 +1352,7 @@ configure_commit()
/* clear unused IA configuration */
if (!TAILQ_EMPTY(&ia_conflist0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"some IA configuration defined but not used");
}
clear_iaconf(&ia_conflist0);
@@ -1475,7 +1475,7 @@ clear_iaconf(ialist)
switch(iac->type) {
case IATYPE_PD:
if (!TAILQ_EMPTY(&iac->iadata)) {
- dprintf(LOG_ERR, FNAME, "assumption failure");
+ debug_printf(LOG_ERR, FNAME, "assumption failure");
exit(1);
}
clear_pd_pif((struct iapd_conf *)iac);
@@ -1557,7 +1557,7 @@ add_options(opcode, ifc, cfl0)
ifc->allow_flags |= DHCIFF_RAPID_COMMIT;
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid operation (%d) "
"for option type (%d)",
opcode, cfl->type);
@@ -1566,7 +1566,7 @@ add_options(opcode, ifc, cfl0)
break;
case DHCPOPT_AUTHINFO:
if (opcode != DHCPOPTCODE_SEND) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid operation (%d) "
"for option type (%d)",
opcode, cfl->type);
@@ -1574,14 +1574,14 @@ add_options(opcode, ifc, cfl0)
}
ainfo = find_authinfo(auth_list0, cfl->ptr);
if (ainfo == NULL) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"auth info (%s) is not defined",
configfilename, cfl->line,
(char *)cfl->ptr);
return (-1);
}
if (ifc->authinfo != NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"%s:%d authinfo is doubly specified on %s",
configfilename, cfl->line, ifc->ifname);
return (-1);
@@ -1594,7 +1594,7 @@ add_options(opcode, ifc, cfl0)
iac = find_iaconf(&ia_conflist0, IATYPE_PD,
(u_int32_t)cfl->num);
if (iac == NULL) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"IA_PD (%lu) is not defined",
configfilename, cfl->line,
(u_long)cfl->num);
@@ -1607,7 +1607,7 @@ add_options(opcode, ifc, cfl0)
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid operation (%d) "
"for option type (%d)", opcode, cfl->type);
break;
@@ -1619,7 +1619,7 @@ add_options(opcode, ifc, cfl0)
iac = find_iaconf(&ia_conflist0, IATYPE_NA,
(u_int32_t)cfl->num);
if (iac == NULL) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"IA_NA (%lu) is not defined",
configfilename, cfl->line,
(u_long)cfl->num);
@@ -1632,7 +1632,7 @@ add_options(opcode, ifc, cfl0)
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid operation (%d) "
"for option type (%d)", opcode, cfl->type);
break;
@@ -1693,7 +1693,7 @@ add_options(opcode, ifc, cfl0)
if (dhcp6_find_listval(&ifc->reqopt_list,
DHCP6_LISTVAL_NUM, &opttype, 0)
!= NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"duplicated requested option: %s",
dhcp6optstr(opttype));
goto next; /* ignore it */
@@ -1701,20 +1701,20 @@ add_options(opcode, ifc, cfl0)
if (dhcp6_add_listval(&ifc->reqopt_list,
DHCP6_LISTVAL_NUM, &opttype, NULL)
== NULL) {
- dprintf(LOG_ERR, FNAME, "failed to "
+ debug_printf(LOG_ERR, FNAME, "failed to "
"configure an option");
return (-1);
}
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid operation (%d) "
"for option type (%d)", opcode, cfl->type);
break;
}
break;
default:
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"%s:%d unsupported option type: %d",
configfilename, cfl->line, cfl->type);
return (-1);
@@ -1740,13 +1740,13 @@ add_prefix(head, name, type, prefix0)
/* additional validation of parameters */
if (oprefix.plen < 0 || oprefix.plen > 128) {
- dprintf(LOG_ERR, FNAME, "invalid prefix: %d", oprefix.plen);
+ debug_printf(LOG_ERR, FNAME, "invalid prefix: %d", oprefix.plen);
return (-1);
}
/* clear trailing bits */
prefix6_mask(&oprefix.addr, oprefix.plen);
if (!IN6_ARE_ADDR_EQUAL(&prefix0->addr, &oprefix.addr)) {
- dprintf(LOG_WARNING, FNAME, "prefix %s/%d for %s "
+ debug_printf(LOG_WARNING, FNAME, "prefix %s/%d for %s "
"has a trailing garbage. It should be %s/%d",
in6addr2str(&prefix0->addr, 0), prefix0->plen,
name, in6addr2str(&oprefix.addr, 0), oprefix.plen);
@@ -1757,7 +1757,7 @@ add_prefix(head, name, type, prefix0)
if (IN6_IS_ADDR_MULTICAST(&oprefix.addr) ||
IN6_IS_ADDR_LINKLOCAL(&oprefix.addr) ||
IN6_IS_ADDR_SITELOCAL(&oprefix.addr)) {
- dprintf(LOG_ERR, FNAME, "invalid prefix address: %s",
+ debug_printf(LOG_ERR, FNAME, "invalid prefix address: %s",
in6addr2str(&oprefix.addr, 0));
return (-1);
}
@@ -1765,11 +1765,11 @@ add_prefix(head, name, type, prefix0)
/* prefix duplication check */
if (dhcp6_find_listval(head, type, &oprefix, 0)) {
if (type == DHCP6_LISTVAL_PREFIX6) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"duplicated prefix: %s/%d for %s",
in6addr2str(&oprefix.addr, 0), oprefix.plen, name);
} else {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"duplicated address: %s for %s",
in6addr2str(&oprefix.addr, 0), name);
}
@@ -1781,12 +1781,12 @@ add_prefix(head, name, type, prefix0)
(oprefix.pltime == DHCP6_DURATION_INFINITE ||
oprefix.pltime > oprefix.vltime)) {
if (type == DHCP6_LISTVAL_PREFIX6) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"%s/%d has larger preferred lifetime "
"than valid lifetime",
in6addr2str(&oprefix.addr, 0), oprefix.plen);
} else {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"%s has larger preferred lifetime "
"than valid lifetime",
in6addr2str(&oprefix.addr, 0));
@@ -1915,10 +1915,10 @@ configure_pool(poollist)
{
struct cf_namelist *plp;
- dprintf(LOG_DEBUG, FNAME, "called");
+ debug_printf(LOG_DEBUG, FNAME, "called");
if (poollist && dhcp6_mode != DHCP6_MODE_SERVER) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"pool statement is server-only",
configfilename, poollist->line);
goto bad;
@@ -1935,7 +1935,7 @@ configure_pool(poollist)
range = cfl->ptr;
break;
default:
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"invalid pool configuration",
configfilename, cfl->line);
goto bad;
@@ -1943,14 +1943,14 @@ configure_pool(poollist)
}
if (!range) {
- dprintf(LOG_ERR, FNAME, "%s:%d "
+ debug_printf(LOG_ERR, FNAME, "%s:%d "
"pool '%s' has no range declaration",
configfilename, plp->line,
plp->name);
goto bad;
}
if ((pool = create_pool(plp->name, range)) == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"faled to craete pool '%s'", plp->name);
goto bad;
}
@@ -1971,7 +1971,7 @@ clear_poolconf(plist)
{
struct pool_conf *pool, *pool_next;
- dprintf(LOG_DEBUG, FNAME, "called");
+ debug_printf(LOG_DEBUG, FNAME, "called");
for (pool = plist; pool; pool = pool_next) {
pool_next = pool->next;
@@ -1999,7 +1999,7 @@ create_dynamic_hostconf(duid, pool)
if (dynamic_hostconf_count >= DHCP6_DYNAMIC_HOSTCONF_MAX) {
struct dynamic_hostconf_listhead *head = &dynamic_hostconf_head;
- dprintf(LOG_DEBUG, FNAME, "reached to the max count (count=%lu)",
+ debug_printf(LOG_DEBUG, FNAME, "reached to the max count (count=%lu)",
dynamic_hostconf_count);
/* Find the last entry that doesn't need authentication */
@@ -2013,14 +2013,14 @@ create_dynamic_hostconf(duid, pool)
clear_hostconf(dynconf->host);
} else {
if ((dynconf = malloc(sizeof(*dynconf))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
return (NULL);
}
}
memset(dynconf, 0, sizeof(*dynconf));
if ((host = malloc(sizeof(*host))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
goto bad;
}
memset(host, 0, sizeof(*host));
@@ -2030,7 +2030,7 @@ create_dynamic_hostconf(duid, pool)
if ((strid = duidstr(duid)) == NULL)
strid = "???";
if ((host->name = strdup(strid)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
goto bad;
}
if (duidcpy(&host->duid, duid) != 0) {
@@ -2038,7 +2038,7 @@ create_dynamic_hostconf(duid, pool)
}
if (pool->name) {
if ((host->pool.name = strdup(pool->name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
goto bad;
}
}
@@ -2049,7 +2049,7 @@ create_dynamic_hostconf(duid, pool)
TAILQ_INSERT_HEAD(&dynamic_hostconf_head, dynconf, link);
dynamic_hostconf_count++;
- dprintf(LOG_DEBUG, FNAME, "created host_conf (name=%s)", host->name);
+ debug_printf(LOG_DEBUG, FNAME, "created host_conf (name=%s)", host->name);
return (host);
@@ -2097,22 +2097,22 @@ create_pool(name, range)
return (NULL);
}
- dprintf(LOG_DEBUG, FNAME, "name=%s, range=%s->%s", name,
+ debug_printf(LOG_DEBUG, FNAME, "name=%s, range=%s->%s", name,
in6addr2str(&range->min, 0), in6addr2str(&range->max, 0));
if (in6_addr_cmp(&range->min, &range->max) > 0) {
- dprintf(LOG_ERR, FNAME, "invalid address range %s->%s",
+ debug_printf(LOG_ERR, FNAME, "invalid address range %s->%s",
in6addr2str(&range->min, 0),
in6addr2str(&range->max, 0));
return (NULL);
}
if ((pool = malloc(sizeof(struct pool_conf))) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
return (NULL);
}
if ((pool->name = strdup(name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
free(pool);
return (NULL);
}
@@ -2131,16 +2131,16 @@ find_pool(name)
if (!name)
return (NULL);
- dprintf(LOG_DEBUG, FNAME, "name=%s", name);
+ debug_printf(LOG_DEBUG, FNAME, "name=%s", name);
for (pool = pool_conflist; pool; pool = pool->next) {
if (strcmp(name, pool->name) == 0) {
- dprintf(LOG_DEBUG, FNAME, "found (name=%s)", name);
+ debug_printf(LOG_DEBUG, FNAME, "found (name=%s)", name);
return (pool);
}
}
- dprintf(LOG_DEBUG, FNAME, "not found (name=%s)", name);
+ debug_printf(LOG_DEBUG, FNAME, "not found (name=%s)", name);
return (NULL);
}
@@ -2154,7 +2154,7 @@ get_free_address_from_pool(pool, addr)
if (!pool || !addr)
return (0);
- dprintf(LOG_DEBUG, FNAME, "called (pool=%s)", pool->name);
+ debug_printf(LOG_DEBUG, FNAME, "called (pool=%s)", pool->name);
for (cur = pool->min; in6_addr_cmp(&cur, &pool->max) <= 0;
in6_addr_inc(&cur)) {
@@ -2162,17 +2162,17 @@ get_free_address_from_pool(pool, addr)
!IN6_IS_ADDR_MULTICAST(&cur) &&
!IN6_IS_ADDR_LINKLOCAL(&cur) &&
!IN6_IS_ADDR_SITELOCAL(&cur)) {
- dprintf(LOG_DEBUG, FNAME, "found %s",
+ debug_printf(LOG_DEBUG, FNAME, "found %s",
in6addr2str(&cur, 0));
*addr= cur;
return 1;
}
- dprintf(LOG_DEBUG, FNAME, "next address %s",
+ debug_printf(LOG_DEBUG, FNAME, "next address %s",
in6addr2str(&cur, 0));
}
- dprintf(LOG_NOTICE, FNAME, "no available address");
+ debug_printf(LOG_NOTICE, FNAME, "no available address");
return 0;
}
@@ -2184,7 +2184,7 @@ is_available_in_pool(pool, addr)
if (!pool || !addr)
return (0);
- dprintf(LOG_DEBUG, FNAME, "pool=%s, addr=%s",
+ debug_printf(LOG_DEBUG, FNAME, "pool=%s, addr=%s",
pool->name, in6addr2str(addr, 0));
if (in6_addr_cmp(addr, &pool->min) >= 0 &&
@@ -2196,7 +2196,7 @@ is_available_in_pool(pool, addr)
return (1);
}
- dprintf(LOG_DEBUG, FNAME, "unavailable address (pool=%s, addr=%s)",
+ debug_printf(LOG_DEBUG, FNAME, "unavailable address (pool=%s, addr=%s)",
pool->name, in6addr2str(addr, 0));
return (0);
diff --git a/configure b/configure
index 6f50634..4722b7b 100755
--- a/configure
+++ b/configure
@@ -6013,7 +6013,55 @@ fi
done
- ac_config_files="$ac_config_files Makefile"
+{ echo "$as_me:$LINENO: checking whether libc defines struct in6_pktinfo" >&5
+echo $ECHO_N "checking whether libc defines struct in6_pktinfo... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <netinet/in.h>
+int
+main ()
+{
+struct in6_pktinfo p6;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ CFLAGS="$CFLAGS -DHAVE_IN6_PKTINFO"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ac_config_files="$ac_config_files Makefile"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
diff --git a/configure.in b/configure.in
index 59dd84e..6da9af5 100644
--- a/configure.in
+++ b/configure.in
@@ -236,4 +236,11 @@ AC_SUBST(group)
AC_CHECK_HEADERS(stdarg.h)
+AC_MSG_CHECKING(whether libc defines struct in6_pktinfo)
+AC_TRY_COMPILE([#include <netinet/in.h>],
+ [struct in6_pktinfo p6;],
+ [AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -DHAVE_IN6_PKTINFO"],
+ [AC_MSG_RESULT(no)])
+
AC_OUTPUT(Makefile)
diff --git a/dhcp6.h b/dhcp6.h
index 6afb517..9f3a62d 100644
--- a/dhcp6.h
+++ b/dhcp6.h
@@ -108,6 +108,13 @@ typedef uint64_t u_int64_t;
#define DHCP6_IRT_DEFAULT 86400 /* 1 day */
#define DHCP6_IRT_MINIMUM 600
+#ifndef HAVE_IN6_PKTINFO
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr; /* src/dst IPv6 address */
+ unsigned int ipi6_ifindex; /* send/recv interface index */
+};
+#endif
+
/* DUID: DHCP unique Identifier */
struct duid {
size_t duid_len; /* length */
diff --git a/dhcp6_ctl.c b/dhcp6_ctl.c
index ab1f18d..a12f82a 100644
--- a/dhcp6_ctl.c
+++ b/dhcp6_ctl.c
@@ -93,32 +93,32 @@ dhcp6_ctl_init(addr, port, max, sockp)
hints.ai_protocol = IPPROTO_TCP;
error = getaddrinfo(addr, port, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
return (-1);
}
ctlsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (ctlsock < 0) {
- dprintf(LOG_ERR, FNAME, "socket(control sock): %s",
+ debug_printf(LOG_ERR, FNAME, "socket(control sock): %s",
strerror(errno));
goto fail;
}
on = 1;
if (setsockopt(ctlsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))
< 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(control sock, SO_REUSEADDR: %s",
strerror(errno));
goto fail;
}
if (bind(ctlsock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, FNAME, "bind(control sock): %s",
+ debug_printf(LOG_ERR, FNAME, "bind(control sock): %s",
strerror(errno));
goto fail;
}
freeaddrinfo(res);
if (listen(ctlsock, 1)) {
- dprintf(LOG_ERR, FNAME, "listen(control sock): %s",
+ debug_printf(LOG_ERR, FNAME, "listen(control sock): %s",
strerror(errno));
goto fail;
}
@@ -126,7 +126,7 @@ dhcp6_ctl_init(addr, port, max, sockp)
TAILQ_INIT(&commandqueue_head);
if (max <= 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"invalid maximum number of commands (%d)", max_commands);
goto fail;
}
@@ -159,27 +159,27 @@ dhcp6_ctl_authinit(keyfile, keyinfop, digestlenp)
*digestlenp = MD5_DIGESTLENGTH;
if ((fp = fopen(keyfile, "r")) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to open %s: %s", keyfile,
+ debug_printf(LOG_ERR, FNAME, "failed to open %s: %s", keyfile,
strerror(errno));
return (-1);
}
if (fgets(line, sizeof(line), fp) == NULL && ferror(fp)) {
- dprintf(LOG_ERR, FNAME, "failed to read key file: %s",
+ debug_printf(LOG_ERR, FNAME, "failed to read key file: %s",
strerror(errno));
goto fail;
}
if ((secretlen = base64_decodestring(line, secret, sizeof(secret)))
< 0) {
- dprintf(LOG_ERR, FNAME, "failed to decode base64 string");
+ debug_printf(LOG_ERR, FNAME, "failed to decode base64 string");
goto fail;
}
if ((ctlkey = malloc(sizeof(*ctlkey))) == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed to allocate control key");
+ debug_printf(LOG_WARNING, FNAME, "failed to allocate control key");
goto fail;
}
memset(ctlkey, 0, sizeof(*ctlkey));
if ((ctlkey->secret = malloc(secretlen)) == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed to allocate secret key");
+ debug_printf(LOG_WARNING, FNAME, "failed to allocate secret key");
goto fail;
}
ctlkey->secretlen = (size_t)secretlen;
@@ -214,24 +214,24 @@ dhcp6_ctl_acceptcommand(sl, callback)
fromlen = sizeof(from_ss);
if ((s = accept(sl, from, &fromlen)) < 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to accept control connection: %s",
strerror(errno));
return (-1);
}
- dprintf(LOG_DEBUG, FNAME, "accept control connection from %s",
+ debug_printf(LOG_DEBUG, FNAME, "accept control connection from %s",
addr2str(from));
if (max_commands <= 0) {
- dprintf(LOG_ERR, FNAME, "command queue is not initialized");
+ debug_printf(LOG_ERR, FNAME, "command queue is not initialized");
close(s);
return (-1);
}
new = malloc(sizeof(*new));
if (new == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to allocate new command context");
goto fail;
}
@@ -240,7 +240,7 @@ dhcp6_ctl_acceptcommand(sl, callback)
if (commands == max_commands) {
ctx = TAILQ_FIRST(&commandqueue_head);
- dprintf(LOG_INFO, FNAME, "command queue is full. "
+ debug_printf(LOG_INFO, FNAME, "command queue is full. "
"drop the oldest one (fd=%d)", ctx->s);
TAILQ_REMOVE(&commandqueue_head, ctx, link);
@@ -271,7 +271,7 @@ dhcp6_ctl_closecommand(ctx)
free(ctx);
if (commands == 0) {
- dprintf(LOG_ERR, FNAME, "assumption error: "
+ debug_printf(LOG_ERR, FNAME, "assumption error: "
"command queue is empty?");
exit(1); /* XXX */
}
@@ -299,12 +299,12 @@ dhcp6_ctl_readcommand(read_fds)
cc = read(ctx->s, cp, resid);
if (cc < 0) {
- dprintf(LOG_WARNING, FNAME, "read failed: %s",
+ debug_printf(LOG_WARNING, FNAME, "read failed: %s",
strerror(errno));
goto closecommand;
}
if (cc == 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"control channel was reset by peer");
goto closecommand;
}
@@ -330,7 +330,7 @@ dhcp6_ctl_readcommand(read_fds)
break;
}
} else if (ctx->input_len > sizeof(ctx->inputbuf)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"too large command (%d bytes)",
ctx->input_len);
goto closecommand;
diff --git a/dhcp6c.c b/dhcp6c.c
index b5f5ed7..c959b7c 100644
--- a/dhcp6c.c
+++ b/dhcp6c.c
@@ -218,7 +218,7 @@ main(argc, argv)
client6_init();
while (argc-- > 0) {
if ((ifp = ifinit(argv[0])) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to initialize %s",
+ debug_printf(LOG_ERR, FNAME, "failed to initialize %s",
argv[0]);
exit(1);
}
@@ -226,7 +226,7 @@ main(argc, argv)
}
if (infreq_mode == 0 && (cfparse(conffile)) != 0) {
- dprintf(LOG_ERR, FNAME, "failed to parse configuration file");
+ debug_printf(LOG_ERR, FNAME, "failed to parse configuration file");
exit(1);
}
@@ -266,12 +266,12 @@ client6_init()
/* get our DUID */
if (get_duid(DUID_FILE, &client_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to get a DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to get a DUID");
exit(1);
}
if (dhcp6_ctl_authinit(ctlkeyfile, &ctlkey, &ctldigestlen) != 0) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed initialize control message authentication");
/* run the server anyway */
}
@@ -283,25 +283,25 @@ client6_init()
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(NULL, DH6PORT_DOWNSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (sock < 0) {
- dprintf(LOG_ERR, FNAME, "socket");
+ debug_printf(LOG_ERR, FNAME, "socket");
exit(1);
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
&on, sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(SO_REUSEPORT): %s", strerror(errno));
exit(1);
}
#ifdef IPV6_RECVPKTINFO
if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(IPV6_RECVPKTINFO): %s",
strerror(errno));
exit(1);
@@ -309,7 +309,7 @@ client6_init()
#else
if (setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(IPV6_PKTINFO): %s",
strerror(errno));
exit(1);
@@ -317,7 +317,7 @@ client6_init()
#endif
if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(sock, IPV6_MULTICAST_LOOP): %s",
strerror(errno));
exit(1);
@@ -325,7 +325,7 @@ client6_init()
#ifdef IPV6_V6ONLY
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
&on, sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_V6ONLY): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_V6ONLY): %s",
strerror(errno));
exit(1);
}
@@ -337,14 +337,14 @@ client6_init()
* the outgoing port is also bound to the DH6PORT_DOWNSTREAM.
*/
if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, FNAME, "bind: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "bind: %s", strerror(errno));
exit(1);
}
freeaddrinfo(res);
/* open a routing socket to watch the routing table */
if ((rtsock = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) {
- dprintf(LOG_ERR, FNAME, "open a routing socket: %s",
+ debug_printf(LOG_ERR, FNAME, "open a routing socket: %s",
strerror(errno));
exit(1);
}
@@ -355,7 +355,7 @@ client6_init()
hints.ai_protocol = IPPROTO_UDP;
error = getaddrinfo(DH6ADDR_ALLAGENT, DH6PORT_UPSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
@@ -365,21 +365,21 @@ client6_init()
/* set up control socket */
if (ctlkey == NULL)
- dprintf(LOG_NOTICE, FNAME, "skip opening control port");
+ debug_printf(LOG_NOTICE, FNAME, "skip opening control port");
else if (dhcp6_ctl_init(ctladdr, ctlport,
DHCP6CTL_DEF_COMMANDQUEUELEN, &ctlsock)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to initialize control channel");
exit(1);
}
if (signal(SIGHUP, client6_signal) == SIG_ERR) {
- dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
strerror(errno));
exit(1);
}
if (signal(SIGTERM, client6_signal) == SIG_ERR) {
- dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
strerror(errno));
exit(1);
}
@@ -393,28 +393,28 @@ client6_start(ifp)
/* make sure that the interface does not have a timer */
if (ifp->timer != NULL) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"removed existing timer on %s", ifp->ifname);
dhcp6_remove_timer(&ifp->timer);
}
/* create an event for the initial delay */
if ((ev = dhcp6_create_event(ifp, DHCP6S_INIT)) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to create an event");
+ debug_printf(LOG_NOTICE, FNAME, "failed to create an event");
return (-1);
}
TAILQ_INSERT_TAIL(&ifp->event_list, ev, link);
if ((ev->authparam = new_authparam(ifp->authproto,
ifp->authalgorithm, ifp->authrdm)) == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed to allocate "
+ debug_printf(LOG_WARNING, FNAME, "failed to allocate "
"authentication parameters");
dhcp6_remove_event(ev);
return (-1);
}
if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to add a timer for %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to add a timer for %s",
ifp->ifname);
dhcp6_remove_event(ev);
return (-1);
@@ -432,7 +432,7 @@ client6_startall(isrestart)
for (ifp = dhcp6_if; ifp; ifp = ifp->next) {
if (isrestart &&ifreset(ifp)) {
- dprintf(LOG_NOTICE, FNAME, "failed to reset %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to reset %s",
ifp->ifname);
continue; /* XXX: try to recover? */
}
@@ -489,7 +489,7 @@ check_exit()
}
/* We have no existing event. Do exit. */
- dprintf(LOG_INFO, FNAME, "exiting");
+ debug_printf(LOG_INFO, FNAME, "exiting");
exit(0);
}
@@ -504,7 +504,7 @@ process_signals()
check_exit();
}
if ((sig_flags & SIGF_HUP)) {
- dprintf(LOG_INFO, FNAME, "restarting");
+ debug_printf(LOG_INFO, FNAME, "restarting");
free_resources(NULL);
client6_startall(1);
}
@@ -539,7 +539,7 @@ client6_mainloop()
switch (ret) {
case -1:
if (errno != EINTR) {
- dprintf(LOG_ERR, FNAME, "select: %s",
+ debug_printf(LOG_ERR, FNAME, "select: %s",
strerror(errno));
exit(1);
}
@@ -633,31 +633,31 @@ client6_do_ctlcommand(buf, len)
commandlen = (int)(ntohs(ctlhead->len));
version = ntohs(ctlhead->version);
if (len != sizeof(struct dhcp6ctl) + commandlen) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"assumption failure: command length mismatch");
return (DHCP6CTL_R_FAILURE);
}
/* replay protection and message authentication */
if ((now = time(NULL)) < 0) {
- dprintf(LOG_ERR, FNAME, "failed to get current time: %s",
+ debug_printf(LOG_ERR, FNAME, "failed to get current time: %s",
strerror(errno));
return (DHCP6CTL_R_FAILURE);
}
ts0 = (u_int32_t)now;
ts = ntohl(ctlhead->timestamp);
if (ts + CTLSKEW < ts0 || (ts - CTLSKEW) > ts0) {
- dprintf(LOG_INFO, FNAME, "timestamp is out of range");
+ debug_printf(LOG_INFO, FNAME, "timestamp is out of range");
return (DHCP6CTL_R_FAILURE);
}
if (ctlkey == NULL) { /* should not happen!! */
- dprintf(LOG_ERR, FNAME, "no secret key for control channel");
+ debug_printf(LOG_ERR, FNAME, "no secret key for control channel");
return (DHCP6CTL_R_FAILURE);
}
if (dhcp6_verify_mac(buf, len, DHCP6CTL_AUTHPROTO_UNDEF,
DHCP6CTL_AUTHALG_HMACMD5, sizeof(*ctlhead), ctlkey) != 0) {
- dprintf(LOG_INFO, FNAME, "authentication failure");
+ debug_printf(LOG_INFO, FNAME, "authentication failure");
return (DHCP6CTL_R_FAILURE);
}
@@ -665,14 +665,14 @@ client6_do_ctlcommand(buf, len)
commandlen -= ctldigestlen;
if (version > DHCP6CTL_VERSION) {
- dprintf(LOG_INFO, FNAME, "unsupported version: %d", version);
+ debug_printf(LOG_INFO, FNAME, "unsupported version: %d", version);
return (DHCP6CTL_R_FAILURE);
}
switch (command) {
case DHCP6CTL_COMMAND_RELOAD:
if (commandlen != 0) {
- dprintf(LOG_INFO, FNAME, "invalid command length "
+ debug_printf(LOG_INFO, FNAME, "invalid command length "
"for reload: %d", commandlen);
return (DHCP6CTL_R_DONE);
}
@@ -691,7 +691,7 @@ client6_do_ctlcommand(buf, len)
return (DHCP6CTL_R_FAILURE);
break;
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown start target: %ul", p32);
return (DHCP6CTL_R_FAILURE);
}
@@ -718,14 +718,14 @@ client6_do_ctlcommand(buf, len)
}
break;
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown start target: %ul", p32);
return (DHCP6CTL_R_FAILURE);
}
}
break;
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown control command: %d (len=%d)",
(int)command, commandlen);
return (DHCP6CTL_R_FAILURE);
@@ -739,12 +739,12 @@ client6_reload()
{
/* reload the configuration file */
if (cfparse(conffile) != 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to reload configuration file");
return;
}
- dprintf(LOG_NOTICE, FNAME, "client reloaded");
+ debug_printf(LOG_NOTICE, FNAME, "client reloaded");
return;
}
@@ -757,20 +757,20 @@ client6_ifctl(ifname, command)
struct dhcp6_if *ifp;
if ((ifp = find_ifconfbyname(ifname)) == NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to find interface configuration for %s",
ifname);
return (-1);
}
- dprintf(LOG_DEBUG, FNAME, "%s interface %s",
+ debug_printf(LOG_DEBUG, FNAME, "%s interface %s",
command == DHCP6CTL_COMMAND_START ? "start" : "stop", ifname);
switch(command) {
case DHCP6CTL_COMMAND_START:
free_resources(ifp);
if (client6_start(ifp)) {
- dprintf(LOG_NOTICE, FNAME, "failed to restart %s",
+ debug_printf(LOG_NOTICE, FNAME, "failed to restart %s",
ifname);
return (-1);
}
@@ -778,13 +778,13 @@ client6_ifctl(ifname, command)
case DHCP6CTL_COMMAND_STOP:
free_resources(ifp);
if (ifp->timer != NULL) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"removed existing timer on %s", ifp->ifname);
dhcp6_remove_timer(&ifp->timer);
}
break;
default: /* impossible case, should be a bug */
- dprintf(LOG_ERR, FNAME, "unknown command: %d", (int)command);
+ debug_printf(LOG_ERR, FNAME, "unknown command: %d", (int)command);
break;
}
@@ -797,7 +797,7 @@ client6_expire_refreshtime(arg)
{
struct dhcp6_if *ifp = arg;
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"information refresh time on %s expired", ifp->ifname);
dhcp6_remove_timer(&ifp->timer);
@@ -823,7 +823,7 @@ client6_timo(arg)
* [RFC3315 14.]
*/
if (ev->max_retrans_cnt && ev->timeouts >= ev->max_retrans_cnt) {
- dprintf(LOG_INFO, FNAME, "no responses were received");
+ debug_printf(LOG_INFO, FNAME, "no responses were received");
dhcp6_remove_event(ev);
if (state == DHCP6S_RELEASE)
@@ -840,7 +840,7 @@ client6_timo(arg)
else {
ev->state = DHCP6S_SOLICIT;
if (construct_confdata(ifp, ev)) {
- dprintf(LOG_ERR, FNAME, "can't send solicit");
+ debug_printf(LOG_ERR, FNAME, "can't send solicit");
exit(1); /* XXX */
}
}
@@ -856,7 +856,7 @@ client6_timo(arg)
if (!TAILQ_EMPTY(&ev->data_list))
client6_send(ev);
else {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"all information to be updated was canceled");
dhcp6_remove_event(ev);
return (NULL);
@@ -875,13 +875,13 @@ client6_timo(arg)
ev->current_server = select_server(ev);
if (ev->current_server == NULL) {
/* this should not happen! */
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"can't find a server");
exit(1); /* XXX */
}
if (duidcpy(&ev->serverid,
&ev->current_server->optinfo.serverID)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"can't copy server ID");
return (NULL); /* XXX: better recovery? */
}
@@ -896,7 +896,7 @@ client6_timo(arg)
if (construct_reqdata(ifp,
&ev->current_server->optinfo, ev)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to construct request data");
break;
}
@@ -930,7 +930,7 @@ construct_confdata(ifp, ev)
evd = NULL;
if ((evd = malloc(sizeof(*evd))) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event data");
goto fail;
}
@@ -982,7 +982,7 @@ construct_confdata(ifp, ev)
TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
break;
default:
- dprintf(LOG_ERR, FNAME, "internal error");
+ debug_printf(LOG_ERR, FNAME, "internal error");
exit(1);
}
}
@@ -1078,7 +1078,7 @@ construct_reqdata(ifp, optinfo, ev)
TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
break;
default:
- dprintf(LOG_ERR, FNAME, "internal error");
+ debug_printf(LOG_ERR, FNAME, "internal error");
exit(1);
}
}
@@ -1102,7 +1102,7 @@ destruct_iadata(evd)
struct dhcp6_list *ial;
if (evd->type != DHCP6_EVDATA_IAPD && evd->type != DHCP6_EVDATA_IANA) {
- dprintf(LOG_ERR, FNAME, "assumption failure %d", evd->type);
+ debug_printf(LOG_ERR, FNAME, "assumption failure %d", evd->type);
exit(1);
}
@@ -1124,7 +1124,7 @@ select_server(ev)
*/
for (s = ev->servers; s; s = s->next) {
if (s->active) {
- dprintf(LOG_DEBUG, FNAME, "picked a server (ID: %s)",
+ debug_printf(LOG_DEBUG, FNAME, "picked a server (ID: %s)",
duidstr(&s->optinfo.serverID));
return (s);
}
@@ -1185,7 +1185,7 @@ client6_send(ev)
dh6->dh6_msgtype = DH6_INFORM_REQ;
break;
default:
- dprintf(LOG_ERR, FNAME, "unexpected state");
+ debug_printf(LOG_ERR, FNAME, "unexpected state");
exit(1); /* XXX */
}
@@ -1203,7 +1203,7 @@ client6_send(ev)
#else
ev->xid = random() & DH6_XIDMASK;
#endif
- dprintf(LOG_DEBUG, FNAME, "a new XID (%x) is generated",
+ debug_printf(LOG_DEBUG, FNAME, "a new XID (%x) is generated",
ev->xid);
}
dh6->dh6_xid &= ~ntohl(DH6_XIDMASK);
@@ -1221,7 +1221,7 @@ client6_send(ev)
case DHCP6S_RENEW:
case DHCP6S_RELEASE:
if (duidcpy(&optinfo.serverID, &ev->serverid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto end;
}
break;
@@ -1229,7 +1229,7 @@ client6_send(ev)
/* client ID */
if (duidcpy(&optinfo.clientID, &client_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto end;
}
@@ -1274,7 +1274,7 @@ client6_send(ev)
/* option request options */
if (ev->state != DHCP6S_RELEASE &&
dhcp6_copy_list(&optinfo.reqopt_list, &ifp->reqopt_list)) {
- dprintf(LOG_ERR, FNAME, "failed to copy requested options");
+ debug_printf(LOG_ERR, FNAME, "failed to copy requested options");
goto end;
}
@@ -1285,7 +1285,7 @@ client6_send(ev)
case DHCP6_EVDATA_IAPD:
if (dhcp6_copy_list(&optinfo.iapd_list,
(struct dhcp6_list *)evd->data)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to add an IAPD");
goto end;
}
@@ -1293,13 +1293,13 @@ client6_send(ev)
case DHCP6_EVDATA_IANA:
if (dhcp6_copy_list(&optinfo.iana_list,
(struct dhcp6_list *)evd->data)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to add an IAPD");
goto end;
}
break;
default:
- dprintf(LOG_ERR, FNAME, "unexpected event data (%d)",
+ debug_printf(LOG_ERR, FNAME, "unexpected event data (%d)",
evd->type);
exit(1);
}
@@ -1307,7 +1307,7 @@ client6_send(ev)
/* authentication information */
if (set_auth(ev, &optinfo)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to set authentication option");
goto end;
}
@@ -1316,7 +1316,7 @@ client6_send(ev)
if ((optlen = dhcp6_set_options(dh6->dh6_msgtype,
(struct dhcp6opt *)(dh6 + 1),
(struct dhcp6opt *)(buf + sizeof(buf)), &optinfo)) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to construct options");
+ debug_printf(LOG_INFO, FNAME, "failed to construct options");
goto end;
}
len += optlen;
@@ -1332,7 +1332,7 @@ client6_send(ev)
optinfo.authproto, optinfo.authalgorithm,
optinfo.delayedauth_offset + sizeof(*dh6),
ev->authparam->key)) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to calculate MAC");
goto end;
}
@@ -1354,12 +1354,12 @@ client6_send(ev)
if (sendto(sock, buf, len, 0, (struct sockaddr *)&dst,
sysdep_sa_len((struct sockaddr *)&dst)) == -1) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"transmit failed: %s", strerror(errno));
goto end;
}
- dprintf(LOG_DEBUG, FNAME, "send %s to %s",
+ debug_printf(LOG_DEBUG, FNAME, "send %s to %s",
dhcp6msgstr(dh6->dh6_msgtype), addr2str((struct sockaddr *)&dst));
end:
@@ -1417,7 +1417,7 @@ client6_recv()
mhdr.msg_control = (caddr_t)cmsgbuf;
mhdr.msg_controllen = sizeof(cmsgbuf);
if ((len = recvmsg(sock, &mhdr, 0)) < 0) {
- dprintf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
return;
}
@@ -1431,24 +1431,24 @@ client6_recv()
}
}
if (pi == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to get packet info");
+ debug_printf(LOG_NOTICE, FNAME, "failed to get packet info");
return;
}
if ((ifp = find_ifconfbyid((unsigned int)pi->ipi6_ifindex)) == NULL) {
- dprintf(LOG_INFO, FNAME, "unexpected interface (%d)",
+ debug_printf(LOG_INFO, FNAME, "unexpected interface (%d)",
(unsigned int)pi->ipi6_ifindex);
return;
}
if (len < sizeof(*dh6)) {
- dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
return;
}
dh6 = (struct dhcp6 *)rbuf;
- dprintf(LOG_DEBUG, FNAME, "receive %s from %s on %s",
+ debug_printf(LOG_DEBUG, FNAME, "receive %s from %s on %s",
dhcp6msgstr(dh6->dh6_msgtype),
addr2str((struct sockaddr *)&from), ifp->ifname);
@@ -1457,7 +1457,7 @@ client6_recv()
p = (struct dhcp6opt *)(dh6 + 1);
ep = (struct dhcp6opt *)((char *)dh6 + len);
if (dhcp6_get_options(p, ep, &optinfo) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to parse options");
+ debug_printf(LOG_INFO, FNAME, "failed to parse options");
return;
}
@@ -1469,7 +1469,7 @@ client6_recv()
(void)client6_recvreply(ifp, dh6, len, &optinfo);
break;
default:
- dprintf(LOG_INFO, FNAME, "received an unexpected message (%s) "
+ debug_printf(LOG_INFO, FNAME, "received an unexpected message (%s) "
"from %s", dhcp6msgstr(dh6->dh6_msgtype),
addr2str((struct sockaddr *)&from));
break;
@@ -1494,32 +1494,32 @@ client6_recvadvert(ifp, dh6, len, optinfo)
/* find the corresponding event based on the received xid */
ev = find_event_withid(ifp, ntohl(dh6->dh6_xid) & DH6_XIDMASK);
if (ev == NULL) {
- dprintf(LOG_INFO, FNAME, "XID mismatch");
+ debug_printf(LOG_INFO, FNAME, "XID mismatch");
return (-1);
}
/* packet validation based on Section 15.3 of RFC3315. */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
} else {
- dprintf(LOG_DEBUG, FNAME, "server ID: %s, pref=%d",
+ debug_printf(LOG_DEBUG, FNAME, "server ID: %s, pref=%d",
duidstr(&optinfo->serverID),
optinfo->pref);
}
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
if (duidcmp(&optinfo->clientID, &client_duid)) {
- dprintf(LOG_INFO, FNAME, "client DUID mismatch");
+ debug_printf(LOG_INFO, FNAME, "client DUID mismatch");
return (-1);
}
/* validate authentication */
authparam0 = *ev->authparam;
if (process_auth(&authparam0, dh6, len, optinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication");
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication");
return (-1);
}
@@ -1552,7 +1552,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
}
if (dhcp6_find_listval(&optinfo->stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, 0)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"advertise contains %s status", stcodestr);
return (-1);
}
@@ -1567,20 +1567,20 @@ client6_recvadvert(ifp, dh6, len, optinfo)
* We process the message as if we expected the Advertise.
* [RFC3315 Section 17.1.4]
*/
- dprintf(LOG_INFO, FNAME, "unexpected advertise");
+ debug_printf(LOG_INFO, FNAME, "unexpected advertise");
/* proceed anyway */
}
/* ignore the server if it is known */
if (find_server(ev, &optinfo->serverID)) {
- dprintf(LOG_INFO, FNAME, "duplicated server (ID: %s)",
+ debug_printf(LOG_INFO, FNAME, "duplicated server (ID: %s)",
duidstr(&optinfo->serverID));
return (-1);
}
/* keep the server */
if ((newserver = malloc(sizeof(*newserver))) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"memory allocation failed for server");
return (-1);
}
@@ -1595,7 +1595,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
/* allocate new authentication parameter for the soliciting event */
if ((authparam = new_authparam(ev->authparam->authproto,
ev->authparam->authalgorithm, ev->authparam->authrdm)) == NULL) {
- dprintf(LOG_WARNING, FNAME, "memory allocation failed "
+ debug_printf(LOG_WARNING, FNAME, "memory allocation failed "
"for authentication parameters");
free(newserver);
return (-1);
@@ -1605,7 +1605,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
/* copy options */
dhcp6_init_options(&newserver->optinfo);
if (dhcp6_copy_options(&newserver->optinfo, optinfo)) {
- dprintf(LOG_ERR, FNAME, "failed to copy options");
+ debug_printf(LOG_ERR, FNAME, "failed to copy options");
if (newserver->authparam != NULL)
free(newserver->authparam);
free(newserver);
@@ -1633,11 +1633,11 @@ client6_recvadvert(ifp, dh6, len, optinfo)
ev->current_server = newserver;
if (duidcpy(&ev->serverid,
&ev->current_server->optinfo.serverID)) {
- dprintf(LOG_NOTICE, FNAME, "can't copy server ID");
+ debug_printf(LOG_NOTICE, FNAME, "can't copy server ID");
return (-1); /* XXX: better recovery? */
}
if (construct_reqdata(ifp, &ev->current_server->optinfo, ev)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to construct request data");
return (-1); /* XXX */
}
@@ -1673,7 +1673,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
else
timo.tv_sec = timo.tv_usec = 0;
- dprintf(LOG_DEBUG, FNAME, "reset timer for %s to %d.%06d",
+ debug_printf(LOG_DEBUG, FNAME, "reset timer for %s to %d.%06d",
ifp->ifname, (int)timo.tv_sec, (int)timo.tv_usec);
dhcp6_set_timer(&timo, ev->timer);
@@ -1711,7 +1711,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
/* find the corresponding event based on the received xid */
ev = find_event_withid(ifp, ntohl(dh6->dh6_xid) & DH6_XIDMASK);
if (ev == NULL) {
- dprintf(LOG_INFO, FNAME, "XID mismatch");
+ debug_printf(LOG_INFO, FNAME, "XID mismatch");
return (-1);
}
@@ -1723,13 +1723,13 @@ client6_recvreply(ifp, dh6, len, optinfo)
state != DHCP6S_RELEASE &&
(state != DHCP6S_SOLICIT ||
!(ifp->send_flags & DHCIFF_RAPID_COMMIT))) {
- dprintf(LOG_INFO, FNAME, "unexpected reply");
+ debug_printf(LOG_INFO, FNAME, "unexpected reply");
return (-1);
}
/* A Reply message must contain a Server ID option */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
}
@@ -1738,17 +1738,17 @@ client6_recvreply(ifp, dh6, len, optinfo)
* client implementation) must match ours.
*/
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
if (duidcmp(&optinfo->clientID, &client_duid)) {
- dprintf(LOG_INFO, FNAME, "client DUID mismatch");
+ debug_printf(LOG_INFO, FNAME, "client DUID mismatch");
return (-1);
}
/* validate authentication */
if (process_auth(ev->authparam, dh6, len, optinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication");
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication");
return (-1);
}
@@ -1762,7 +1762,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
if (state == DHCP6S_SOLICIT &&
(ifp->send_flags & DHCIFF_RAPID_COMMIT) &&
!optinfo->rapidcommit) {
- dprintf(LOG_INFO, FNAME, "no rapid commit");
+ debug_printf(LOG_INFO, FNAME, "no rapid commit");
return (-1);
}
@@ -1773,7 +1773,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
*/
for (lv = TAILQ_FIRST(&optinfo->stcode_list); lv;
lv = TAILQ_NEXT(lv, link)) {
- dprintf(LOG_INFO, FNAME, "status code: %s",
+ debug_printf(LOG_INFO, FNAME, "status code: %s",
dhcp6_stcodestr(lv->val_num16));
}
@@ -1837,7 +1837,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
* configuration parameters.
*/
if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) {
- dprintf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
+ debug_printf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
client6_script(ifp->scriptpath, state, optinfo);
}
@@ -1855,7 +1855,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
ifp->timer = dhcp6_add_timer(client6_expire_refreshtime, ifp);
if (ifp->timer == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to add timer for refresh time");
} else {
struct timeval tv;
@@ -1868,7 +1868,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
* XXX: tv_sec can overflow for an
* unsigned 32bit value.
*/
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"refresh time is too large: %lu",
(u_int32_t)refreshtime);
tv.tv_sec = 0x7fffffff; /* XXX */
@@ -1881,7 +1881,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
* draft-ietf-dhc-lifetime-02 clarifies that refresh time
* is only used for information-request and reply exchanges.
*/
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unexpected information refresh time option (ignored)");
}
@@ -1906,7 +1906,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
check_exit();
}
- dprintf(LOG_DEBUG, FNAME, "got an expected reply, sleeping.");
+ debug_printf(LOG_DEBUG, FNAME, "got an expected reply, sleeping.");
if (infreq_mode) {
exit_ok = 1;
@@ -1949,19 +1949,19 @@ process_auth(authparam, dh6, len, optinfo)
break;
case DHCP6_AUTHPROTO_DELAYED:
if ((optinfo->authflags & DHCP6OPT_AUTHFLAG_NOINFO)) {
- dprintf(LOG_INFO, FNAME, "server did not include "
+ debug_printf(LOG_INFO, FNAME, "server did not include "
"authentication information");
break;
}
if (optinfo->authalgorithm != DHCP6_AUTHALG_HMACMD5) {
- dprintf(LOG_INFO, FNAME, "unknown authentication "
+ debug_printf(LOG_INFO, FNAME, "unknown authentication "
"algorithm (%d)", optinfo->authalgorithm);
break;
}
if (optinfo->authrdm != DHCP6_AUTHRDM_MONOCOUNTER) {
- dprintf(LOG_INFO, FNAME,"unknown RDM (%d)",
+ debug_printf(LOG_INFO, FNAME,"unknown RDM (%d)",
optinfo->authrdm);
break;
}
@@ -1971,12 +1971,12 @@ process_auth(authparam, dh6, len, optinfo)
* we accept the message anyway (XXX).
*/
if ((authparam->flags & AUTHPARAM_FLAGS_NOPREVRD)) {
- dprintf(LOG_WARNING, FNAME, "previous RD value is "
+ debug_printf(LOG_WARNING, FNAME, "previous RD value is "
"unknown (accept it)");
} else {
if (dhcp6_auth_replaycheck(optinfo->authrdm,
authparam->prevrd, optinfo->authrd)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"possible replay attack detected");
break;
}
@@ -1993,7 +1993,7 @@ process_auth(authparam, dh6, len, optinfo)
optinfo->delayedauth_realmlen != key->realmlen ||
memcmp(optinfo->delayedauth_realmval, key->realm,
key->realmlen) != 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"authentication key mismatch");
break;
}
@@ -2002,12 +2002,12 @@ process_auth(authparam, dh6, len, optinfo)
optinfo->delayedauth_realmlen,
optinfo->delayedauth_keyid);
if (key == NULL) {
- dprintf(LOG_INFO, FNAME, "failed to find key "
+ debug_printf(LOG_INFO, FNAME, "failed to find key "
"provided by the server (ID: %x)",
optinfo->delayedauth_keyid);
break;
} else {
- dprintf(LOG_DEBUG, FNAME, "found key for "
+ debug_printf(LOG_DEBUG, FNAME, "found key for "
"authentication: %s", key->name);
}
authparam->key = key;
@@ -2015,7 +2015,7 @@ process_auth(authparam, dh6, len, optinfo)
/* check for the key lifetime */
if (dhcp6_validate_key(key)) {
- dprintf(LOG_INFO, FNAME, "key %s has expired",
+ debug_printf(LOG_INFO, FNAME, "key %s has expired",
key->name);
break;
}
@@ -2024,24 +2024,24 @@ process_auth(authparam, dh6, len, optinfo)
if (dhcp6_verify_mac((char *)dh6, len, optinfo->authproto,
optinfo->authalgorithm,
optinfo->delayedauth_offset + sizeof(*dh6), key) == 0) {
- dprintf(LOG_DEBUG, FNAME, "message authentication "
+ debug_printf(LOG_DEBUG, FNAME, "message authentication "
"validated");
authenticated = 1;
} else {
- dprintf(LOG_INFO, FNAME, "invalid message "
+ debug_printf(LOG_INFO, FNAME, "invalid message "
"authentication");
}
break;
default:
- dprintf(LOG_INFO, FNAME, "server sent unsupported "
+ debug_printf(LOG_INFO, FNAME, "server sent unsupported "
"authentication protocol (%d)", optinfo->authproto);
break;
}
if (authenticated == 0) {
if (authparam->authproto != DHCP6_AUTHPROTO_UNDEF) {
- dprintf(LOG_INFO, FNAME, "message not authenticated "
+ debug_printf(LOG_INFO, FNAME, "message not authenticated "
"while authentication required");
/*
@@ -2084,7 +2084,7 @@ set_auth(ev, optinfo)
* exchanges doesn't work. Specification is also
* unclear on this usage.
*/
- dprintf(LOG_WARNING, FNAME, "delayed authentication "
+ debug_printf(LOG_WARNING, FNAME, "delayed authentication "
"cannot be used for Information-request yet");
return (-1);
}
@@ -2095,21 +2095,21 @@ set_auth(ev, optinfo)
}
if (authparam->key == NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"no authentication key for %s",
dhcp6_event_statestr(ev));
return (-1);
}
if (dhcp6_validate_key(authparam->key)) {
- dprintf(LOG_INFO, FNAME, "key %s is invalid",
+ debug_printf(LOG_INFO, FNAME, "key %s is invalid",
authparam->key->name);
return (-1);
}
if (get_rdvalue(optinfo->authrdm, &optinfo->authrd,
sizeof(optinfo->authrd))) {
- dprintf(LOG_ERR, FNAME, "failed to get a replay "
+ debug_printf(LOG_ERR, FNAME, "failed to get a replay "
"detection value");
return (-1);
}
@@ -2119,7 +2119,7 @@ set_auth(ev, optinfo)
optinfo->delayedauth_realmval =
malloc(optinfo->delayedauth_realmlen);
if (optinfo->delayedauth_realmval == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to allocate memory "
+ debug_printf(LOG_ERR, FNAME, "failed to allocate memory "
"for authentication realm");
return (-1);
}
@@ -2128,7 +2128,7 @@ set_auth(ev, optinfo)
break;
default:
- dprintf(LOG_ERR, FNAME, "unsupported authentication protocol "
+ debug_printf(LOG_ERR, FNAME, "unsupported authentication protocol "
"%d", authparam->authproto);
return (-1);
}
@@ -2145,7 +2145,7 @@ info_printf(const char *fmt, ...)
va_start(ap, fmt);
vsnprintf(logbuf, sizeof(logbuf), fmt, ap);
- dprintf(LOG_DEBUG, FNAME, "%s", logbuf);
+ debug_printf(LOG_DEBUG, FNAME, "%s", logbuf);
if (infreq_mode)
printf("%s\n", logbuf);
diff --git a/dhcp6c_ia.c b/dhcp6c_ia.c
index 6877c20..1dc37d3 100644
--- a/dhcp6c_ia.c
+++ b/dhcp6c_ia.c
@@ -122,7 +122,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
* We apply the same rule to IA_PD as well.
*/
if (iav->val_ia.t2 != 0 && iav->val_ia.t1 > iav->val_ia.t2) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"invalid IA: T1(%lu) > T2(%lu)",
iav->val_ia.t1, iav->val_ia.t2);
continue;
@@ -131,14 +131,14 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
/* locate the local IA or make a new one */
ia = get_ia(iatype, ifp, iac, iav, serverid);
if (ia == NULL) {
- dprintf(LOG_WARNING, FNAME, "failed to get an IA "
+ debug_printf(LOG_WARNING, FNAME, "failed to get an IA "
"type: %s, ID: %u", iastr(iac->type), iac->iaid);
continue;
}
/* update authentication parameters */
if (update_authparam(ia, authparam)) {
- dprintf(LOG_WARNING, FNAME, "failed to update "
+ debug_printf(LOG_WARNING, FNAME, "failed to update "
"authentication param for IA "
"type: %s, ID: %u", iastr(iac->type), iac->iaid);
remove_ia(ia);
@@ -155,7 +155,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
if (update_prefix(ia, &siav->val_prefix6,
&iapdc->iapd_pif_list, ifp, &ia->ctl,
callback)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to update a prefix %s/%d",
in6addr2str(&siav->val_prefix6.addr, 0),
siav->val_prefix6.plen);
@@ -165,13 +165,13 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
ianac = (struct iana_conf *)iac;
if (update_address(ia, &siav->val_statefuladdr6,
ifp, &ia->ctl, callback)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to update an address %s",
in6addr2str(&siav->val_statefuladdr6.addr, 0));
}
break;
case DHCP6_LISTVAL_STCODE:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"status code for %s-%lu: %s",
iastr(iatype), iav->val_ia.iaid,
dhcp6_stcodestr(siav->val_num16));
@@ -187,7 +187,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
* [RFC3315 18.1.8]
* XXX: what about the PD case?
*/
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"receive NoBinding against "
"renew/rebind for %s-%lu",
iastr(ia->conf->type),
@@ -197,14 +197,14 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
}
break;
default:
- dprintf(LOG_ERR, FNAME, "impossible case");
+ debug_printf(LOG_ERR, FNAME, "impossible case");
goto nextia;
}
}
/* see if this IA is still valid. if not, remove it. */
if (ia->ctl == NULL || !(*ia->ctl->isvalid)(ia->ctl)) {
- dprintf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
+ debug_printf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
iastr(ia->conf->type), ia->conf->iaid);
remove_ia(ia);
continue;
@@ -236,7 +236,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
if (ia->t1 > ia->t2)
ia->t1 = ia->t2 * 5 / 8;
- dprintf(LOG_INFO, FNAME, "T1(%lu) and/or T2(%lu) "
+ debug_printf(LOG_INFO, FNAME, "T1(%lu) and/or T2(%lu) "
"is locally determined", ia->t1, ia->t2);
}
@@ -246,11 +246,11 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
* without renewal.
*/
if (ia->t2 < DHCP6_DURATION_MIN) {
- dprintf(LOG_INFO, FNAME, "T1 (%lu) or T2 (%lu) "
+ debug_printf(LOG_INFO, FNAME, "T1 (%lu) or T2 (%lu) "
"is too small", ia->t1, ia->t2);
ia->t2 = DHCP6_DURATION_MIN;
ia->t1 = ia->t2 * 5 / 8;
- dprintf(LOG_INFO, "", " adjusted to %lu and %lu",
+ debug_printf(LOG_INFO, "", " adjusted to %lu and %lu",
ia->t1, ia->t2);
}
@@ -262,7 +262,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
if (ia->timer == NULL)
ia->timer = dhcp6_add_timer(ia_timo, ia);
if (ia->timer == NULL) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to add IA timer");
remove_ia(ia); /* XXX */
continue;
@@ -289,7 +289,7 @@ update_authparam(ia, authparam)
if (ia->authparam == NULL) {
if ((ia->authparam = copy_authparam(authparam)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to copy authparam");
return (-1);
}
@@ -311,11 +311,11 @@ reestablish_ia(ia)
struct dhcp6_event *ev;
struct dhcp6_eventdata *evd;
- dprintf(LOG_DEBUG, FNAME, "re-establishing IA: %s-%lu",
+ debug_printf(LOG_DEBUG, FNAME, "re-establishing IA: %s-%lu",
iastr(ia->conf->type), ia->conf->iaid);
if (ia->state != IAS_RENEW && ia->state != IAS_REBIND) {
- dprintf(LOG_ERR, FNAME, "internal error (invalid IA status)");
+ debug_printf(LOG_ERR, FNAME, "internal error (invalid IA status)");
exit(1); /* XXX */
}
@@ -333,19 +333,19 @@ reestablish_ia(ia)
dhcp6_remove_timer(&ia->timer);
if ((ev = dhcp6_create_event(ia->ifp, DHCP6S_REQUEST)) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
+ debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
goto fail;
}
TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event timer");
goto fail;
}
if ((evd = malloc(sizeof(*evd))) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event data");
goto fail;
}
@@ -354,7 +354,7 @@ reestablish_ia(ia)
TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
if (duidcpy(&ev->serverid, &ia->serverid)) {
- dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
goto fail;
}
@@ -365,7 +365,7 @@ reestablish_ia(ia)
if (ia->ctl && ia->ctl->reestablish_data) {
if ((*ia->ctl->reestablish_data)(ia->ctl, &iaparam,
&ia->evdata, evd)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make reestablish data");
goto fail;
}
@@ -373,7 +373,7 @@ reestablish_ia(ia)
if (ia->authparam != NULL) {
if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to copy authparam");
goto fail;
}
@@ -402,7 +402,7 @@ callback(ia)
{
/* see if this IA is still valid. if not, remove it. */
if (ia->ctl == NULL || !(*ia->ctl->isvalid)(ia->ctl)) {
- dprintf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
+ debug_printf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
iastr(ia->conf->type), ia->conf->iaid);
remove_ia(ia);
}
@@ -441,30 +441,30 @@ release_ia(ia)
struct dhcp6_event *ev;
struct dhcp6_eventdata *evd;
- dprintf(LOG_DEBUG, FNAME, "release an IA: %s-%lu",
+ debug_printf(LOG_DEBUG, FNAME, "release an IA: %s-%lu",
iastr(ia->conf->type), ia->conf->iaid);
if ((ev = dhcp6_create_event(ia->ifp, DHCP6S_RELEASE))
== NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
+ debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
goto fail;
}
TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event timer");
goto fail;
}
if (duidcpy(&ev->serverid, &ia->serverid)) {
- dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
goto fail;
}
if ((evd = malloc(sizeof(*evd))) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event data");
goto fail;
}
@@ -476,7 +476,7 @@ release_ia(ia)
if (ia->ctl && ia->ctl->release_data) {
if ((*ia->ctl->release_data)(ia->ctl, &iaparam, NULL, evd)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make release data");
goto fail;
}
@@ -489,7 +489,7 @@ release_ia(ia)
if (ia->authparam != NULL) {
if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to copy authparam");
goto fail;
}
@@ -513,7 +513,7 @@ remove_ia(ia)
struct ia_conf *iac = ia->conf;
struct dhcp6_if *ifp = ia->ifp;
- dprintf(LOG_DEBUG, FNAME, "remove an IA: %s-%lu",
+ debug_printf(LOG_DEBUG, FNAME, "remove an IA: %s-%lu",
iastr(ia->conf->type), ia->conf->iaid);
TAILQ_REMOVE(&iac->iadata, ia, link);
@@ -553,7 +553,7 @@ ia_timo(arg)
struct timeval timo;
int dhcpstate;
- dprintf(LOG_DEBUG, FNAME, "IA timeout for %s-%lu, state=%s",
+ debug_printf(LOG_DEBUG, FNAME, "IA timeout for %s-%lu, state=%s",
iastr(ia->conf->type), ia->conf->iaid, statestr(ia->state));
/* cancel the current event for the prefix. */
@@ -586,25 +586,25 @@ ia_timo(arg)
dhcp6_remove_timer(&ia->timer);
break;
default:
- dprintf(LOG_ERR, FNAME, "invalid IA state (%d)",
+ debug_printf(LOG_ERR, FNAME, "invalid IA state (%d)",
(int)ia->state);
return (NULL); /* XXX */
}
if ((ev = dhcp6_create_event(ia->ifp, dhcpstate)) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
+ debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
goto fail;
}
TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event timer");
goto fail;
}
if ((evd = malloc(sizeof(*evd))) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to create a new event data");
goto fail;
}
@@ -614,7 +614,7 @@ ia_timo(arg)
if (ia->state == IAS_RENEW) {
if (duidcpy(&ev->serverid, &ia->serverid)) {
- dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
goto fail;
}
}
@@ -627,7 +627,7 @@ ia_timo(arg)
if (ia->ctl && ia->ctl->renew_data) {
if ((*ia->ctl->renew_data)(ia->ctl, &iaparam,
&ia->evdata, evd)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make renew data");
goto fail;
}
@@ -637,7 +637,7 @@ ia_timo(arg)
if (ia->ctl && ia->ctl->rebind_data) {
if ((*ia->ctl->rebind_data)(ia->ctl, &iaparam,
&ia->evdata, evd)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make rebind data");
goto fail;
}
@@ -653,7 +653,7 @@ ia_timo(arg)
if (ia->authparam != NULL) {
if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to copy authparam");
goto fail;
}
@@ -693,13 +693,13 @@ get_ia(type, ifp, iac, iaparam, serverid)
int create = 0;
if (duidcpy(&newserver, serverid)) {
- dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
return (NULL);
}
if ((ia = find_ia(iac, type, iaparam->val_ia.iaid)) == NULL) {
if ((ia = malloc(sizeof(*ia))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
+ debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
duidfree(&newserver); /* XXX */
return (NULL);
}
@@ -718,7 +718,7 @@ get_ia(type, ifp, iac, iaparam, serverid)
ia->ifp = ifp;
ia->serverid = newserver;
- dprintf(LOG_DEBUG, FNAME, "%s an IA: %s-%lu",
+ debug_printf(LOG_DEBUG, FNAME, "%s an IA: %s-%lu",
create ? "make" : "update", iastr(type), ia->conf->iaid);
return (ia);
diff --git a/dhcp6c_script.c b/dhcp6c_script.c
index 05ccf8c..583ac7d 100644
--- a/dhcp6c_script.c
+++ b/dhcp6c_script.c
@@ -156,7 +156,7 @@ client6_script(scriptpath, state, optinfo)
/* allocate an environments array */
if ((envp = malloc(sizeof (char *) * envc)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate environment buffer");
return -1;
}
@@ -168,7 +168,7 @@ client6_script(scriptpath, state, optinfo)
i = 0;
/* reason */
if ((envp[i++] = strdup(reason)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate reason strings");
ret = -1;
goto clean;
@@ -178,7 +178,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (dnsserver_str) +
(INET6_ADDRSTRLEN + 1) * dnsservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for DNS servers");
ret = -1;
goto clean;
@@ -198,7 +198,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (ntpserver_str) +
(INET6_ADDRSTRLEN + 1) * ntpservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for NTP servers");
ret = -1;
goto clean;
@@ -218,7 +218,7 @@ client6_script(scriptpath, state, optinfo)
if (dnsnamelen) {
elen = sizeof (dnsname_str) + dnsnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for DNS name");
ret = -1;
goto clean;
@@ -236,7 +236,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (sipserver_str) +
(INET6_ADDRSTRLEN + 1) * sipservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for SIP servers");
ret = -1;
goto clean;
@@ -255,7 +255,7 @@ client6_script(scriptpath, state, optinfo)
if (sipnamelen) {
elen = sizeof (sipname_str) + sipnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for SIP domain name");
ret = -1;
goto clean;
@@ -273,7 +273,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (nisserver_str) +
(INET6_ADDRSTRLEN + 1) * nisservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for NIS servers");
ret = -1;
goto clean;
@@ -292,7 +292,7 @@ client6_script(scriptpath, state, optinfo)
if (nisnamelen) {
elen = sizeof (nisname_str) + nisnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for NIS domain name");
ret = -1;
goto clean;
@@ -310,7 +310,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (nispserver_str) +
(INET6_ADDRSTRLEN + 1) * nispservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for NIS+ servers");
ret = -1;
goto clean;
@@ -329,7 +329,7 @@ client6_script(scriptpath, state, optinfo)
if (nispnamelen) {
elen = sizeof (nispname_str) + nispnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for NIS+ domain name");
ret = -1;
goto clean;
@@ -347,7 +347,7 @@ client6_script(scriptpath, state, optinfo)
elen = sizeof (bcmcsserver_str) +
(INET6_ADDRSTRLEN + 1) * bcmcsservers + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for BCMC servers");
ret = -1;
goto clean;
@@ -366,7 +366,7 @@ client6_script(scriptpath, state, optinfo)
if (bcmcsnamelen) {
elen = sizeof (bcmcsname_str) + bcmcsnamelen + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate strings for BCMC domain name");
ret = -1;
goto clean;
@@ -383,7 +383,7 @@ client6_script(scriptpath, state, optinfo)
/* launch the script */
pid = fork();
if (pid < 0) {
- dprintf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
ret = -1;
goto clean;
} else if (pid) {
@@ -394,9 +394,9 @@ client6_script(scriptpath, state, optinfo)
} while (wpid != pid && wpid > 0);
if (wpid < 0)
- dprintf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
else {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"script \"%s\" terminated", scriptpath);
}
} else {
@@ -407,7 +407,7 @@ client6_script(scriptpath, state, optinfo)
argv[1] = NULL;
if (safefile(scriptpath)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"script \"%s\" cannot be executed safely",
scriptpath);
exit(1);
@@ -423,7 +423,7 @@ client6_script(scriptpath, state, optinfo)
execve(scriptpath, argv, envp);
- dprintf(LOG_ERR, FNAME, "child: exec failed: %s",
+ debug_printf(LOG_ERR, FNAME, "child: exec failed: %s",
strerror(errno));
exit(0);
}
diff --git a/dhcp6relay.c b/dhcp6relay.c
index eb0bce9..99b1227 100644
--- a/dhcp6relay.c
+++ b/dhcp6relay.c
@@ -228,7 +228,7 @@ main(argc, argv)
relay6_init(argc, argv);
- dprintf(LOG_INFO, FNAME, "dhcp6relay started");
+ debug_printf(LOG_INFO, FNAME, "dhcp6relay started");
relay6_loop();
exit(0);
@@ -246,7 +246,7 @@ make_prefix(pstr0)
/* make a local copy for safety */
if (strlcpy(pstr, pstr0, sizeof (pstr)) >= sizeof (pstr)) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"prefix string too long (maybe bogus): %s", pstr0);
return (NULL);
}
@@ -256,27 +256,27 @@ make_prefix(pstr0)
plen = 128; /* assumes it as a host prefix */
else {
if (p[1] == '\0') {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"no prefix length (ignored): %s", p + 1);
return (NULL);
}
plen = (int)strtoul(p + 1, &ep, 10);
if (*ep != '\0') {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"illegal prefix length (ignored): %s", p + 1);
return (NULL);
}
*p = '\0';
}
if (inet_pton(AF_INET6, pstr, &paddr) != 1) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"inet_pton failed for %s", pstr);
return (NULL);
}
/* allocate a new entry */
if ((pent = (struct prefix_list *)malloc(sizeof (*pent))) == NULL) {
- dprintf(LOG_WARNING, FNAME, "memory allocation failed");
+ debug_printf(LOG_WARNING, FNAME, "memory allocation failed");
return (NULL); /* or abort? */
}
@@ -318,14 +318,14 @@ relay6_init(int ifnum, char *iflist[])
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(serveraddr, DH6PORT_UPSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
goto failexit;
}
if (res->ai_family != PF_INET6 ||
res->ai_addrlen < sizeof (sa6_server)) {
/* this should be impossible, but check for safety */
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"getaddrinfo returned a bogus address: %s",
strerror(errno));
goto failexit;
@@ -341,7 +341,7 @@ relay6_init(int ifnum, char *iflist[])
rmh.msg_iovlen = 1;
rmsgctllen = CMSG_SPACE(sizeof (struct in6_pktinfo));
if ((rmsgctlbuf = (char *)malloc(rmsgctllen)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
goto failexit;
}
@@ -355,13 +355,13 @@ relay6_init(int ifnum, char *iflist[])
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(NULL, DH6PORT_UPSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
goto failexit;
}
csock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (csock < 0) {
- dprintf(LOG_ERR, FNAME, "socket(csock): %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "socket(csock): %s", strerror(errno));
goto failexit;
}
if (csock > maxfd)
@@ -369,20 +369,20 @@ relay6_init(int ifnum, char *iflist[])
on = 1;
if (setsockopt(csock, SOL_SOCKET, SO_REUSEPORT,
&on, sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(csock, SO_REUSEPORT): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(csock, SO_REUSEPORT): %s",
strerror(errno));
goto failexit;
}
#ifdef IPV6_V6ONLY
if (setsockopt(csock, IPPROTO_IPV6, IPV6_V6ONLY,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(csock, IPV6_V6ONLY): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(csock, IPV6_V6ONLY): %s",
strerror(errno));
goto failexit;
}
#endif
if (bind(csock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, FNAME, "bind(csock): %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "bind(csock): %s", strerror(errno));
goto failexit;
}
freeaddrinfo(res);
@@ -390,14 +390,14 @@ relay6_init(int ifnum, char *iflist[])
#ifdef IPV6_RECVPKTINFO
if (setsockopt(csock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
strerror(errno));
goto failexit;
}
#else
if (setsockopt(csock, IPPROTO_IPV6, IPV6_PKTINFO,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
strerror(errno));
goto failexit;
}
@@ -406,7 +406,7 @@ relay6_init(int ifnum, char *iflist[])
hints.ai_flags = 0;
error = getaddrinfo(DH6ADDR_ALLAGENT, 0, &hints, &res2);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
goto failexit;
}
@@ -422,21 +422,21 @@ relay6_init(int ifnum, char *iflist[])
ifd = (struct ifid_list *)malloc(sizeof (*ifd));
if (ifd == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"memory allocation failed");
goto failexit;
}
memset(ifd, 0, sizeof (*ifd));
ifd->ifid = if_nametoindex(ifp);
if (ifd->ifid == 0) {
- dprintf(LOG_ERR, FNAME, "invalid interface %s", ifp);
+ debug_printf(LOG_ERR, FNAME, "invalid interface %s", ifp);
goto failexit;
}
mreq6.ipv6mr_interface = ifd->ifid;
if (setsockopt(csock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
&mreq6, sizeof (mreq6))) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(csock, IPV6_JOIN_GROUP): %s",
strerror(errno));
goto failexit;
@@ -451,7 +451,7 @@ relay6_init(int ifnum, char *iflist[])
*/
relayifid = if_nametoindex(relaydevice);
if (relayifid == 0)
- dprintf(LOG_ERR, FNAME, "invalid interface %s", relaydevice);
+ debug_printf(LOG_ERR, FNAME, "invalid interface %s", relaydevice);
/*
* We are not really sure if we need to listen on the downstream
* port to receive packets from servers. We'll need to clarify the
@@ -460,14 +460,14 @@ relay6_init(int ifnum, char *iflist[])
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(boundaddr, DH6PORT_DOWNSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
goto failexit;
}
memcpy(&sa6_client, res->ai_addr, sizeof (sa6_client));
ssock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (ssock < 0) {
- dprintf(LOG_ERR, FNAME, "socket(outsock): %s",
+ debug_printf(LOG_ERR, FNAME, "socket(outsock): %s",
strerror(error));
goto failexit;
}
@@ -480,7 +480,7 @@ relay6_init(int ifnum, char *iflist[])
*/
if (setsockopt(ssock, SOL_SOCKET, SO_REUSEPORT,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(ssock, SO_REUSEPORT): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(ssock, SO_REUSEPORT): %s",
strerror(errno));
goto failexit;
}
@@ -488,13 +488,13 @@ relay6_init(int ifnum, char *iflist[])
#ifdef IPV6_V6ONLY
if (setsockopt(ssock, IPPROTO_IPV6, IPV6_V6ONLY,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(ssock, IPV6_V6ONLY): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(ssock, IPV6_V6ONLY): %s",
strerror(errno));
goto failexit;
}
#endif
if (bind(ssock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, FNAME, "bind(ssock): %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "bind(ssock): %s", strerror(errno));
goto failexit;
}
freeaddrinfo(res);
@@ -503,21 +503,21 @@ relay6_init(int ifnum, char *iflist[])
#ifdef IPV6_RECVPKTINFO
if (setsockopt(ssock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
strerror(errno));
goto failexit;
}
#else
if (setsockopt(ssock, IPPROTO_IPV6, IPV6_PKTINFO,
&on, sizeof (on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
strerror(errno));
goto failexit;
}
#endif
if (signal(SIGTERM, relay6_signal) == SIG_ERR) {
- dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
strerror(errno));
exit(1);
}
@@ -605,15 +605,15 @@ relay6_recv(s, fromclient)
rmh.msg_namelen = sizeof (from);
if ((len = recvmsg(s, &rmh, 0)) < 0) {
- dprintf(LOG_WARNING, FNAME, "recvmsg: %s", strerror(errno));
+ debug_printf(LOG_WARNING, FNAME, "recvmsg: %s", strerror(errno));
return;
}
- dprintf(LOG_DEBUG, FNAME, "from %s, size %d",
+ debug_printf(LOG_DEBUG, FNAME, "from %s, size %d",
addr2str((struct sockaddr *)&from), len);
if (((struct sockaddr *)&from)->sa_family != AF_INET6) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"non-IPv6 packet is received (AF %d) ",
((struct sockaddr *)&from)->sa_family);
return;
@@ -632,7 +632,7 @@ relay6_recv(s, fromclient)
}
}
if (pi == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to get the arrival interface");
return;
}
@@ -649,7 +649,7 @@ relay6_recv(s, fromclient)
if (ifd == NULL && pi->ipi6_ifindex != relayifid)
return;
if (if_indextoname(pi->ipi6_ifindex, ifname) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"if_indextoname(id = %d): %s",
pi->ipi6_ifindex, strerror(errno));
return;
@@ -657,12 +657,12 @@ relay6_recv(s, fromclient)
/* packet validation */
if (len < sizeof (*dh6)) {
- dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
return;
}
dh6 = (struct dhcp6 *)rdatabuf;
- dprintf(LOG_DEBUG, FNAME, "received %s from %s",
+ debug_printf(LOG_DEBUG, FNAME, "received %s from %s",
dhcp6msgstr(dh6->dh6_msgtype), addr2str((struct sockaddr *)&from));
/*
@@ -694,7 +694,7 @@ relay6_recv(s, fromclient)
(struct sockaddr *)&from);
break;
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unexpected message (%s) on the client side "
"from %s", dhcp6msgstr(dh6->dh6_msgtype),
addr2str((struct sockaddr *)&from));
@@ -702,7 +702,7 @@ relay6_recv(s, fromclient)
}
} else {
if (dh6->dh6_msgtype != DH6_RELAY_REPLY) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unexpected message (%s) on the server side"
"from %s", dhcp6msgstr(dh6->dh6_msgtype),
addr2str((struct sockaddr *)&from));
@@ -787,7 +787,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
/* Relay message */
if ((optinfo.relaymsg_msg = malloc(len)) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to allocate memory to copy the original packet: "
"%s", strerror(errno));
goto out;
@@ -797,7 +797,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
/* Interface-id. We always use this option. */
if ((optinfo.ifidopt_id = malloc(sizeof (ifid))) == NULL) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to allocate memory for IFID: %s", strerror(errno));
goto out;
}
@@ -823,7 +823,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
break;
}
if (p == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to find a global address on %s", ifname);
/*
@@ -848,7 +848,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
* [RFC3315 Section 20.1.2]
*/
if (dh6relay0->dh6relay_hcnt >= DHCP6_RELAY_HOP_COUNT_LIMIT) {
- dprintf(LOG_INFO, FNAME, "too many relay forwardings");
+ debug_printf(LOG_INFO, FNAME, "too many relay forwardings");
goto out;
}
@@ -871,7 +871,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
(struct dhcp6opt *)(dh6relay + 1),
(struct dhcp6opt *)(relaybuf + sizeof (relaybuf)),
&optinfo)) < 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to construct relay options");
goto out;
}
@@ -892,22 +892,22 @@ relay_to_server(dh6, len, from, ifname, ifid)
pktinfo.ipi6_ifindex = relayifid;
if (make_msgcontrol(&mh, ctlbuf, sizeof (ctlbuf),
&pktinfo, mhops)) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to make message control data");
goto out;
}
}
if ((cc = sendmsg(ssock, &mh, 0)) < 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"sendmsg %s failed: %s",
addr2str((struct sockaddr *)&sa6_server), strerror(errno));
} else if (cc != relaylen) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to send a complete packet to %s",
addr2str((struct sockaddr *)&sa6_server));
} else {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"relay a message to a server %s",
addr2str((struct sockaddr *)&sa6_server));
}
@@ -934,7 +934,7 @@ relay_to_client(dh6relay, len, from)
static struct iovec iov[2];
char ctlbuf[CMSG_SPACE(sizeof (struct in6_pktinfo))];
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"dhcp6 relay reply: hop=%d, linkaddr=%s, peeraddr=%s",
dh6relay->dh6relay_hcnt,
in6addr2str(&dh6relay->dh6relay_linkaddr, 0),
@@ -946,20 +946,20 @@ relay_to_client(dh6relay, len, from)
dhcp6_init_options(&optinfo);
if (dhcp6_get_options((struct dhcp6opt *)(dh6relay + 1),
(struct dhcp6opt *)((char *)dh6relay + len), &optinfo) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to parse options");
+ debug_printf(LOG_INFO, FNAME, "failed to parse options");
return;
}
/* A relay reply message must include a relay message option */
if (optinfo.relaymsg_msg == NULL) {
- dprintf(LOG_INFO, FNAME, "relay reply message from %s "
+ debug_printf(LOG_INFO, FNAME, "relay reply message from %s "
"without a relay message", addr2str(from));
goto out;
}
/* minimum validation for the inner message */
if (optinfo.relaymsg_len < sizeof (struct dhcp6)) {
- dprintf(LOG_INFO, FNAME, "short relay message from %s",
+ debug_printf(LOG_INFO, FNAME, "short relay message from %s",
addr2str(from));
goto out;
}
@@ -971,7 +971,7 @@ relay_to_client(dh6relay, len, from)
ifid = 0;
if (optinfo.ifidopt_id) {
if (optinfo.ifidopt_len != sizeof (ifid)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unexpected length (%d) for Interface ID from %s",
optinfo.ifidopt_len, addr2str(from));
goto out;
@@ -981,13 +981,13 @@ relay_to_client(dh6relay, len, from)
/* validation for ID */
if ((if_indextoname(ifid, ifnamebuf)) == NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"invalid interface ID: %x", ifid);
goto out;
}
}
} else {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"Interface ID is not included from %s", addr2str(from));
/*
* the responding server should be buggy, but we deal with it.
@@ -1005,7 +1005,7 @@ relay_to_client(dh6relay, len, from)
}
if (ifid == 0) {
- dprintf(LOG_INFO, FNAME, "failed to determine relay link");
+ debug_printf(LOG_INFO, FNAME, "failed to determine relay link");
goto out;
}
@@ -1036,22 +1036,22 @@ relay_to_client(dh6relay, len, from)
memset(&pktinfo, 0, sizeof (pktinfo));
pktinfo.ipi6_ifindex = ifid;
if (make_msgcontrol(&mh, ctlbuf, sizeof (ctlbuf), &pktinfo, 0)) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to make message control data");
goto out;
}
/* send packet */
if ((cc = sendmsg(csock, &mh, 0)) < 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"sendmsg to %s failed: %s",
addr2str((struct sockaddr *)&peer), strerror(errno));
} else if (cc != optinfo.relaymsg_len) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to send a complete packet to %s",
addr2str((struct sockaddr *)&peer));
} else {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"relay a message to a client %s",
addr2str((struct sockaddr *)&peer));
}
diff --git a/dhcp6relay_script.c b/dhcp6relay_script.c
index 82f5eab..7444b54 100644
--- a/dhcp6relay_script.c
+++ b/dhcp6relay_script.c
@@ -87,7 +87,7 @@ relay6_script(scriptpath, client, dh6, len)
/* only replies are interesting */
if (dh6->dh6_msgtype != DH6_REPLY) {
if (dh6->dh6_msgtype != DH6_ADVERTISE) {
- dprintf(LOG_INFO, FNAME, "forward msg#%d to client?",
+ debug_printf(LOG_INFO, FNAME, "forward msg#%d to client?",
dh6->dh6_msgtype);
return -1;
}
@@ -99,7 +99,7 @@ relay6_script(scriptpath, client, dh6, len)
dhcp6_init_options(&optinfo);
if (dhcp6_get_options((struct dhcp6opt *)(dh6 + 1), optend,
&optinfo) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to parse options");
+ debug_printf(LOG_INFO, FNAME, "failed to parse options");
return -1;
}
@@ -118,7 +118,7 @@ relay6_script(scriptpath, client, dh6, len)
/* allocate an environments array */
if ((envp = malloc(sizeof (char *) * envc)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate environment buffer");
dhcp6_clear_options(&optinfo);
return -1;
@@ -132,14 +132,14 @@ relay6_script(scriptpath, client, dh6, len)
/* address */
t = addr2str((struct sockaddr *) client);
if (t == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to get address of client");
ret = -1;
goto clean;
}
elen = sizeof (client_str) + 1 + strlen(t) + 1;
if ((s = envp[i++] = malloc(elen)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate string for client");
ret = -1;
goto clean;
@@ -167,7 +167,7 @@ relay6_script(scriptpath, client, dh6, len)
/* launch the script */
pid = fork();
if (pid < 0) {
- dprintf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
ret = -1;
goto clean;
} else if (pid) {
@@ -178,9 +178,9 @@ relay6_script(scriptpath, client, dh6, len)
} while (wpid != pid && wpid > 0);
if (wpid < 0)
- dprintf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
else {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"script \"%s\" terminated", scriptpath);
}
} else {
@@ -191,7 +191,7 @@ relay6_script(scriptpath, client, dh6, len)
argv[1] = NULL;
if (safefile(scriptpath)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"script \"%s\" cannot be executed safely",
scriptpath);
exit(1);
@@ -208,7 +208,7 @@ relay6_script(scriptpath, client, dh6, len)
execve(scriptpath, argv, envp);
- dprintf(LOG_ERR, FNAME, "child: exec failed: %s",
+ debug_printf(LOG_ERR, FNAME, "child: exec failed: %s",
strerror(errno));
exit(0);
}
@@ -254,12 +254,12 @@ iapd2str(num, iav)
break;
default:
- dprintf(LOG_ERR, FNAME, "impossible subopt");
+ debug_printf(LOG_ERR, FNAME, "impossible subopt");
}
}
if ((r = strdup(s)) == NULL)
- dprintf(LOG_ERR, FNAME, "failed to allocate iapd_%d", num);
+ debug_printf(LOG_ERR, FNAME, "failed to allocate iapd_%d", num);
return r;
}
@@ -294,11 +294,11 @@ iana2str(num, iav)
break;
default:
- dprintf(LOG_ERR, FNAME, "impossible subopt");
+ debug_printf(LOG_ERR, FNAME, "impossible subopt");
}
}
if ((r = strdup(s)) == NULL)
- dprintf(LOG_ERR, FNAME, "failed to allocate iana_%d", num);
+ debug_printf(LOG_ERR, FNAME, "failed to allocate iana_%d", num);
return r;
}
diff --git a/dhcp6s.c b/dhcp6s.c
index 494e571..ff8b17d 100644
--- a/dhcp6s.c
+++ b/dhcp6s.c
@@ -311,7 +311,7 @@ main(argc, argv)
exit(1);
if ((cfparse(conffile)) != 0) {
- dprintf(LOG_ERR, FNAME, "failed to parse configuration file");
+ debug_printf(LOG_ERR, FNAME, "failed to parse configuration file");
exit(1);
}
@@ -335,7 +335,7 @@ main(argc, argv)
/* prohibit a mixture of old and new style of DNS server config */
if (!TAILQ_EMPTY(&arg_dnslist)) {
if (!TAILQ_EMPTY(&dnslist)) {
- dprintf(LOG_INFO, FNAME, "do not specify DNS servers "
+ debug_printf(LOG_INFO, FNAME, "do not specify DNS servers "
"both by command line and by configuration file.");
exit(1);
}
@@ -374,24 +374,24 @@ server6_init()
TAILQ_INIT(&dhcp6_binding_head);
if (lease_init() != 0) {
- dprintf(LOG_ERR, FNAME, "failed to initialize the lease table");
+ debug_printf(LOG_ERR, FNAME, "failed to initialize the lease table");
exit(1);
}
ifidx = if_nametoindex(device);
if (ifidx == 0) {
- dprintf(LOG_ERR, FNAME, "invalid interface %s", device);
+ debug_printf(LOG_ERR, FNAME, "invalid interface %s", device);
exit(1);
}
/* get our DUID */
if (get_duid(DUID_FILE, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to get a DUID");
+ debug_printf(LOG_ERR, FNAME, "failed to get a DUID");
exit(1);
}
if (dhcp6_ctl_authinit(ctlkeyfile, &ctlkey, &ctldigestlen) != 0) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to initialize control message authentication");
/* run the server anyway */
}
@@ -403,7 +403,7 @@ server6_init()
rmh.msg_iovlen = 1;
rmsgctllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
if ((rmsgctlbuf = (char *)malloc(rmsgctllen)) == NULL) {
- dprintf(LOG_ERR, FNAME, "memory allocation failed");
+ debug_printf(LOG_ERR, FNAME, "memory allocation failed");
exit(1);
}
@@ -415,32 +415,32 @@ server6_init()
hints.ai_flags = AI_PASSIVE;
error = getaddrinfo(NULL, DH6PORT_UPSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
insock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (insock < 0) {
- dprintf(LOG_ERR, FNAME, "socket(insock): %s",
+ debug_printf(LOG_ERR, FNAME, "socket(insock): %s",
strerror(errno));
exit(1);
}
if (setsockopt(insock, SOL_SOCKET, SO_REUSEPORT, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEPORT): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEPORT): %s",
strerror(errno));
exit(1);
}
if (setsockopt(insock, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEADDR): %s",
+ debug_printf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEADDR): %s",
strerror(errno));
exit(1);
}
#ifdef IPV6_RECVPKTINFO
if (setsockopt(insock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(inbound, IPV6_RECVPKTINFO): %s",
strerror(errno));
exit(1);
@@ -448,7 +448,7 @@ server6_init()
#else
if (setsockopt(insock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(inbound, IPV6_PKTINFO): %s",
strerror(errno));
exit(1);
@@ -457,13 +457,13 @@ server6_init()
#ifdef IPV6_V6ONLY
if (setsockopt(insock, IPPROTO_IPV6, IPV6_V6ONLY,
&on, sizeof(on)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(inbound, IPV6_V6ONLY): %s", strerror(errno));
exit(1);
}
#endif
if (bind(insock, res->ai_addr, res->ai_addrlen) < 0) {
- dprintf(LOG_ERR, FNAME, "bind(insock): %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "bind(insock): %s", strerror(errno));
exit(1);
}
freeaddrinfo(res);
@@ -471,7 +471,7 @@ server6_init()
hints.ai_flags = 0;
error = getaddrinfo(DH6ADDR_ALLAGENT, DH6PORT_UPSTREAM, &hints, &res2);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
@@ -482,7 +482,7 @@ server6_init()
sizeof(mreq6.ipv6mr_multiaddr));
if (setsockopt(insock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
&mreq6, sizeof(mreq6))) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(insock, IPV6_JOIN_GROUP): %s",
strerror(errno));
exit(1);
@@ -493,7 +493,7 @@ server6_init()
error = getaddrinfo(DH6ADDR_ALLSERVER, DH6PORT_UPSTREAM,
&hints, &res2);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
@@ -504,7 +504,7 @@ server6_init()
sizeof(mreq6.ipv6mr_multiaddr));
if (setsockopt(insock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
&mreq6, sizeof(mreq6))) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(insock, IPV6_JOIN_GROUP): %s",
strerror(errno));
exit(1);
@@ -514,20 +514,20 @@ server6_init()
hints.ai_flags = 0;
error = getaddrinfo(NULL, DH6PORT_DOWNSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
outsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (outsock < 0) {
- dprintf(LOG_ERR, FNAME, "socket(outsock): %s",
+ debug_printf(LOG_ERR, FNAME, "socket(outsock): %s",
strerror(errno));
exit(1);
}
/* set outgoing interface of multicast packets for DHCP reconfig */
if (setsockopt(outsock, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&ifidx, sizeof(ifidx)) < 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"setsockopt(outsock, IPV6_MULTICAST_IF): %s",
strerror(errno));
exit(1);
@@ -535,7 +535,7 @@ server6_init()
#if !defined(__linux__) && !defined(__sun__)
/* make the socket write-only */
if (shutdown(outsock, 0)) {
- dprintf(LOG_ERR, FNAME, "shutdown(outbound, 0): %s",
+ debug_printf(LOG_ERR, FNAME, "shutdown(outbound, 0): %s",
strerror(errno));
exit(1);
}
@@ -548,7 +548,7 @@ server6_init()
hints.ai_protocol = IPPROTO_UDP;
error = getaddrinfo("::", DH6PORT_DOWNSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
@@ -563,7 +563,7 @@ server6_init()
hints.ai_protocol = IPPROTO_UDP;
error = getaddrinfo("::", DH6PORT_UPSTREAM, &hints, &res);
if (error) {
- dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
gai_strerror(error));
exit(1);
}
@@ -574,16 +574,16 @@ server6_init()
/* set up control socket */
if (ctlkey == NULL)
- dprintf(LOG_NOTICE, FNAME, "skip opening control port");
+ debug_printf(LOG_NOTICE, FNAME, "skip opening control port");
else if (dhcp6_ctl_init(ctladdr, ctlport,
DHCP6CTL_DEF_COMMANDQUEUELEN, &ctlsock)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to initialize control channel");
exit(1);
}
if (signal(SIGTERM, server6_signal) == SIG_ERR) {
- dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
strerror(errno));
exit(1);
}
@@ -627,7 +627,7 @@ server6_mainloop()
switch (ret) {
case -1:
if (errno != EINTR) {
- dprintf(LOG_ERR, FNAME, "select: %s",
+ debug_printf(LOG_ERR, FNAME, "select: %s",
strerror(errno));
exit(1);
}
@@ -714,31 +714,31 @@ server6_do_ctlcommand(buf, len)
commandlen = (int)(ntohs(ctlhead->len));
version = ntohs(ctlhead->version);
if (len != sizeof(struct dhcp6ctl) + commandlen) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"assumption failure: command length mismatch");
return (DHCP6CTL_R_FAILURE);
}
/* replay protection and message authentication */
if ((now = time(NULL)) < 0) {
- dprintf(LOG_ERR, FNAME, "failed to get current time: %s",
+ debug_printf(LOG_ERR, FNAME, "failed to get current time: %s",
strerror(errno));
return (DHCP6CTL_R_FAILURE);
}
ts0 = (u_int32_t)now;
ts = ntohl(ctlhead->timestamp);
if (ts + CTLSKEW < ts0 || (ts - CTLSKEW) > ts0) {
- dprintf(LOG_INFO, FNAME, "timestamp is out of range");
+ debug_printf(LOG_INFO, FNAME, "timestamp is out of range");
return (DHCP6CTL_R_FAILURE);
}
if (ctlkey == NULL) { /* should not happen!! */
- dprintf(LOG_ERR, FNAME, "no secret key for control channel");
+ debug_printf(LOG_ERR, FNAME, "no secret key for control channel");
return (DHCP6CTL_R_FAILURE);
}
if (dhcp6_verify_mac(buf, len, DHCP6CTL_AUTHPROTO_UNDEF,
DHCP6CTL_AUTHALG_HMACMD5, sizeof(*ctlhead), ctlkey) != 0) {
- dprintf(LOG_INFO, FNAME, "authentication failure");
+ debug_printf(LOG_INFO, FNAME, "authentication failure");
return (DHCP6CTL_R_FAILURE);
}
@@ -746,14 +746,14 @@ server6_do_ctlcommand(buf, len)
commandlen -= ctldigestlen;
if (version > DHCP6CTL_VERSION) {
- dprintf(LOG_INFO, FNAME, "unsupported version: %d", version);
+ debug_printf(LOG_INFO, FNAME, "unsupported version: %d", version);
return (DHCP6CTL_R_FAILURE);
}
switch (command) {
case DHCP6CTL_COMMAND_RELOAD:
if (commandlen != 0) {
- dprintf(LOG_INFO, FNAME, "invalid command length "
+ debug_printf(LOG_INFO, FNAME, "invalid command length "
"for reload: %d", commandlen);
return (DHCP6CTL_R_DONE);
}
@@ -761,7 +761,7 @@ server6_do_ctlcommand(buf, len)
break;
case DHCP6CTL_COMMAND_STOP:
if (commandlen != 0) {
- dprintf(LOG_INFO, FNAME, "invalid command length "
+ debug_printf(LOG_INFO, FNAME, "invalid command length "
"for stop: %d", commandlen);
return (DHCP6CTL_R_DONE);
}
@@ -771,7 +771,7 @@ server6_do_ctlcommand(buf, len)
if (get_val32(&bp, &commandlen, &p32))
return (DHCP6CTL_R_FAILURE);
if (p32 != DHCP6CTL_BINDING) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown remove target: %ul", p32);
return (DHCP6CTL_R_FAILURE);
}
@@ -779,7 +779,7 @@ server6_do_ctlcommand(buf, len)
if (get_val32(&bp, &commandlen, &p32))
return (DHCP6CTL_R_FAILURE);
if (p32 != DHCP6CTL_BINDING_IA) {
- dprintf(LOG_INFO, FNAME, "unknown binding type: %ul",
+ debug_printf(LOG_INFO, FNAME, "unknown binding type: %ul",
p32);
return (DHCP6CTL_R_FAILURE);
}
@@ -788,7 +788,7 @@ server6_do_ctlcommand(buf, len)
return (DHCP6CTL_R_FAILURE);
if (ntohl(iaspec.type) != DHCP6CTL_IA_PD &&
ntohl(iaspec.type) != DHCP6CTL_IA_NA) {
- dprintf(LOG_INFO, FNAME, "unknown IA type: %ul",
+ debug_printf(LOG_INFO, FNAME, "unknown IA type: %ul",
ntohl(iaspec.type));
return (DHCP6CTL_R_FAILURE);
}
@@ -796,7 +796,7 @@ server6_do_ctlcommand(buf, len)
duidlen = ntohl(iaspec.duidlen);
if (duidlen > commandlen) {
- dprintf(LOG_INFO, FNAME, "DUID length mismatch");
+ debug_printf(LOG_INFO, FNAME, "DUID length mismatch");
return (DHCP6CTL_R_FAILURE);
}
@@ -809,7 +809,7 @@ server6_do_ctlcommand(buf, len)
binding = find_binding(&duid, DHCP6_BINDING_IA,
DHCP6_LISTVAL_IANA, iaid);
if (binding == NULL) {
- dprintf(LOG_INFO, FNAME, "no such binding");
+ debug_printf(LOG_INFO, FNAME, "no such binding");
return (DHCP6CTL_R_FAILURE);
}
}
@@ -817,7 +817,7 @@ server6_do_ctlcommand(buf, len)
break;
default:
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown control command: %d (len=%d)",
(int)command, commandlen);
return (DHCP6CTL_R_FAILURE);
@@ -831,12 +831,12 @@ server6_reload()
{
/* reload the configuration file */
if (cfparse(conffile) != 0) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"failed to reload configuration file");
return;
}
- dprintf(LOG_NOTICE, FNAME, "server reloaded");
+ debug_printf(LOG_NOTICE, FNAME, "server reloaded");
return;
}
@@ -846,7 +846,7 @@ server6_stop()
{
/* Right now, we simply stop running */
- dprintf(LOG_NOTICE, FNAME, "exiting");
+ debug_printf(LOG_NOTICE, FNAME, "exiting");
exit (0);
}
@@ -885,7 +885,7 @@ server6_recv(s)
mhdr.msg_controllen = sizeof(cmsgbuf);
if ((len = recvmsg(insock, &mhdr, 0)) < 0) {
- dprintf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
+ debug_printf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
return;
}
fromlen = mhdr.msg_namelen;
@@ -899,7 +899,7 @@ server6_recv(s)
}
}
if (pi == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to get packet info");
+ debug_printf(LOG_NOTICE, FNAME, "failed to get packet info");
return;
}
/*
@@ -910,7 +910,7 @@ server6_recv(s)
if (pi->ipi6_ifindex != ifidx)
return;
if ((ifp = find_ifconfbyid((unsigned int)pi->ipi6_ifindex)) == NULL) {
- dprintf(LOG_INFO, FNAME, "unexpected interface (%d)",
+ debug_printf(LOG_INFO, FNAME, "unexpected interface (%d)",
(unsigned int)pi->ipi6_ifindex);
return;
}
@@ -918,11 +918,11 @@ server6_recv(s)
dh6 = (struct dhcp6 *)rdatabuf;
if (len < sizeof(*dh6)) {
- dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
return;
}
- dprintf(LOG_DEBUG, FNAME, "received %s from %s",
+ debug_printf(LOG_DEBUG, FNAME, "received %s from %s",
dhcp6msgstr(dh6->dh6_msgtype),
addr2str((struct sockaddr *)&from));
@@ -937,7 +937,7 @@ server6_recv(s)
dh6->dh6_msgtype == DH6_CONFIRM ||
dh6->dh6_msgtype == DH6_REBIND ||
dh6->dh6_msgtype == DH6_INFORM_REQ)) {
- dprintf(LOG_INFO, FNAME, "invalid unicast message");
+ debug_printf(LOG_INFO, FNAME, "invalid unicast message");
return;
}
@@ -947,7 +947,7 @@ server6_recv(s)
* reject them here.
*/
if (dh6->dh6_msgtype == DH6_RELAY_REPLY) {
- dprintf(LOG_INFO, FNAME, "relay reply message from %s",
+ debug_printf(LOG_INFO, FNAME, "relay reply message from %s",
addr2str((struct sockaddr *)&from));
return;
@@ -969,7 +969,7 @@ server6_recv(s)
dhcp6_init_options(&optinfo);
if (dhcp6_get_options((struct dhcp6opt *)(dh6 + 1),
optend, &optinfo) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to parse options");
+ debug_printf(LOG_INFO, FNAME, "failed to parse options");
goto end;
}
@@ -1007,7 +1007,7 @@ server6_recv(s)
(struct sockaddr *)&from, fromlen, &relayinfohead);
break;
default:
- dprintf(LOG_INFO, FNAME, "unknown or unsupported msgtype (%s)",
+ debug_printf(LOG_INFO, FNAME, "unknown or unsupported msgtype (%s)",
dhcp6msgstr(dh6->dh6_msgtype));
break;
}
@@ -1052,11 +1052,11 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
again:
len = (void *)optend - (void *)dh6relay;
if (len < sizeof (*dh6relay)) {
- dprintf(LOG_INFO, FNAME, "short relay message from %s",
+ debug_printf(LOG_INFO, FNAME, "short relay message from %s",
addr2str(from));
return (-1);
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"dhcp6 relay: hop=%d, linkaddr=%s, peeraddr=%s",
dh6relay->dh6relay_hcnt,
in6addr2str(&dh6relay->dh6relay_linkaddr, 0),
@@ -1068,13 +1068,13 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
dhcp6_init_options(&optinfo);
if (dhcp6_get_options((struct dhcp6opt *)(dh6relay + 1),
optend, &optinfo) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to parse options");
+ debug_printf(LOG_INFO, FNAME, "failed to parse options");
return (-1);
}
/* A relay forward message must include a relay message option */
if (optinfo.relaymsg_msg == NULL) {
- dprintf(LOG_INFO, FNAME, "relay forward from %s "
+ debug_printf(LOG_INFO, FNAME, "relay forward from %s "
"without a relay message", addr2str(from));
return (-1);
}
@@ -1082,13 +1082,13 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
/* relay message must contain a DHCPv6 message. */
len = optinfo.relaymsg_len;
if (len < sizeof (struct dhcp6)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"short packet (%d bytes) in relay message", len);
return (-1);
}
if ((relayinfo = malloc(sizeof (*relayinfo))) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to allocate relay info");
+ debug_printf(LOG_ERR, FNAME, "failed to allocate relay info");
return (-1);
}
memset(relayinfo, 0, sizeof (*relayinfo));
@@ -1139,71 +1139,71 @@ set_statelessinfo(type, optinfo)
{
/* SIP domain name */
if (dhcp6_copy_list(&optinfo->sipname_list, &sipnamelist)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to copy SIP domain list");
return (-1);
}
/* SIP server */
if (dhcp6_copy_list(&optinfo->sip_list, &siplist)) {
- dprintf(LOG_ERR, FNAME, "failed to copy SIP servers");
+ debug_printf(LOG_ERR, FNAME, "failed to copy SIP servers");
return (-1);
}
/* DNS server */
if (dhcp6_copy_list(&optinfo->dns_list, &dnslist)) {
- dprintf(LOG_ERR, FNAME, "failed to copy DNS servers");
+ debug_printf(LOG_ERR, FNAME, "failed to copy DNS servers");
return (-1);
}
/* DNS search list */
if (dhcp6_copy_list(&optinfo->dnsname_list, &dnsnamelist)) {
- dprintf(LOG_ERR, FNAME, "failed to copy DNS search list");
+ debug_printf(LOG_ERR, FNAME, "failed to copy DNS search list");
return (-1);
}
/* NTP server */
if (dhcp6_copy_list(&optinfo->ntp_list, &ntplist)) {
- dprintf(LOG_ERR, FNAME, "failed to copy NTP servers");
+ debug_printf(LOG_ERR, FNAME, "failed to copy NTP servers");
return (-1);
}
/* NIS domain name */
if (dhcp6_copy_list(&optinfo->nisname_list, &nisnamelist)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(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");
+ debug_printf(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,
+ debug_printf(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");
+ debug_printf(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,
+ debug_printf(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");
+ debug_printf(LOG_ERR, FNAME, "failed to copy BCMCS servers");
return (-1);
}
@@ -1239,10 +1239,10 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
* [RFC3315 Section 15.2]
*/
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
} else {
- dprintf(LOG_DEBUG, FNAME, "client ID %s",
+ debug_printf(LOG_DEBUG, FNAME, "client ID %s",
duidstr(&optinfo->clientID));
}
@@ -1252,13 +1252,13 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
* [RFC3315 Section 15.2]
*/
if (optinfo->serverID.duid_len) {
- dprintf(LOG_INFO, FNAME, "server ID option found");
+ debug_printf(LOG_INFO, FNAME, "server ID option found");
return (-1);
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME, "found a host configuration for %s",
+ debug_printf(LOG_DEBUG, FNAME, "found a host configuration for %s",
client_conf->name);
}
@@ -1269,7 +1269,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -1277,13 +1277,13 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
@@ -1293,7 +1293,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* add other configuration information */
if (set_statelessinfo(DH6_SOLICIT, &roptinfo)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to set other stateless information");
goto fail;
}
@@ -1320,7 +1320,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* make a local copy of the configured prefixes */
if (client_conf &&
dhcp6_copy_list(&conflist, &client_conf->prefix_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make local data");
goto fail;
}
@@ -1366,7 +1366,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
if (client_conf == NULL && ifp->pool.name) {
if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
&ifp->pool)) == NULL)
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make host configuration");
}
TAILQ_INIT(&conflist);
@@ -1374,7 +1374,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* make a local copy of the configured addresses */
if (client_conf &&
dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make local data");
goto fail;
}
@@ -1444,17 +1444,17 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message must include a Server Identifier option */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
}
/* the contents of the Server Identifier option must match ours */
if (duidcmp(&optinfo->serverID, &server_duid)) {
- dprintf(LOG_INFO, FNAME, "server ID mismatch");
+ debug_printf(LOG_INFO, FNAME, "server ID mismatch");
return (-1);
}
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
@@ -1465,24 +1465,24 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -1504,11 +1504,11 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
TAILQ_EMPTY(relayinfohead)) {
u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
- dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
addr2str(from));
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a status code");
+ debug_printf(LOG_ERR, FNAME, "failed to add a status code");
goto fail;
}
server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
@@ -1538,7 +1538,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* make a local copy of the configured prefixes */
if (client_conf &&
dhcp6_copy_list(&conflist, &client_conf->prefix_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make local data");
goto fail;
}
@@ -1563,7 +1563,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
iapd->val_ia.iaid,
DH6OPT_STCODE_NOPREFIXAVAIL,
&roptinfo.iapd_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make an option list");
dhcp6_clear_list(&conflist);
goto fail;
@@ -1581,7 +1581,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
if (client_conf == NULL && ifp->pool.name) {
if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
&ifp->pool)) == NULL)
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make host configuration");
}
TAILQ_INIT(&conflist);
@@ -1589,7 +1589,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* make a local copy of the configured prefixes */
if (client_conf &&
dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make local data");
goto fail;
}
@@ -1607,7 +1607,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
iana->val_ia.iaid,
DH6OPT_STCODE_NOADDRSAVAIL,
&roptinfo.iana_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make an option list");
dhcp6_clear_list(&conflist);
goto fail;
@@ -1640,7 +1640,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
* information to be assigned to the client.
*/
if (set_statelessinfo(DH6_REQUEST, &roptinfo)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to set other stateless information");
goto fail;
}
@@ -1677,17 +1677,17 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message must include a Server Identifier option */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
}
/* the contents of the Server Identifier option must match ours */
if (duidcmp(&optinfo->serverID, &server_duid)) {
- dprintf(LOG_INFO, FNAME, "server ID mismatch");
+ debug_printf(LOG_INFO, FNAME, "server ID mismatch");
return (-1);
}
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
@@ -1698,24 +1698,24 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -1735,11 +1735,11 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
TAILQ_EMPTY(relayinfohead)) {
u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
- dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
addr2str(from));
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a status code");
+ debug_printf(LOG_ERR, FNAME, "failed to add a status code");
goto fail;
}
server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
@@ -1764,7 +1764,7 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* add other configuration information */
if (set_statelessinfo(DH6_RENEW, &roptinfo)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to set other stateless information");
goto fail;
}
@@ -1799,13 +1799,13 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
/* the message must not include a server Identifier option */
if (optinfo->serverID.duid_len) {
- dprintf(LOG_INFO, FNAME, "server ID option is included in "
+ debug_printf(LOG_INFO, FNAME, "server ID option is included in "
"a rebind message");
return (-1);
}
@@ -1817,24 +1817,24 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -1866,13 +1866,13 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
*/
if (TAILQ_EMPTY(&roptinfo.iapd_list) &&
TAILQ_EMPTY(&roptinfo.iana_list)) {
- dprintf(LOG_INFO, FNAME, "no useful information for a rebind");
+ debug_printf(LOG_INFO, FNAME, "no useful information for a rebind");
goto fail; /* discard the rebind */
}
/* add other configuration information */
if (set_statelessinfo(DH6_REBIND, &roptinfo)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to set other stateless information");
goto fail;
}
@@ -1908,17 +1908,17 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message must include a Server Identifier option */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
}
/* the contents of the Server Identifier option must match ours */
if (duidcmp(&optinfo->serverID, &server_duid)) {
- dprintf(LOG_INFO, FNAME, "server ID mismatch");
+ debug_printf(LOG_INFO, FNAME, "server ID mismatch");
return (-1);
}
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
@@ -1929,24 +1929,24 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -1966,11 +1966,11 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
TAILQ_EMPTY(relayinfohead)) {
u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
- dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
addr2str(from));
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a status code");
+ debug_printf(LOG_ERR, FNAME, "failed to add a status code");
goto fail;
}
server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
@@ -2001,7 +2001,7 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
stcode = DH6OPT_STCODE_SUCCESS;
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to add a status code");
+ debug_printf(LOG_NOTICE, FNAME, "failed to add a status code");
goto fail;
}
@@ -2037,17 +2037,17 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message must include a Server Identifier option */
if (optinfo->serverID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no server ID option");
+ debug_printf(LOG_INFO, FNAME, "no server ID option");
return (-1);
}
/* the contents of the Server Identifier option must match ours */
if (duidcmp(&optinfo->serverID, &server_duid)) {
- dprintf(LOG_INFO, FNAME, "server ID mismatch");
+ debug_printf(LOG_INFO, FNAME, "server ID mismatch");
return (-1);
}
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
@@ -2058,24 +2058,24 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -2095,11 +2095,11 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
TAILQ_EMPTY(relayinfohead)) {
stcode = DH6OPT_STCODE_USEMULTICAST;
- dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
addr2str(from));
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to add a status code");
+ debug_printf(LOG_ERR, FNAME, "failed to add a status code");
goto fail;
}
server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
@@ -2126,7 +2126,7 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
stcode = DH6OPT_STCODE_SUCCESS;
if (dhcp6_add_listval(&roptinfo.stcode_list,
DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to add a status code");
+ debug_printf(LOG_NOTICE, FNAME, "failed to add a status code");
goto fail;
}
@@ -2164,12 +2164,12 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* the message may not include a Server Identifier option */
if (optinfo->serverID.duid_len) {
- dprintf(LOG_INFO, FNAME, "server ID option found");
+ debug_printf(LOG_INFO, FNAME, "server ID option found");
return (-1);
}
/* the message must include a Client Identifier option */
if (optinfo->clientID.duid_len == 0) {
- dprintf(LOG_INFO, FNAME, "no client ID option");
+ debug_printf(LOG_INFO, FNAME, "no client ID option");
return (-1);
}
@@ -2177,24 +2177,24 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back */
if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
/* process authentication */
if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
- dprintf(LOG_INFO, FNAME, "failed to process authentication "
+ debug_printf(LOG_INFO, FNAME, "failed to process authentication "
"information for %s",
clientstr(client_conf, &optinfo->clientID));
goto fail;
@@ -2203,7 +2203,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
if (client_conf == NULL && ifp->pool.name) {
if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
&ifp->pool)) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make host configuration");
goto fail;
}
@@ -2211,7 +2211,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
TAILQ_INIT(&conflist);
/* make a local copy of the configured addresses */
if (dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make local data");
goto fail;
}
@@ -2221,13 +2221,13 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
* [RFC3315 18.2]. (IA-PD is just ignored [RFC3633 12.1])
*/
if (TAILQ_EMPTY(&optinfo->iana_list)) {
- dprintf(LOG_INFO, FNAME, "no IA-NA option found");
+ debug_printf(LOG_INFO, FNAME, "no IA-NA option found");
goto fail;
}
for (iana = TAILQ_FIRST(&optinfo->iana_list); iana;
iana = TAILQ_NEXT(iana, link)) {
if (TAILQ_EMPTY(&iana->sublist)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"no IA-ADDR option found in IA-NA %d",
iana->val_ia.iaid);
goto fail;
@@ -2250,7 +2250,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
struct relayinfo *relayinfo;
if (relayinfohead == NULL) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"no link-addr found");
goto fail;
}
@@ -2264,7 +2264,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
}
if (memcmp(linkaddr, confaddr, 8) != 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"%s does not seem to belong to %s's link",
in6addr2str(confaddr, 0),
in6addr2str(linkaddr, 0));
@@ -2283,7 +2283,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
iana = TAILQ_NEXT(iana, link)) {
if (make_ia(iana, &conflist, &roptinfo.iana_list,
client_conf, 1) == 0) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"IA-NA configuration not found");
goto fail;
}
@@ -2326,12 +2326,12 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
* [RFC3315 Section 15]
*/
if (!TAILQ_EMPTY(&optinfo->iapd_list)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"information request contains an IA_PD option");
return (-1);
}
if (!TAILQ_EMPTY(&optinfo->iana_list)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"information request contains an IA_NA option");
return (-1);
}
@@ -2339,7 +2339,7 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* if a server identifier is included, it must match ours. */
if (optinfo->serverID.duid_len &&
duidcmp(&optinfo->serverID, &server_duid)) {
- dprintf(LOG_INFO, FNAME, "server DUID mismatch");
+ debug_printf(LOG_INFO, FNAME, "server DUID mismatch");
return (-1);
}
@@ -2350,20 +2350,20 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
/* server identifier option */
if (duidcpy(&roptinfo.serverID, &server_duid)) {
- dprintf(LOG_ERR, FNAME, "failed to copy server ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
goto fail;
}
/* copy client information back (if provided) */
if (optinfo->clientID.duid_id &&
duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
- dprintf(LOG_ERR, FNAME, "failed to copy client ID");
+ debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
goto fail;
}
/* set stateless information */
if (set_statelessinfo(DH6_INFORM_REQ, &roptinfo)) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"failed to set other stateless information");
goto fail;
}
@@ -2391,7 +2391,7 @@ update_ia(msgtype, iap, retlist, optinfo)
/* get per-host configuration for the client, if any. */
if ((client_conf = find_hostconf(&optinfo->clientID))) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"found a host configuration named %s", client_conf->name);
}
@@ -2404,7 +2404,7 @@ update_ia(msgtype, iap, retlist, optinfo)
* Sections 18.2.3 and 18.2.4 of RFC3315, and the two sets
* of behavior are identical.
*/
- dprintf(LOG_INFO, FNAME, "no binding found for %s",
+ debug_printf(LOG_INFO, FNAME, "no binding found for %s",
duidstr(&optinfo->clientID));
switch (msgtype) {
@@ -2418,7 +2418,7 @@ update_ia(msgtype, iap, retlist, optinfo)
*/
if (make_ia_stcode(iap->type, iap->val_ia.iaid,
DH6OPT_STCODE_NOBINDING, retlist)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make an option list");
return (-1);
}
@@ -2440,7 +2440,7 @@ update_ia(msgtype, iap, retlist, optinfo)
*/
return (-1);
default: /* XXX: should be a bug */
- dprintf(LOG_ERR, FNAME, "impossible message type %s",
+ debug_printf(LOG_ERR, FNAME, "impossible message type %s",
dhcp6msgstr(msgtype));
return (-1);
}
@@ -2468,7 +2468,7 @@ update_ia(msgtype, iap, retlist, optinfo)
blv = dhcp6_find_listval(&binding->val_list,
DHCP6_LISTVAL_PREFIX6, &prefix, 0);
if (blv == NULL) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"%s/%d is not found in %s",
in6addr2str(&prefix.addr, 0),
prefix.plen, bindingstr(binding));
@@ -2484,7 +2484,7 @@ update_ia(msgtype, iap, retlist, optinfo)
if (dhcp6_add_listval(&ialist,
DHCP6_LISTVAL_PREFIX6, &prefix, NULL)
== NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to copy binding info");
dhcp6_clear_list(&ialist);
return (-1);
@@ -2498,7 +2498,7 @@ update_ia(msgtype, iap, retlist, optinfo)
blv = dhcp6_find_listval(&binding->val_list,
DHCP6_LISTVAL_STATEFULADDR6, &saddr, 0);
if (blv == NULL) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"%s is not found in %s",
in6addr2str(&saddr.addr, 0),
bindingstr(binding));
@@ -2514,14 +2514,14 @@ update_ia(msgtype, iap, retlist, optinfo)
if (dhcp6_add_listval(&ialist,
DHCP6_LISTVAL_STATEFULADDR6, &saddr, NULL)
== NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to copy binding info");
dhcp6_clear_list(&ialist);
return (-1);
}
break;
default:
- dprintf(LOG_ERR, FNAME, "unsupported IA type");
+ debug_printf(LOG_ERR, FNAME, "unsupported IA type");
return (-1); /* XXX */
}
}
@@ -2560,7 +2560,7 @@ release_binding_ia(iap, retlist, optinfo)
*/
if (make_ia_stcode(iap->type, iap->val_ia.iaid,
DH6OPT_STCODE_NOBINDING, retlist)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make an option list");
return (-1);
}
@@ -2582,7 +2582,7 @@ release_binding_ia(iap, retlist, optinfo)
if ((lvia = find_binding_ia(lv, binding)) != NULL) {
switch (binding->iatype) {
case DHCP6_LISTVAL_IAPD:
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"bound prefix %s/%d "
"has been released",
in6addr2str(&lvia->val_prefix6.addr,
@@ -2591,7 +2591,7 @@ release_binding_ia(iap, retlist, optinfo)
break;
case DHCP6_LISTVAL_IANA:
release_address(&lvia->val_prefix6.addr);
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"bound address %s "
"has been released",
in6addr2str(&lvia->val_prefix6.addr,
@@ -2635,7 +2635,7 @@ decline_binding_ia(iap, retlist, optinfo)
*/
if (make_ia_stcode(iap->type, iap->val_ia.iaid,
DH6OPT_STCODE_NOBINDING, retlist)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make an option list");
return (-1);
}
@@ -2657,13 +2657,13 @@ decline_binding_ia(iap, retlist, optinfo)
}
if ((lvia = find_binding_ia(lv, binding)) == NULL) {
- dprintf(LOG_DEBUG, FNAME, "no binding found "
+ debug_printf(LOG_DEBUG, FNAME, "no binding found "
"for address %s",
in6addr2str(&lv->val_statefuladdr6.addr, 0));
continue;
}
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"bound address %s has been marked as declined",
in6addr2str(&lvia->val_statefuladdr6.addr, 0));
decline_address(&lvia->val_statefuladdr6.addr);
@@ -2688,7 +2688,7 @@ server6_signal(sig)
int sig;
{
- dprintf(LOG_INFO, FNAME, "received a signal (%d)", sig);
+ debug_printf(LOG_INFO, FNAME, "received a signal (%d)", sig);
switch (sig) {
case SIGTERM:
@@ -2717,7 +2717,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
struct relayinfo *relayinfo;
if (sizeof(struct dhcp6) > sizeof(replybuf)) {
- dprintf(LOG_ERR, FNAME, "buffer size assumption failed");
+ debug_printf(LOG_ERR, FNAME, "buffer size assumption failed");
return (-1);
}
@@ -2730,7 +2730,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
/* set options in the reply message */
if ((optlen = dhcp6_set_options(type, (struct dhcp6opt *)(dh6 + 1),
(struct dhcp6opt *)(replybuf + sizeof(replybuf)), roptinfo)) < 0) {
- dprintf(LOG_INFO, FNAME, "failed to construct reply options");
+ debug_printf(LOG_INFO, FNAME, "failed to construct reply options");
return (-1);
}
len += optlen;
@@ -2740,7 +2740,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
case DHCP6_AUTHPROTO_DELAYED:
if (client_conf == NULL || client_conf->delayedkey == NULL) {
/* This case should have been caught earlier */
- dprintf(LOG_ERR, FNAME, "authentication required "
+ debug_printf(LOG_ERR, FNAME, "authentication required "
"but not key provided");
break;
}
@@ -2748,7 +2748,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
roptinfo->authalgorithm,
roptinfo->delayedauth_offset + sizeof(*dh6),
client_conf->delayedkey)) {
- dprintf(LOG_WARNING, FNAME, "failed to calculate MAC");
+ debug_printf(LOG_WARNING, FNAME, "failed to calculate MAC");
return (-1);
}
break;
@@ -2792,7 +2792,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
(struct dhcp6opt *)(dh6relay + 1),
(struct dhcp6opt *)(replybuf + sizeof(replybuf)),
&relayopt)) < 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"failed to construct relay message");
dhcp6_clear_options(&relayopt);
return (-1);
@@ -2808,12 +2808,12 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
dst.sin6_scope_id = ((struct sockaddr_in6 *)from)->sin6_scope_id;
if (transmit_sa(outsock, (struct sockaddr *)&dst,
replybuf, len) != 0) {
- dprintf(LOG_ERR, FNAME, "transmit %s to %s failed",
+ debug_printf(LOG_ERR, FNAME, "transmit %s to %s failed",
dhcp6msgstr(type), addr2str((struct sockaddr *)&dst));
return (-1);
}
- dprintf(LOG_DEBUG, FNAME, "transmit %s to %s",
+ debug_printf(LOG_DEBUG, FNAME, "transmit %s to %s",
dhcp6msgstr(type), addr2str((struct sockaddr *)&dst));
return (0);
@@ -2835,13 +2835,13 @@ make_ia_stcode(iatype, iaid, stcode, retlist)
TAILQ_INIT(&stcode_list);
if (dhcp6_add_listval(&stcode_list, DHCP6_LISTVAL_STCODE,
&stcode, NULL) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to make an option list");
+ debug_printf(LOG_NOTICE, FNAME, "failed to make an option list");
return (-1);
}
if (dhcp6_add_listval(retlist, iatype,
&ia_empty, &stcode_list) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to make an option list");
+ debug_printf(LOG_NOTICE, FNAME, "failed to make an option list");
dhcp6_clear_list(&stcode_list);
return (-1);
}
@@ -2872,7 +2872,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
struct dhcp6_list *blist = &binding->val_list;
struct dhcp6_listval *bia, *v;
- dprintf(LOG_DEBUG, FNAME, "we have a binding already: %s",
+ debug_printf(LOG_DEBUG, FNAME, "we have a binding already: %s",
bindingstr(binding));
update_binding(binding);
@@ -2883,7 +2883,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
calc_ia_timo(&ia, blist, client_conf);
if (dhcp6_add_listval(retlist, spec->type, &ia, blist)
== NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to copy binding info");
return (0);
}
@@ -2959,7 +2959,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
if (do_binding) {
if (add_binding(&client_conf->duid, DHCP6_BINDING_IA,
spec->type, spec->val_ia.iaid, &ialist) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to make a binding");
found = 0;
}
@@ -3000,7 +3000,7 @@ make_match_ia(spec, conflist, retlist)
match = 0;
break;
default:
- dprintf(LOG_ERR, FNAME, "unsupported IA type");
+ debug_printf(LOG_ERR, FNAME, "unsupported IA type");
return (0); /* XXX */
}
}
@@ -3032,10 +3032,10 @@ make_iana_from_pool(poolspec, spec, retlist)
struct pool_conf *pool;
int found = 0;
- dprintf(LOG_DEBUG, FNAME, "called");
+ debug_printf(LOG_DEBUG, FNAME, "called");
if ((pool = find_pool(poolspec->name)) == NULL) {
- dprintf(LOG_ERR, FNAME, "pool '%s' not found", poolspec->name);
+ debug_printf(LOG_ERR, FNAME, "pool '%s' not found", poolspec->name);
return (0);
}
@@ -3060,7 +3060,7 @@ make_iana_from_pool(poolspec, spec, retlist)
}
}
- dprintf(LOG_DEBUG, FNAME, "returns (found=%d)", found);
+ debug_printf(LOG_DEBUG, FNAME, "returns (found=%d)", found);
return (found);
}
@@ -3078,7 +3078,7 @@ calc_ia_timo(ia, ialist, client_conf)
iatype = TAILQ_FIRST(ialist)->type;
for (iav = TAILQ_FIRST(ialist); iav; iav = TAILQ_NEXT(iav, link)) {
if (iav->type != iatype) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"assumption failure: IA list is not consistent");
exit (1); /* XXX */
}
@@ -3144,7 +3144,7 @@ update_binding_duration(binding)
lifetime = iav->val_statefuladdr6.vltime;
break;
default:
- dprintf(LOG_ERR, FNAME, "unsupported IA type");
+ debug_printf(LOG_ERR, FNAME, "unsupported IA type");
return; /* XXX */
}
@@ -3162,7 +3162,7 @@ update_binding_duration(binding)
break;
default:
/* should be internal error. */
- dprintf(LOG_ERR, FNAME, "unknown binding type (%d)",
+ debug_printf(LOG_ERR, FNAME, "unknown binding type (%d)",
binding->type);
return;
}
@@ -3182,13 +3182,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
u_int32_t duration = DHCP6_DURATION_INFINITE;
if ((binding = malloc(sizeof(*binding))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to allocate memory");
+ debug_printf(LOG_NOTICE, FNAME, "failed to allocate memory");
return (NULL);
}
memset(binding, 0, sizeof(*binding));
binding->type = btype;
if (duidcpy(&binding->clientid, clientid)) {
- dprintf(LOG_NOTICE, FNAME, "failed to copy DUID");
+ debug_printf(LOG_NOTICE, FNAME, "failed to copy DUID");
goto fail;
}
binding->iatype = iatype;
@@ -3200,7 +3200,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
TAILQ_INIT(&binding->val_list);
if (dhcp6_copy_list(&binding->val_list,
(struct dhcp6_list *)val0)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to copy binding data");
goto fail;
}
@@ -3213,13 +3213,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
lv_next = TAILQ_NEXT(lv, link);
if (lv->type != DHCP6_LISTVAL_STATEFULADDR6) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"unexpected binding value type(%d)", lv->type);
continue;
}
if (!lease_address(&lv->val_statefuladdr6.addr)) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"cannot lease address %s",
in6addr2str(&lv->val_statefuladdr6.addr, 0));
TAILQ_REMOVE(ia_list, lv, link);
@@ -3227,13 +3227,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
}
}
if (TAILQ_EMPTY(ia_list)) {
- dprintf(LOG_NOTICE, FNAME, "cannot lease any address");
+ debug_printf(LOG_NOTICE, FNAME, "cannot lease any address");
goto fail;
}
}
break;
default:
- dprintf(LOG_ERR, FNAME, "unexpected binding type(%d)", btype);
+ debug_printf(LOG_ERR, FNAME, "unexpected binding type(%d)", btype);
goto fail;
}
@@ -3245,7 +3245,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
binding->timer = dhcp6_add_timer(binding_timo, binding);
if (binding->timer == NULL) {
- dprintf(LOG_NOTICE, FNAME, "failed to add timer");
+ debug_printf(LOG_NOTICE, FNAME, "failed to add timer");
goto fail;
}
timo.tv_sec = (long)duration;
@@ -3255,7 +3255,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
TAILQ_INSERT_TAIL(&dhcp6_binding_head, binding, link);
- dprintf(LOG_DEBUG, FNAME, "add a new binding %s", bindingstr(binding));
+ debug_printf(LOG_DEBUG, FNAME, "add a new binding %s", bindingstr(binding));
return (binding);
@@ -3295,7 +3295,7 @@ update_binding(binding)
{
struct timeval timo;
- dprintf(LOG_DEBUG, FNAME, "update binding %s for %s",
+ debug_printf(LOG_DEBUG, FNAME, "update binding %s for %s",
bindingstr(binding), duidstr(&binding->clientid));
/* update timestamp and calculate new duration */
@@ -3316,7 +3316,7 @@ static void
remove_binding(binding)
struct dhcp6_binding *binding;
{
- dprintf(LOG_DEBUG, FNAME, "remove a binding %s",
+ debug_printf(LOG_DEBUG, FNAME, "remove a binding %s",
bindingstr(binding));
if (binding->timer)
@@ -3343,7 +3343,7 @@ free_binding(binding)
for (lv = TAILQ_FIRST(ia_list); lv; lv = TAILQ_NEXT(lv, link)) {
if (lv->type != DHCP6_LISTVAL_STATEFULADDR6) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"unexpected binding value type(%d)", lv->type);
continue;
}
@@ -3353,7 +3353,7 @@ free_binding(binding)
dhcp6_clear_list(&binding->val_list);
break;
default:
- dprintf(LOG_ERR, FNAME, "unknown binding type %d",
+ debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
binding->type);
break;
}
@@ -3386,7 +3386,7 @@ binding_timo(arg)
lifetime = iav->val_prefix6.vltime;
break;
default:
- dprintf(LOG_ERR, FNAME, "internal error: "
+ debug_printf(LOG_ERR, FNAME, "internal error: "
"unknown binding type (%d)",
binding->iatype);
return (NULL); /* XXX */
@@ -3394,7 +3394,7 @@ binding_timo(arg)
if (lifetime != DHCP6_DURATION_INFINITE &&
lifetime <= past) {
- dprintf(LOG_DEBUG, FNAME, "bound prefix %s/%d"
+ debug_printf(LOG_DEBUG, FNAME, "bound prefix %s/%d"
" in %s has expired",
in6addr2str(&iav->val_prefix6.addr, 0),
iav->val_prefix6.plen,
@@ -3414,7 +3414,7 @@ binding_timo(arg)
break;
default:
- dprintf(LOG_ERR, FNAME, "unknown binding type %d",
+ debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
binding->type);
return (NULL); /* XXX */
}
@@ -3444,7 +3444,7 @@ find_binding_ia(key, binding)
case DHCP6_BINDING_IA:
return (dhcp6_find_listval(ia_list, key->type, &key->uv, 0));
default:
- dprintf(LOG_ERR, FNAME, "unknown binding type %d",
+ debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
binding->type);
return (NULL); /* XXX */
}
@@ -3474,7 +3474,7 @@ bindingstr(binding)
(u_long)binding->duration);
break;
default:
- dprintf(LOG_ERR, FNAME, "unexpected binding type(%d)",
+ debug_printf(LOG_ERR, FNAME, "unexpected binding type(%d)",
binding->type);
return ("???");
}
@@ -3508,7 +3508,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
return (0);
case DHCP6_AUTHPROTO_DELAYED:
if (optinfo->authalgorithm != DHCP6_AUTHALG_HMACMD5) {
- dprintf(LOG_INFO, FNAME, "unknown authentication "
+ debug_printf(LOG_INFO, FNAME, "unknown authentication "
"algorithm (%d) required by %s",
optinfo->authalgorithm,
clientstr(client_conf, &optinfo->clientID));
@@ -3516,7 +3516,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
}
if (optinfo->authrdm != DHCP6_AUTHRDM_MONOCOUNTER) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"unknown RDM (%d) required by %s",
optinfo->authrdm,
clientstr(client_conf, &optinfo->clientID));
@@ -3525,13 +3525,13 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
/* see if we have a key for the client */
if (client_conf == NULL || client_conf->delayedkey == NULL) {
- dprintf(LOG_INFO, FNAME, "client %s wanted "
+ debug_printf(LOG_INFO, FNAME, "client %s wanted "
"authentication, but no key found",
clientstr(client_conf, &optinfo->clientID));
break;
}
key = client_conf->delayedkey;
- dprintf(LOG_DEBUG, FNAME, "found key %s for client %s",
+ debug_printf(LOG_DEBUG, FNAME, "found key %s for client %s",
key->name, clientstr(client_conf, &optinfo->clientID));
if (msgtype == DH6_SOLICIT) {
@@ -3540,7 +3540,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
* A solicit message should not contain
* authentication information.
*/
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"authentication information "
"provided in solicit from %s",
clientstr(client_conf,
@@ -3550,7 +3550,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
} else {
/* replay protection */
if (!client_conf->saw_previous_rd) {
- dprintf(LOG_WARNING, FNAME,
+ debug_printf(LOG_WARNING, FNAME,
"previous RD value for %s is unknown "
"(accept it)", clientstr(client_conf,
&optinfo->clientID));
@@ -3558,7 +3558,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
if (dhcp6_auth_replaycheck(optinfo->authrdm,
client_conf->previous_rd,
optinfo->authrd)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"possible replay attack detected "
"for client %s",
clientstr(client_conf,
@@ -3568,7 +3568,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
}
if ((optinfo->authflags & DHCP6OPT_AUTHFLAG_NOINFO)) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"client %s did not provide authentication "
"information in %s",
clientstr(client_conf, &optinfo->clientID),
@@ -3588,7 +3588,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
optinfo->delayedauth_realmlen != key->realmlen ||
memcmp(optinfo->delayedauth_realmval, key->realm,
key->realmlen) != 0) {
- dprintf(LOG_INFO, FNAME, "authentication key "
+ debug_printf(LOG_INFO, FNAME, "authentication key "
"mismatch with client %s",
clientstr(client_conf,
&optinfo->clientID));
@@ -3597,7 +3597,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
/* check for the key lifetime */
if (dhcp6_validate_key(key)) {
- dprintf(LOG_INFO, FNAME, "key %s has expired",
+ debug_printf(LOG_INFO, FNAME, "key %s has expired",
key->name);
break;
}
@@ -3607,12 +3607,12 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
optinfo->authproto, optinfo->authalgorithm,
optinfo->delayedauth_offset + sizeof(*dh6), key)
== 0) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"message authentication validated for "
"client %s", clientstr(client_conf,
&optinfo->clientID));
} else {
- dprintf(LOG_INFO, FNAME, "invalid message "
+ debug_printf(LOG_INFO, FNAME, "invalid message "
"authentication");
break;
}
@@ -3624,7 +3624,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
if (get_rdvalue(roptinfo->authrdm, &roptinfo->authrd,
sizeof(roptinfo->authrd))) {
- dprintf(LOG_ERR, FNAME, "failed to get a replay "
+ debug_printf(LOG_ERR, FNAME, "failed to get a replay "
"detection value for %s",
clientstr(client_conf, &optinfo->clientID));
break; /* XXX: try to recover? */
@@ -3635,7 +3635,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
roptinfo->delayedauth_realmval =
malloc(roptinfo->delayedauth_realmlen);
if (roptinfo->delayedauth_realmval == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to allocate memory "
+ debug_printf(LOG_ERR, FNAME, "failed to allocate memory "
"for authentication realm for %s",
clientstr(client_conf, &optinfo->clientID));
break;
@@ -3647,7 +3647,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
break;
default:
- dprintf(LOG_INFO, FNAME, "client %s wanted authentication "
+ debug_printf(LOG_INFO, FNAME, "client %s wanted authentication "
"with unsupported protocol (%d)",
clientstr(client_conf, &optinfo->clientID),
optinfo->authproto);
diff --git a/if.c b/if.c
index 61a7fd6..c690671 100644
--- a/if.c
+++ b/if.c
@@ -60,12 +60,12 @@ ifinit(ifname)
struct dhcp6_if *ifp;
if ((ifp = find_ifconfbyname(ifname)) != NULL) {
- dprintf(LOG_NOTICE, FNAME, "duplicated interface: %s", ifname);
+ debug_printf(LOG_NOTICE, FNAME, "duplicated interface: %s", ifname);
return (NULL);
}
if ((ifp = malloc(sizeof(*ifp))) == NULL) {
- dprintf(LOG_ERR, FNAME, "malloc failed");
+ debug_printf(LOG_ERR, FNAME, "malloc failed");
goto fail;
}
memset(ifp, 0, sizeof(*ifp));
@@ -73,7 +73,7 @@ ifinit(ifname)
TAILQ_INIT(&ifp->event_list);
if ((ifp->ifname = strdup(ifname)) == NULL) {
- dprintf(LOG_ERR, FNAME, "failed to copy ifname");
+ debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
goto fail;
}
@@ -92,7 +92,7 @@ ifinit(ifname)
struct sockaddr_in6 *sin6;
if (getifaddrs(&ifap) < 0) {
- dprintf(LOG_ERR, FNAME, "getifaddrs failed: %s",
+ debug_printf(LOG_ERR, FNAME, "getifaddrs failed: %s",
strerror(errno));
goto fail;
}
@@ -134,14 +134,14 @@ ifreset(ifp)
u_int32_t linkid;
if ((ifid = if_nametoindex(ifp->ifname)) == 0) {
- dprintf(LOG_ERR, FNAME, "invalid interface(%s): %s",
+ debug_printf(LOG_ERR, FNAME, "invalid interface(%s): %s",
ifp->ifname, strerror(errno));
return (-1);
}
#ifdef HAVE_SCOPELIB
if (inet_zoneid(AF_INET6, 2, ifname, &linkid)) {
- dprintf(LOG_ERR, FNAME, "failed to get link ID for %s",
+ debug_printf(LOG_ERR, FNAME, "failed to get link ID for %s",
ifname);
return (-1);
}
diff --git a/lease.c b/lease.c
index d46ddfd..5cb7325 100644
--- a/lease.c
+++ b/lease.c
@@ -93,7 +93,7 @@ static struct hash_entry * hash_table_find __P((struct hash_table *, void *));
int
lease_init(void)
{
- dprintf(LOG_DEBUG, FNAME, "called");
+ debug_printf(LOG_DEBUG, FNAME, "called");
if (hash_table_init(&dhcp6_lease_table, DHCP6_LEASE_TABLE_SIZE,
in6_addr_hash, in6_addr_match) != 0) {
@@ -116,10 +116,10 @@ lease_address(addr)
if (!addr)
return (FALSE);
- dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
if (hash_table_find(&dhcp6_lease_table, addr)) {
- dprintf(LOG_WARNING, FNAME, "already leased: %s",
+ debug_printf(LOG_WARNING, FNAME, "already leased: %s",
in6addr2str(addr, 0));
return (FALSE);
}
@@ -138,10 +138,10 @@ release_address(addr)
if (!addr)
return;
- dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
if (hash_table_remove(&dhcp6_lease_table, addr) != 0) {
- dprintf(LOG_WARNING, FNAME, "not found: %s", in6addr2str(addr, 0));
+ debug_printf(LOG_WARNING, FNAME, "not found: %s", in6addr2str(addr, 0));
}
}
@@ -154,11 +154,11 @@ decline_address(addr)
if (!addr)
return;
- dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
entry = hash_table_find(&dhcp6_lease_table, addr);
if (entry == NULL) {
- dprintf(LOG_WARNING, FNAME, "not found: %s",
+ debug_printf(LOG_WARNING, FNAME, "not found: %s",
in6addr2str(addr, 0));
return;
}
diff --git a/prefixconf.c b/prefixconf.c
index ace6ade..9450a3f 100644
--- a/prefixconf.c
+++ b/prefixconf.c
@@ -141,7 +141,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
if (pinfo->vltime != DHCP6_DURATION_INFINITE &&
(pinfo->pltime == DHCP6_DURATION_INFINITE ||
pinfo->pltime > pinfo->vltime)) {
- dprintf(LOG_INFO, FNAME, "invalid prefix %s/%d: "
+ debug_printf(LOG_INFO, FNAME, "invalid prefix %s/%d: "
"pltime (%lu) is larger than vltime (%lu)",
in6addr2str(&pinfo->addr, 0), pinfo->plen,
pinfo->pltime, pinfo->vltime);
@@ -150,7 +150,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
if (iac_pd == NULL) {
if ((iac_pd = malloc(sizeof(*iac_pd))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
+ debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
return (-1);
}
memset(iac_pd, 0, sizeof(*iac_pd));
@@ -172,7 +172,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
/* search for the given prefix, and make a new one if it fails */
if ((sp = find_siteprefix(&iac_pd->siteprefix_head, pinfo, 1)) == NULL) {
if ((sp = malloc(sizeof(*sp))) == NULL) {
- dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
+ debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
return (-1);
}
memset(sp, 0, sizeof(*sp));
@@ -192,7 +192,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
/* update the prefix according to pinfo */
sp->prefix.pltime = pinfo->pltime;
sp->prefix.vltime = pinfo->vltime;
- dprintf(LOG_DEBUG, FNAME, "%s a prefix %s/%d pltime=%lu, vltime=%lu",
+ debug_printf(LOG_DEBUG, FNAME, "%s a prefix %s/%d pltime=%lu, vltime=%lu",
spcreate ? "create" : "update",
in6addr2str(&pinfo->addr, 0), pinfo->plen,
pinfo->pltime, pinfo->vltime);
@@ -209,7 +209,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
* [RFC3633 Section 12.1]
*/
if (strcmp(pif->ifname, dhcpifp->ifname) == 0) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"skip %s as a prefix interface",
dhcpifp->ifname);
continue;
@@ -235,7 +235,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
if (sp->timer == NULL) {
sp->timer = dhcp6_add_timer(siteprefix_timo, sp);
if (sp->timer == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to add prefix timer");
remove_siteprefix(sp); /* XXX */
return (-1);
@@ -276,7 +276,7 @@ remove_siteprefix(sp)
{
struct dhcp6_ifprefix *ip;
- dprintf(LOG_DEBUG, FNAME, "remove a site prefix %s/%d",
+ debug_printf(LOG_DEBUG, FNAME, "remove a site prefix %s/%d",
in6addr2str(&sp->prefix.addr, 0), sp->prefix.plen);
if (sp->timer)
@@ -390,7 +390,7 @@ renew_data_free(evd)
struct dhcp6_list *ial;
if (evd->type != DHCP6_EVDATA_IAPD) {
- dprintf(LOG_ERR, FNAME, "assumption failure");
+ debug_printf(LOG_ERR, FNAME, "assumption failure");
exit(1);
}
@@ -409,7 +409,7 @@ siteprefix_timo(arg)
struct ia *ia;
void (*callback)__P((struct ia *));
- dprintf(LOG_DEBUG, FNAME, "prefix timeout for %s/%d",
+ debug_printf(LOG_DEBUG, FNAME, "prefix timeout for %s/%d",
in6addr2str(&sp->prefix.addr, 0), sp->prefix.plen);
ia = sp->ctl->iacpd_ia;
@@ -438,7 +438,7 @@ add_ifprefix(siteprefix, prefix, pconf)
int b, i;
if ((ifpfx = malloc(sizeof(*ifpfx))) == NULL) {
- dprintf(LOG_NOTICE, FNAME,
+ debug_printf(LOG_NOTICE, FNAME,
"failed to allocate memory for ifprefix");
return (-1);
}
@@ -456,13 +456,13 @@ add_ifprefix(siteprefix, prefix, pconf)
* XXX: our current implementation assumes ifid len is a multiple of 8
*/
if ((pconf->ifid_len % 8) != 0) {
- dprintf(LOG_ERR, FNAME,
+ debug_printf(LOG_ERR, FNAME,
"assumption failure on the length of interface ID");
goto bad;
}
if (ifpfx->plen + pconf->ifid_len < 0 ||
ifpfx->plen + pconf->ifid_len > 128) {
- dprintf(LOG_INFO, FNAME,
+ debug_printf(LOG_INFO, FNAME,
"invalid prefix length %d + %d + %d",
prefix->plen, pconf->sla_len, pconf->ifid_len);
goto bad;
diff --git a/timer.c b/timer.c
index c74aa1f..c1666b4 100644
--- a/timer.c
+++ b/timer.c
@@ -71,14 +71,14 @@ dhcp6_add_timer(timeout, timeodata)
struct dhcp6_timer *newtimer;
if ((newtimer = malloc(sizeof(*newtimer))) == NULL) {
- dprintf(LOG_ERR, FNAME, "can't allocate memory");
+ debug_printf(LOG_ERR, FNAME, "can't allocate memory");
return (NULL);
}
memset(newtimer, 0, sizeof(*newtimer));
if (timeout == NULL) {
- dprintf(LOG_ERR, FNAME, "timeout function unspecified");
+ debug_printf(LOG_ERR, FNAME, "timeout function unspecified");
exit(1);
}
newtimer->expire = timeout;
@@ -165,7 +165,7 @@ dhcp6_timer_rest(timer)
gettimeofday(&now, NULL);
if (TIMEVAL_LEQ(timer->tm, now)) {
- dprintf(LOG_DEBUG, FNAME,
+ debug_printf(LOG_DEBUG, FNAME,
"a timer must be expired, but not yet");
returnval.tv_sec = returnval.tv_usec = 0;
} else