logdebug now logs errors like logerr and logwarn.
}
if (ifn) {
#ifdef ARP_DEBUG
- logdebug("%s: ignoring ARP from self", ifp->name);
+ logdebugx("%s: ignoring ARP from self", ifp->name);
#endif
return;
}
tv.tv_nsec = 0;
eloop_timeout_add_tv(ifp->ctx->eloop, &tv, arp_probed, astate);
}
- logdebug("%s: ARP probing %s (%d of %d), next in %0.1f seconds",
+ logdebugx("%s: ARP probing %s (%d of %d), next in %0.1f seconds",
ifp->name, inet_ntoa(astate->addr),
astate->probes ? astate->probes : PROBE_NUM, PROBE_NUM,
timespec_to_double(&tv));
logerr(__func__);
}
astate->probes = 0;
- logdebug("%s: probing for %s",
+ logdebugx("%s: probing for %s",
astate->iface->name, inet_ntoa(astate->addr));
arp_probe1(astate);
}
astate->claims++;
#else
if (++astate->claims < ANNOUNCE_NUM)
- logdebug("%s: ARP announcing %s (%d of %d), "
+ logdebugx("%s: ARP announcing %s (%d of %d), "
"next in %d.0 seconds",
ifp->name, inet_ntoa(astate->addr),
astate->claims, ANNOUNCE_NUM, ANNOUNCE_WAIT);
else
- logdebug("%s: ARP announcing %s (%d of %d)",
+ logdebugx("%s: ARP announcing %s (%d of %d)",
ifp->name, inet_ntoa(astate->addr),
astate->claims, ANNOUNCE_NUM);
if (arp_request(ifp, astate->addr.s_addr, astate->addr.s_addr) == -1)
if (ctx->dev) {
if (stop)
- logdebug("dev: unloaded %s", ctx->dev->name);
+ logdebugx("dev: unloaded %s", ctx->dev->name);
eloop_event_delete(ctx->eloop, ctx->dev_fd);
ctx->dev->stop();
free(ctx->dev);
dp = opendir(DEVDIR);
if (dp == NULL) {
- logdebug("dev: %s: %m", DEVDIR);
+ logdebug("dev: %s", DEVDIR);
return 0;
}
if (!(ifo->options & DHCPCD_CSR_WARNED) &&
!(state->added & STATE_FAKE))
{
- logdebug("%s: using %sClassless Static Routes",
+ logdebugx("%s: using %sClassless Static Routes",
ifp->name, csr);
ifo->options |= DHCPCD_CSR_WARNED;
}
ssize_t bytes;
const struct dhcp_state *state = D_CSTATE(ifp);
- logdebug("%s: writing lease `%s'", ifp->name, state->leasefile);
+ logdebugx("%s: writing lease `%s'", ifp->name, state->leasefile);
fd = open(state->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1)
return 0;
}
if (state->leasefile[0] == '\0')
- logdebug("reading standard input");
+ logdebugx("reading standard input");
else
- logdebug("%s: reading lease `%s'",
+ logdebugx("%s: reading lease `%s'",
ifp->name, state->leasefile);
bytes = dhcp_read_lease_fd(fd, (void **)&lease);
if (dhcp_auth_validate(&state->auth, &ifp->options->auth,
lease, bytes, 4, type, auth, auth_len) == NULL)
{
- logdebug("%s: dhcp_auth_validate", ifp->name);
+ logerr("%s: authentication failed", ifp->name);
free(lease);
return 0;
}
if (state->auth.token)
- logdebug("%s: validated using 0x%08" PRIu32,
+ logdebugx("%s: validated using 0x%08" PRIu32,
ifp->name, state->auth.token->secretid);
else
- logdebug("%s: accepted reconfigure key", ifp->name);
+ logdebugx("%s: accepted reconfigure key", ifp->name);
} else if ((ifp->options->auth.options & DHCPCD_AUTH_SENDREQUIRE) ==
DHCPCD_AUTH_SENDREQUIRE)
{
/* No carrier? Don't bother sending the packet. */
if (ifp->carrier == LINK_DOWN)
return;
- logdebug("%s: sending %s with xid 0x%x",
+ logdebugx("%s: sending %s with xid 0x%x",
ifp->name,
ifo->options & DHCPCD_BOOTP ? "BOOTP" : get_dhcp_op(type),
state->xid);
* However, we do need to advance the timeout. */
if (ifp->carrier == LINK_DOWN)
goto fail;
- logdebug("%s: sending %s (xid 0x%x), next in %0.1f seconds",
+ logdebugx("%s: sending %s (xid 0x%x), next in %0.1f seconds",
ifp->name,
ifo->options & DHCPCD_BOOTP ? "BOOTP" : get_dhcp_op(type),
state->xid,
eloop_timeout_delete(ifp->ctx->eloop, dhcp_startrenew, ifp);
lease = &state->lease;
- logdebug("%s: renewing lease of %s", ifp->name,
+ logdebugx("%s: renewing lease of %s", ifp->name,
inet_ntoa(lease->addr));
state->state = DHS_RENEW;
dhcp_new_xid(ifp);
struct dhcp_lease *lease = &state->lease;
logwarnx("%s: failed to renew DHCP, rebinding", ifp->name);
- logdebug("%s: expire in %"PRIu32" seconds",
+ logdebugx("%s: expire in %"PRIu32" seconds",
ifp->name, lease->leasetime - lease->rebindtime);
state->state = DHS_REBIND;
eloop_timeout_delete(ifp->ctx->eloop, send_renew, ifp);
if (state->state == DHS_BOUND)
return;
- logdebug("%s: DAD completed for %s",
+ logdebugx("%s: DAD completed for %s",
ifp->name, inet_ntoa(astate->addr));
if (state->state != DHS_INFORM)
dhcp_bind(ifp);
if (state->addr &&
lease->addr.s_addr == state->addr->addr.s_addr &&
!(state->added & STATE_FAKE))
- logdebug("%s: leased %s for %"PRIu32" seconds",
+ logdebugx("%s: leased %s for %"PRIu32" seconds",
ifp->name, inet_ntoa(lease->addr),
lease->leasetime);
else
(time_t)lease->rebindtime, dhcp_rebind, ifp);
eloop_timeout_add_sec(ifp->ctx->eloop,
(time_t)lease->leasetime, dhcp_expire, ifp);
- logdebug("%s: renew in %"PRIu32" seconds, rebind in %"PRIu32
+ logdebugx("%s: renew in %"PRIu32" seconds, rebind in %"PRIu32
" seconds",
ifp->name, lease->renewaltime, lease->rebindtime);
}
/* Handled in our BPF filter. */
#if 0
if (bootp->op != BOOTREPLY) {
- logdebug("%s: op (%d) is not BOOTREPLY",
+ logdebugx("%s: op (%d) is not BOOTREPLY",
ifp->name, bootp->op);
return;
}
{
char buf[sizeof(bootp->chaddr) * 3];
- logdebug("%s: xid 0x%x is for hwaddr %s",
+ logdebugx("%s: xid 0x%x is for hwaddr %s",
ifp->name, ntohl(bootp->xid),
hwaddr_ntoa(bootp->chaddr, sizeof(bootp->chaddr),
buf, sizeof(buf)));
bootp, bootp_len, DHO_MESSAGETYPE) == -1)
type = 0;
else if (ifo->options & DHCPCD_BOOTP) {
- logdebug("%s: ignoring DHCP reply (expecting BOOTP)",
+ logdebugx("%s: ignoring DHCP reply (expecting BOOTP)",
ifp->name);
return;
}
(uint8_t *)bootp, bootp_len, 4, type,
auth, auth_len) == NULL)
{
- logdebug("%s: dhcp_auth_validate",
- ifp->name);
LOGDHCP0(logerrx, "authentication failed");
return;
}
if (state->auth.token)
- logdebug("%s: validated using 0x%08" PRIu32,
+ logdebugx("%s: validated using 0x%08" PRIu32,
ifp->name, state->auth.token->secretid);
else
loginfo("%s: accepted reconfigure key", ifp->name);
return;
}
if (state->state != DHS_BOUND && state->state != DHS_INFORM) {
- LOGDHCP(logdebug, "not bound, ignoring Force Renew");
+ LOGDHCP(logdebugx, "not bound, ignoring Force Renew");
return;
}
LOGDHCP(loginfo, "Force Renew from");
/* Before we supported FORCERENEW we closed off the raw
* port so we effectively ignored all messages.
* As such we'll not log by default here. */
- //LOGDHCP(logdebug, "bound, ignoring");
+ //LOGDHCP(logdebugx, "bound, ignoring");
return;
}
#if 0
/* Ensure it's the right transaction */
if (state->xid != ntohl(bootp->xid)) {
- logdebug("%s: wrong xid 0x%x (expecting 0x%x) from %s",
+ logdebugx("%s: wrong xid 0x%x (expecting 0x%x) from %s",
ifp->name, ntohl(bootp->xid), state->xid,
inet_ntoa(*from));
return;
if (state->state == DHS_PROBE) {
/* Ignore any DHCP messages whilst probing a lease to bind. */
- LOGDHCP(logdebug, "probing, ignoring");
+ LOGDHCP(logdebugx, "probing, ignoring");
return;
}
DHO_RAPIDCOMMIT, NULL))
state->state = DHS_REQUEST;
else {
- LOGDHCP(logdebug, "ignoring ack of");
+ LOGDHCP(logdebugx, "ignoring ack of");
return;
}
}
rapidcommit:
if (!(ifo->options & DHCPCD_INFORM))
- LOGDHCP(logdebug, "acknowledged");
+ LOGDHCP(logdebugx, "acknowledged");
else
ifo->options &= ~DHCPCD_STATIC;
}
return 0;
if (ifo->options & DHCPCD_CLIENTID)
- logdebug("%s: using ClientID %s", ifp->name,
+ logdebugx("%s: using ClientID %s", ifp->name,
hwaddr_ntoa(state->clientid + 1, state->clientid[0],
buf, sizeof(buf)));
else if (ifp->hwlen)
- logdebug("%s: using hwaddr %s", ifp->name,
+ logdebugx("%s: using hwaddr %s", ifp->name,
hwaddr_ntoa(ifp->hwaddr, ifp->hwlen, buf, sizeof(buf)));
return 0;
if (now == -1 ||
(time_t)state->lease.leasetime < now - st.st_mtime)
{
- logdebug("%s: discarding expired lease",
+ logdebugx("%s: discarding expired lease",
ifp->name);
free(state->offer);
state->offer = NULL;
tv.tv_nsec = (suseconds_t)arc4random_uniform(
(DHCP_MAX_DELAY - DHCP_MIN_DELAY) * NSEC_PER_SEC);
timespecnorm(&tv);
- logdebug("%s: delaying IPv4 for %0.1f seconds",
+ logdebugx("%s: delaying IPv4 for %0.1f seconds",
ifp->name, timespec_to_double(&tv));
eloop_timeout_add_tv(ifp->ctx->eloop, &tv, dhcp_start1, ifp);
}
if (!callback)
- logdebug("%s: %s %s with xid 0x%02x%02x%02x",
+ logdebugx("%s: %s %s with xid 0x%02x%02x%02x",
ifp->name,
broad_uni,
dhcp6_get_op(state->send->type),
logsend:
if (ifp->carrier != LINK_DOWN)
- logdebug("%s: %s %s (xid 0x%02x%02x%02x),"
+ logdebugx("%s: %s %s (xid 0x%02x%02x%02x),"
" next in %0.1f seconds",
ifp->name,
broad_uni,
}
}
if (!wascompleted) {
- logdebug("%s: DHCPv6 DAD completed",
+ logdebugx("%s: DHCPv6 DAD completed",
ifp->name);
script_runreason(ifp,
ap->delegating_prefix ?
else
farg = m;
if ((opt = f(farg, len, D6_OPTION_STATUS_CODE, &opt_len)) == NULL) {
- //logdebug("%s: no status", ifp->name);
+ //logdebugx("%s: no status", ifp->name);
return 0;
}
if (j == ifo->ia_len &&
!(ifo->ia_len == 0 && ifp->ctx->options & DHCPCD_DUMPLEASE))
{
- logdebug("%s: ignoring unrequested IAID %s",
+ logdebugx("%s: ignoring unrequested IAID %s",
ifp->name,
hwaddr_ntoa(ia.iaid, sizeof(ia.iaid),
buf, sizeof(buf)));
ssize_t bytes;
state = D6_CSTATE(ifp);
- logdebug("%s: writing lease `%s'", ifp->name, state->leasefile);
+ logdebugx("%s: writing lease `%s'", ifp->name, state->leasefile);
fd = open(state->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
state = D6_STATE(ifp);
if (state->leasefile[0] == '\0') {
- logdebug("reading standard input");
+ logdebugx("reading standard input");
fd = fileno(stdin);
fd_opened = false;
} else {
- logdebug("%s: reading lease `%s'", ifp->name, state->leasefile);
+ logdebugx("%s: reading lease `%s'", ifp->name, state->leasefile);
fd = open(state->leasefile, O_RDONLY);
if (fd != -1 && fstat(fd, &st) == -1) {
close(fd);
state->leasefile[0] != '\0')
{
if ((time_t)state->expire < now - st.st_mtime) {
- logdebug("%s: discarding expired lease", ifp->name);
+ logdebugx("%s: discarding expired lease", ifp->name);
retval = 0;
goto ex;
}
(uint8_t *)state->new, state->new_len, 6, state->new->type,
o, ol) == NULL)
{
- logdebug("%s: dhcp_auth_validate", __func__);
logerr("%s: authentication failed", ifp->name);
goto ex;
}
if (state->auth.token)
- logdebug("%s: validated using 0x%08" PRIu32,
+ logdebugx("%s: validated using 0x%08" PRIu32,
ifp->name, state->auth.token->secretid);
else
loginfo("%s: accepted reconfigure key", ifp->name);
if (!delegated)
dhcpcd_daemonise(ifp->ctx);
} else
- logdebug("%s: waiting for DHCPv6 DAD to complete", ifp->name);
+ logdebugx("%s: waiting for DHCPv6 DAD to complete", ifp->name);
}
#ifdef SMALL
if (ap->flags & IPV6_AF_NEW)
logfunc = loginfo;
else
- logfunc = logdebug;
+ logfunc = logdebugx;
/* We only want to log this the once as we loop
* through many interfaces first. */
ap->flags |= IPV6_AF_DELEGATEDLOG;
/* no SLA configured, so lets
* automate it */
if (ifd->carrier != LINK_UP) {
- logdebug(
+ logdebugx(
"%s: has no carrier, cannot"
" delegate addresses",
ifd->name);
if (strcmp(ifd->name, sla->ifname))
continue;
if (ifd->carrier != LINK_UP) {
- logdebug(
+ logdebugx(
"%s: has no carrier, cannot"
" delegate addresses",
ifd->name);
if (strcmp(ifp->name, sla->ifname))
continue;
if (ipv6_linklocal(ifp) == NULL) {
- logdebug(
+ logdebugx(
"%s: delaying adding"
" delegated addresses for"
" LL address",
break;
}
if (ifp == NULL) {
- logdebug("DHCPv6 reply for unexpected interface from %s",
+ logdebugx("DHCPv6 reply for unexpected interface from %s",
ctx->sfrom);
return;
}
if (r->type != DHCP6_RECONFIGURE &&
(state->state == DH6S_BOUND || state->state == DH6S_INFORMED))
{
- logdebug("%s: DHCPv6 reply received but already bound",
+ logdebugx("%s: DHCPv6 reply received but already bound",
ifp->name);
return;
}
r->xid[1] != state->send->xid[1] ||
r->xid[2] != state->send->xid[2]))
{
- logdebug("%s: wrong xid 0x%02x%02x%02x"
+ logdebugx("%s: wrong xid 0x%02x%02x%02x"
" (expecting 0x%02x%02x%02x) from %s",
ifp->name,
r->xid[0], r->xid[1], r->xid[2],
}
if (dhcp6_findmoption(r, len, D6_OPTION_SERVERID, NULL) == NULL) {
- logdebug("%s: no DHCPv6 server ID from %s",
+ logdebugx("%s: no DHCPv6 server ID from %s",
ifp->name, ctx->sfrom);
return;
}
if (o == NULL || ol != ctx->duid_len ||
memcmp(o, ctx->duid, ol) != 0)
{
- logdebug("%s: incorrect client ID from %s",
+ logdebugx("%s: incorrect client ID from %s",
ifp->name, ctx->sfrom);
return;
}
if (dhcp_auth_validate(&state->auth, &ifo->auth,
(uint8_t *)r, len, 6, r->type, auth, auth_len) == NULL)
{
- logdebug("dhcp_auth_validate");
- logerrx("%s: authentication failed from %s",
+ logerr("%s: authentication failed from %s",
ifp->name, ctx->sfrom);
return;
}
if (state->auth.token)
- logdebug("%s: validated using 0x%08" PRIu32,
+ logdebugx("%s: validated using 0x%08" PRIu32,
ifp->name, state->auth.token->secretid);
else
loginfo("%s: accepted reconfigure key", ifp->name);
memcpy(&max_rt, o, sizeof(max_rt));
max_rt = ntohl(max_rt);
if (max_rt >= 60 && max_rt <= 86400) {
- logdebug("%s: SOL_MAX_RT %llu -> %u",
+ logdebugx("%s: SOL_MAX_RT %llu -> %u",
ifp->name,
(unsigned long long)state->sol_max_rt,
max_rt);
memcpy(&max_rt, o, sizeof(max_rt));
max_rt = ntohl(max_rt);
if (max_rt >= 60 && max_rt <= 86400) {
- logdebug("%s: INF_MAX_RT %llu -> %u",
+ logdebugx("%s: INF_MAX_RT %llu -> %u",
ifp->name,
(unsigned long long)state->inf_max_rt,
max_rt);
break;
}
}
- lognewinfo = has_new ? loginfo : logdebug;
+ lognewinfo = has_new ? loginfo : logdebugx;
lognewinfo("%s: %s received from %s", ifp->name, op, ctx->sfrom);
state->reason = NULL;
dhcp_set_leasefile(state->leasefile, sizeof(state->leasefile),
AF_INET6, ifp);
if (ipv6_linklocal(ifp) == NULL) {
- logdebug("%s: delaying DHCPv6 soliciation for LL address",
+ logdebugx("%s: delaying DHCPv6 soliciation for LL address",
ifp->name);
ipv6_addlinklocalcallback(ifp, dhcp6_start1, ifp);
return 0;
TAILQ_FOREACH(ifp, ctx->ifaces, next) {
if ((af = dhcpcd_ifafwaiting(ifp)) != AF_MAX) {
- logdebug("%s: waiting for an %s address",
+ logdebugx("%s: waiting for an %s address",
ifp->name, dhcpcd_af(af));
return 0;
}
}
if ((af = dhcpcd_afwaiting(ctx)) != AF_MAX) {
- logdebug("waiting for an %s address",
+ logdebugx("waiting for an %s address",
dhcpcd_af(af));
return 0;
}
if (ctx->options & DHCPCD_DAEMONISED ||
!(ctx->options & DHCPCD_DAEMONISE))
return 0;
- logdebug("forking to background");
+ logdebugx("forking to background");
/* Setup a signal pipe so parent knows when to exit. */
if (pipe(sidpipe) == -1) {
pssid[0] = '\0';
ifo = read_config(ifp->ctx, ifp->name, pssid, profile);
if (ifo == NULL) {
- logdebug("%s: no profile %s", ifp->name, profile);
+ logdebugx("%s: no profile %s", ifp->name, profile);
return -1;
}
if (profile != NULL) {
return -1;
}
if (ifp->active) {
- logdebug("%s: interface departed", ifp->name);
+ logdebugx("%s: interface departed", ifp->name);
ifp->options->options |= DHCPCD_DEPARTED;
stop_interface(ifp);
}
iff = if_find(ctx->ifaces, ifp->name);
if (iff) {
if (iff->active)
- logdebug("%s: interface updated", iff->name);
+ logdebugx("%s: interface updated", iff->name);
/* The flags and hwaddr could have changed */
iff->flags = ifp->flags;
iff->hwlen = ifp->hwlen;
TAILQ_INSERT_TAIL(ctx->ifaces, ifp, next);
if (!ifp->active)
continue;
- logdebug("%s: interface added", ifp->name);
+ logdebugx("%s: interface added", ifp->name);
dhcpcd_initstate(ifp, 0);
run_preinit(ifp);
iff = ifp;
len = control_send(&ctx, argc, argv);
control_close(&ctx);
if (len > 0) {
- logdebug("send OK");
+ logdebugx("send OK");
goto exit_success;
} else {
logerr("%s: control_send", __func__);
}
#endif
- logdebug(PACKAGE "-" VERSION " starting");
+ logdebugx(PACKAGE "-" VERSION " starting");
ctx.options |= DHCPCD_STARTED;
#ifdef USE_SIGNALS
if (eloop_signal_set_cb(ctx.eloop,
logfunc_t *logfunc;
logfunc = ctx.options & DHCPCD_INACTIVE ?
- logdebug : logerrx;
+ logdebugx : logerrx;
logfunc("no valid interfaces found");
} else
goto exit_failure;
logfunc_t *logfunc;
logfunc = ctx.options & DHCPCD_INACTIVE ?
- logdebug : logwarnx;
+ logdebugx : logwarnx;
logfunc("no interfaces have a carrier");
if (dhcpcd_daemonise(&ctx))
goto exit_success;
if (!(ctx->options & DHCPCD_TEST) &&
flags & ND6_IFF_AUTO_LINKLOCAL)
{
- logdebug("%s: disabling Kernel IPv6 auto "
+ logdebugx("%s: disabling Kernel IPv6 auto "
"link-local support",
ifp->name);
flags &= ~ND6_IFF_AUTO_LINKLOCAL;
if (!(ctx->options & DHCPCD_TEST) &&
flags & ND6_IFF_ACCEPT_RTADV)
{
- logdebug("%s: disabling Kernel IPv6 RA support",
+ logdebugx("%s: disabling Kernel IPv6 RA support",
ifp->name);
flags &= ~ND6_IFF_ACCEPT_RTADV;
}
else
logerr("IPV6CTL_ACCEPT_RTADV");
else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
- logdebug("disabling Kernel IPv6 RA support");
+ logdebugx("disabling Kernel IPv6 RA support");
if (set_inet6_sysctl(IPV6CTL_ACCEPT_RTADV, 0) == -1) {
logerr("IPV6CTL_ACCEPT_RTADV");
return ra;
else if (!(ctx->options & DHCPCD_TEST)) {
if (if_disable_autolinklocal(ctx, ifp->index) == -1)
logdebug("%s: if_disable_autolinklocal: %s",
- ifp->name, strerror(errno));
+ ifp->name);
}
if (ifp)
ifname = ifp->name;
snprintf(path, sizeof(path), "%s/%s/accept_ra", prefix, ifname);
ra = check_proc_int(path);
if (ra == -1) {
- logfunc_t *logfunc = errno == ENOENT? logdebug : logwarnx;
+ logfunc_t *logfunc = errno == ENOENT? logdebug : logwarn;
/* The sysctl probably doesn't exist, but this isn't an
* error as such so just log it and continue */
- logfunc("%s: %s", path, strerror(errno));
+ logfunc("%s", path);
} else if (ra != 0 && !(ctx->options & DHCPCD_TEST)) {
- logdebug("%s: disabling kernel IPv6 RA support", ifname);
+ logdebugx("%s: disabling kernel IPv6 RA support", ifname);
if (write_path(path, "0") == -1) {
logerr("%s: %s", __func__, path);
return ra;
}
if (if_vimaster(ctx, spec.devname) == 1) {
- if (argc)
- logerr("%s: is a Virtual Interface Master, "
- "skipping",
- spec.devname);
- else
- logdebug("%s: is a Virtual Interface Master, "
- "skipping",
- spec.devname);
+ logfunc_t *logfunc = argc != 0 ? logerrx : logdebugx;
+ logfunc("%s: is a Virtual Interface Master, skipping",
+ spec.devname);
continue;
}
ctx->ifac == 0 && active &&
!if_hasconf(ctx, ifp->name))
{
- logdebug("%s: ignoring due to"
+ logdebugx("%s: ignoring due to"
" interface type and"
" no config",
ifp->name);
UNUSED(keeparp);
#endif
- logdebug("%s: deleting IP address %s",
+ logdebugx("%s: deleting IP address %s",
addr->iface->name, addr->saddr);
r = if_address(RTM_DELADDR, addr);
return NULL;
}
if (blank)
- logdebug("%s: aliased %s", ia->alias, ia->saddr);
+ logdebugx("%s: aliased %s", ia->alias, ia->saddr);
#endif
- logdebug("%s: adding IP address %s broadcast %s",
+ logdebugx("%s: adding IP address %s broadcast %s",
ifp->name, ia->saddr, inet_ntoa(*bcast));
if (if_address(RTM_NEWADDR, ia) == -1) {
if (errno != EEXIST)
if (ia &&
ia->mask.s_addr == lease->mask.s_addr &&
ia->brd.s_addr == lease->brd.s_addr)
- logdebug("%s: IP address %s already exists",
+ logdebugx("%s: IP address %s already exists",
ifp->name, ia->saddr);
else {
#if __linux__
#ifdef IN_IFF_NOTREADY
if (ia->addr_flags & IN_IFF_NOTREADY)
return;
- logdebug("%s: DAD completed for %s",
+ logdebugx("%s: DAD completed for %s",
ifp->name, inet_ntoa(astate->addr));
#endif
test:
state->addr->addr.s_addr, state->addr->addr.s_addr) == -1)
logerr(__func__);
else {
- logdebug("%s: defended IPv4LL address %s",
+ logdebugx("%s: defended IPv4LL address %s",
ifp->name, state->addr->saddr);
state->defend = now;
return;
ipv6_iffindaddr(ap->iface, &ap->addr, IN6_IFF_NOTUSEABLE))
ap->flags |= IPV6_AF_DADCOMPLETED;
- logfunc = ap->flags & IPV6_AF_NEW ? loginfo : logdebug;
+ logfunc = ap->flags & IPV6_AF_NEW ? loginfo : logdebugx;
logfunc("%s: adding %saddress %s", ap->iface->name,
#ifdef IPV6_AF_TEMPORARY
ap->flags & IPV6_AF_TEMPORARY ? "temporary " : "",
ap->saddr);
if (ap->prefix_pltime == ND6_INFINITE_LIFETIME &&
ap->prefix_vltime == ND6_INFINITE_LIFETIME)
- logdebug("%s: pltime infinity, vltime infinity",
+ logdebugx("%s: pltime infinity, vltime infinity",
ap->iface->name);
else if (ap->prefix_pltime == ND6_INFINITE_LIFETIME)
- logdebug("%s: pltime infinity, vltime %"PRIu32" seconds",
+ logdebugx("%s: pltime infinity, vltime %"PRIu32" seconds",
ap->iface->name, ap->prefix_vltime);
else if (ap->prefix_vltime == ND6_INFINITE_LIFETIME)
- logdebug("%s: pltime %"PRIu32"seconds, vltime infinity",
+ logdebugx("%s: pltime %"PRIu32"seconds, vltime infinity",
ap->iface->name, ap->prefix_pltime);
else
- logdebug("%s: pltime %"PRIu32" seconds, vltime %"PRIu32
+ logdebugx("%s: pltime %"PRIu32" seconds, vltime %"PRIu32
" seconds",
ap->iface->name, ap->prefix_pltime, ap->prefix_vltime);
ap->prefix_vltime -= (uint32_t)n.tv_sec;
#if 0
- logdebug("%s: acquired %lld.%.9ld, now %lld.%.9ld, diff %lld.%.9ld",
+ logdebugx("%s: acquired %lld.%.9ld, now %lld.%.9ld, diff %lld.%.9ld",
ap->iface->name,
(long long)ap->acquired.tv_sec, ap->acquired.tv_nsec,
(long long)now->tv_sec, now->tv_nsec,
(long long)n.tv_sec, n.tv_nsec);
- logdebug("%s: adj pltime %"PRIu32" seconds, "
+ logdebugx("%s: adj pltime %"PRIu32" seconds, "
"vltime %"PRIu32" seconds",
ap->iface->name, ap->prefix_pltime, ap->prefix_vltime);
#endif
if ((replaced = ipv6_aliasaddr(ia, &replaced_ia)) == -1)
return -1;
if (blank)
- logdebug("%s: aliased %s", ia->alias, ia->saddr);
+ logdebugx("%s: aliased %s", ia->alias, ia->saddr);
#endif
if ((r = ipv6_addaddr1(ia, now)) == 0) {
logwarnx("%s: DAD detected %s", ia->iface->name,
ia->saddr);
else if (!wascompleted) {
- logdebug("%s: IPv6 static DAD completed",
+ logdebugx("%s: IPv6 static DAD completed",
ia->iface->name);
}
struct ipv6_addr *ia = arg, *ia1;
struct timespec tv;
- logdebug("%s: regen temp addr %s", ia->iface->name, ia->saddr);
+ logdebugx("%s: regen temp addr %s", ia->iface->name, ia->saddr);
clock_gettime(CLOCK_MONOTONIC, &tv);
ia1 = ipv6_createtempaddr(ia, &tv);
if (ia1)
struct in6_pktinfo pi;
if (ipv6_linklocal(ifp) == NULL) {
- logdebug("%s: delaying Router Solicitation for LL address",
+ logdebugx("%s: delaying Router Solicitation for LL address",
ifp->name);
ipv6_addlinklocalcallback(ifp, ipv6nd_sendrsprobe, ifp);
return;
pi.ipi6_ifindex = ifp->index;
memcpy(CMSG_DATA(cm), &pi, sizeof(pi));
- logdebug("%s: sending Router Solicitation", ifp->name);
+ logdebugx("%s: sending Router Solicitation", ifp->name);
if (sendmsg(ctx->nd_fd, &ctx->sndhdr, 0) == -1) {
logerr(__func__);
/* Allow IPv6ND to continue .... at most a few errors
IN6_IFF_TENTATIVE))
ap->flags |= IPV6_AF_DADCOMPLETED;
if ((ap->flags & IPV6_AF_DADCOMPLETED) == 0) {
- logdebug("%s: waiting for Router Advertisement"
+ logdebugx("%s: waiting for Router Advertisement"
" DAD to complete",
rap->iface->name);
return 0;
}
if (wascompleted && found) {
- logdebug("%s: Router Advertisement DAD "
+ logdebugx("%s: Router Advertisement DAD "
"completed",
rap->iface->name);
if (ipv6nd_scriptrun(rap))
if (ifp == NULL) {
#ifdef DEBUG_RS
- logdebug("RA for unexpected interface from %s",
+ logdebugx("RA for unexpected interface from %s",
ctx->sfrom);
#endif
return;
/* We could receive a RA before we sent a RS*/
if (ipv6_linklocal(ifp) == NULL) {
#ifdef DEBUG_RS
- logdebug("%s: received RA from %s (no link-local)",
+ logdebugx("%s: received RA from %s (no link-local)",
ifp->name, ctx->sfrom);
#endif
return;
}
if (ipv6_iffindaddr(ifp, &ctx->from.sin6_addr, IN6_IFF_TENTATIVE)) {
- logdebug("%s: ignoring RA from ourself %s",
+ logdebugx("%s: ignoring RA from ourself %s",
ifp->name, ctx->sfrom);
return;
}
* routers like to decrease the advertised valid and preferred times
* in accordance with the own prefix times which would result in too
* much needless log spam. */
- logfunc = new_rap ? loginfo : logdebug,
+ logfunc = new_rap ? loginfo : logdebugx,
logfunc("%s: Router Advertisement from %s",
ifp->name, ctx->sfrom);
switch (ndo.nd_opt_type) {
case ND_OPT_PREFIX_INFORMATION:
- logfunc = new_data ? logerrx : logdebug;
+ logfunc = new_data ? logerrx : logdebugx;
if (ndo.nd_opt_len != 4) {
logfunc("%s: invalid option len for prefix",
ifp->name);
LOG_DHCP6("dhcp6_start: %s", ifp->name);
} else {
if (new_data)
- logdebug("%s: No DHCPv6 instruction in RA", ifp->name);
+ logdebugx("%s: No DHCPv6 instruction in RA", ifp->name);
nodhcp6:
if (ifp->ctx->options & DHCPCD_TEST) {
eloop_exit(ifp->ctx->eloop, EXIT_SUCCESS);
if (ifp == NULL) {
#ifdef DEBUG_NS
- logdebug("NA for unexpected interface from %s",
+ logdebugx("NA for unexpected interface from %s",
ctx->sfrom);
#endif
return;
}
if (rap == NULL) {
#ifdef DEBUG_NS
- logdebug("%s: unexpected NA from %s for %s",
+ logdebugx("%s: unexpected NA from %s for %s",
ifp->name, ctx->sfrom, taddr);
#endif
return;
}
#ifdef DEBUG_NS
- logdebug("%s: %sNA for %s from %s",
+ logdebugx("%s: %sNA for %s from %s",
ifp->name, is_solicited ? "solicited " : "", taddr, ctx->sfrom);
#endif
tv.tv_nsec = (suseconds_t)arc4random_uniform(
MAX_RTR_SOLICITATION_DELAY * NSEC_PER_SEC);
timespecnorm(&tv);
- logdebug("%s: delaying IPv6 router solicitation for %0.1f seconds",
+ logdebugx("%s: delaying IPv6 router solicitation for %0.1f seconds",
ifp->name, timespec_to_double(&tv));
eloop_timeout_add_tv(ifp->ctx->eloop, &tv, ipv6nd_startrs1, ifp);
return;
{
va_list args;
+ va_start(args, fmt);
+ vlogerrmessage(LOG_DEBUG, fmt, args);
+ va_end(args);
+}
+
+void
+logdebugx(const char *fmt, ...)
+{
+ va_list args;
+
va_start(args, fmt);
vlogmessage(LOG_DEBUG, fmt, args);
va_end(args);
__printflike(1, 2) typedef void logfunc_t(const char *, ...);
__printflike(1, 2) void logdebug(const char *, ...);
+__printflike(1, 2) void logdebugx(const char *, ...);
__printflike(1, 2) void loginfo(const char *, ...);
__printflike(1, 2) void logwarn(const char *, ...);
__printflike(1, 2) void logwarnx(const char *, ...);
argv[0] = ifp->options->script ? ifp->options->script : UNCONST(SCRIPT);
argv[1] = NULL;
- logdebug("%s: executing `%s' %s", ifp->name, argv[0], reason);
+ logdebugx("%s: executing `%s' %s", ifp->name, argv[0], reason);
/* Resize for PATH and RC_SVCNAME */
svcname = getenv(RC_SVCNAME);