From: Roy Marples Date: Wed, 12 Apr 2017 10:10:20 +0000 (+0100) Subject: To be consitent, do the same to loginfo as we just did for logdebug. X-Git-Tag: v7.0.0-beta3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9efdc92f6da5c597beea5e375f60b171c3da9893;p=thirdparty%2Fdhcpcd.git To be consitent, do the same to loginfo as we just did for logdebug. --- diff --git a/src/dev.c b/src/dev.c index acd320ed..b4c56955 100644 --- a/src/dev.c +++ b/src/dev.c @@ -116,7 +116,7 @@ dev_start2(struct dhcpcd_ctx *ctx, const char *name) dlclose(h); return -1; } - loginfo("dev: loaded %s", ctx->dev->name); + loginfox("dev: loaded %s", ctx->dev->name); ctx->dev_handle = h; return r; } diff --git a/src/dhcp.c b/src/dhcp.c index 1d4dc477..1389f72c 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -1859,10 +1859,10 @@ dhcp_discover(void *arg) ifo->reboot, ipv4ll_start, ifp); #endif if (ifo->options & DHCPCD_REQUEST) - loginfo("%s: soliciting a DHCP lease (requesting %s)", + loginfox("%s: soliciting a DHCP lease (requesting %s)", ifp->name, inet_ntoa(ifo->req_addr)); else - loginfo("%s: soliciting a %s lease", + loginfox("%s: soliciting a %s lease", ifp->name, ifo->options & DHCPCD_BOOTP ? "BOOTP" : "DHCP"); send_discover(ifp); } @@ -2178,13 +2178,13 @@ dhcp_bind(struct interface *ifp) } get_lease(ifp, lease, state->new, state->new_len); if (ifo->options & DHCPCD_STATIC) { - loginfo("%s: using static address %s/%d", + loginfox("%s: using static address %s/%d", ifp->name, inet_ntoa(lease->addr), inet_ntocidr(lease->mask)); lease->leasetime = ~0U; state->reason = "STATIC"; } else if (ifo->options & DHCPCD_INFORM) { - loginfo("%s: received approval for %s", + loginfox("%s: received approval for %s", ifp->name, inet_ntoa(lease->addr)); lease->leasetime = ~0U; state->reason = "INFORM"; @@ -2195,7 +2195,7 @@ dhcp_bind(struct interface *ifp) lease->renewaltime = lease->rebindtime = lease->leasetime; - loginfo("%s: leased %s for infinity", + loginfox("%s: leased %s for infinity", ifp->name, inet_ntoa(lease->addr)); } else { if (lease->leasetime < DHCP_MIN_LEASE) { @@ -2230,7 +2230,7 @@ dhcp_bind(struct interface *ifp) ifp->name, inet_ntoa(lease->addr), lease->leasetime); else - loginfo("%s: leased %s for %"PRIu32" seconds", + loginfox("%s: leased %s for %"PRIu32" seconds", ifp->name, inet_ntoa(lease->addr), lease->leasetime); } @@ -2285,7 +2285,7 @@ dhcp_lastlease(void *arg) struct interface *ifp = arg; struct dhcp_state *state = D_STATE(ifp); - loginfo("%s: timed out contacting a DHCP server, using last lease", + loginfox("%s: timed out contacting a DHCP server, using last lease", ifp->name); dhcp_bind(ifp); /* If we forked, stop here. */ @@ -2361,7 +2361,7 @@ dhcp_arp_address(struct interface *ifp) /* Add the address now, let the kernel handle DAD. */ ipv4_addaddr(ifp, &l.addr, &l.mask, &l.brd); } else - loginfo("%s: waiting for DAD on %s", + loginfox("%s: waiting for DAD on %s", ifp->name, inet_ntoa(addr)); return 0; } @@ -2370,7 +2370,7 @@ dhcp_arp_address(struct interface *ifp) struct dhcp_lease l; get_lease(ifp, &l, state->offer, state->offer_len); - loginfo("%s: probing address %s/%d", + loginfox("%s: probing address %s/%d", ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.mask)); /* We need to handle DAD. */ arp_probe(astate); @@ -2404,7 +2404,7 @@ dhcp_static(struct interface *ifp) if (ifo->req_addr.s_addr == INADDR_ANY && (ia = ipv4_iffindaddr(ifp, NULL, NULL)) == NULL) { - loginfo("%s: waiting for 3rd party to " + loginfox("%s: waiting for 3rd party to " "configure IP address", ifp->name); state->reason = "3RDPARTY"; script_runreason(ifp, state->reason); @@ -2440,7 +2440,7 @@ dhcp_inform(struct interface *ifp) if (ifo->req_addr.s_addr == INADDR_ANY) { ia = ipv4_iffindaddr(ifp, NULL, NULL); if (ia == NULL) { - loginfo("%s: waiting for 3rd party to " + loginfox("%s: waiting for 3rd party to " "configure IP address", ifp->name); if (!(ifp->ctx->options & DHCPCD_TEST)) { @@ -2515,7 +2515,7 @@ dhcp_reboot(struct interface *ifp) state->interval = 0; if (ifo->options & DHCPCD_LINK && ifp->carrier == LINK_DOWN) { - loginfo("%s: waiting for carrier", ifp->name); + loginfox("%s: waiting for carrier", ifp->name); return; } if (ifo->options & DHCPCD_STATIC) { @@ -2523,7 +2523,7 @@ dhcp_reboot(struct interface *ifp) return; } if (ifo->options & DHCPCD_INFORM) { - loginfo("%s: informing address of %s", + loginfox("%s: informing address of %s", ifp->name, inet_ntoa(state->lease.addr)); dhcp_inform(ifp); return; @@ -2535,7 +2535,7 @@ dhcp_reboot(struct interface *ifp) if (!IS_DHCP(state->offer)) return; - loginfo("%s: rebinding lease of %s", + loginfox("%s: rebinding lease of %s", ifp->name, inet_ntoa(state->lease.addr)); dhcp_new_xid(ifp); state->lease.server.s_addr = 0; @@ -2593,7 +2593,7 @@ dhcp_drop(struct interface *ifp, const char *reason) state->new != NULL && state->lease.server.s_addr != INADDR_ANY) { - loginfo("%s: releasing lease of %s", + loginfox("%s: releasing lease of %s", ifp->name, inet_ntoa(state->lease.addr)); dhcp_new_xid(ifp); send_message(ifp, DHCP_RELEASE, NULL); @@ -2795,7 +2795,7 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len, logdebugx("%s: validated using 0x%08" PRIu32, ifp->name, state->auth.token->secretid); else - loginfo("%s: accepted reconfigure key", ifp->name); + loginfox("%s: accepted reconfigure key", ifp->name); } else if (ifo->auth.options & DHCPCD_AUTH_SEND) { if (ifo->auth.options & DHCPCD_AUTH_REQUIRE) { LOGDHCP0(logerrx, "no authentication"); @@ -2823,7 +2823,7 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len, LOGDHCP(logdebugx, "not bound, ignoring Force Renew"); return; } - LOGDHCP(loginfo, "Force Renew from"); + LOGDHCP(loginfox, "Force Renew from"); /* The rebind and expire timings are still the same, we just * enter the renew state early */ if (state->state == DHS_BOUND) @@ -3016,7 +3016,7 @@ dhcp_handledhcp(struct interface *ifp, struct bootp *bootp, size_t bootp_len, goto rapidcommit; } - LOGDHCP(loginfo, "offered"); + LOGDHCP(loginfox, "offered"); if (state->offer_len < bootp_len) { free(state->offer); if ((state->offer = malloc(bootp_len)) == NULL) { @@ -3735,7 +3735,7 @@ dhcp_handleifa(int cmd, struct ipv4_addr *ia) if (cmd == RTM_DELADDR) { if (state->addr == ia) { - loginfo("%s: deleted IP address %s", + loginfox("%s: deleted IP address %s", ifp->name, ia->saddr); state->addr = NULL; /* Don't clear the added state as we need diff --git a/src/dhcp6.c b/src/dhcp6.c index be7f24fb..e2588069 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -1440,7 +1440,7 @@ dhcp6_startdiscover(void *arg) #ifndef SMALL dhcp6_delete_delegates(ifp); #endif - loginfo("%s: soliciting a DHCPv6 lease", ifp->name); + loginfox("%s: soliciting a DHCPv6 lease", ifp->name); state = D6_STATE(ifp); state->state = DH6S_DISCOVER; state->RTC = 0; @@ -1543,7 +1543,7 @@ dhcp6_startrebind(void *arg) if (state->state == DH6S_RENEW) logwarnx("%s: failed to renew DHCPv6, rebinding", ifp->name); else - loginfo("%s: rebinding prior DHCPv6 lease", ifp->name); + loginfox("%s: rebinding prior DHCPv6 lease", ifp->name); state->state = DH6S_REBIND; state->RTC = 0; state->MRC = 0; @@ -1611,7 +1611,7 @@ dhcp6_startconfirm(struct interface *ifp) state->MRT = CNF_MAX_RT; state->MRC = 0; - loginfo("%s: confirming prior DHCPv6 lease", ifp->name); + loginfox("%s: confirming prior DHCPv6 lease", ifp->name); if (dhcp6_makemessage(ifp) == -1) { logerr("%s: %s", __func__, ifp->name); return; @@ -1630,7 +1630,7 @@ dhcp6_startinform(void *arg) ifp = arg; state = D6_STATE(ifp); if (state->new == NULL || ifp->options->options & DHCPCD_DEBUG) - loginfo("%s: requesting DHCPv6 information", ifp->name); + loginfox("%s: requesting DHCPv6 information", ifp->name); state->state = DH6S_INFORM; state->RTC = 0; state->IMD = INF_MAX_DELAY; @@ -2330,7 +2330,7 @@ auth: logdebugx("%s: validated using 0x%08" PRIu32, ifp->name, state->auth.token->secretid); else - loginfo("%s: accepted reconfigure key", ifp->name); + loginfox("%s: accepted reconfigure key", ifp->name); } else if ((ifp->options->auth.options & DHCPCD_AUTH_SENDREQUIRE) == DHCPCD_AUTH_SENDREQUIRE) { @@ -2567,7 +2567,7 @@ dhcp6_delegate_prefix(struct interface *ifp) logfunc_t *logfunc; if (ap->flags & IPV6_AF_NEW) - logfunc = loginfo; + logfunc = loginfox; else logfunc = logdebugx; /* We only want to log this the once as we loop @@ -2684,7 +2684,7 @@ dhcp6_find_delegates(struct interface *ifp) } if (k) { - loginfo("%s: adding delegated prefixes", ifp->name); + loginfox("%s: adding delegated prefixes", ifp->name); state = D6_STATE(ifp); state->state = DH6S_DELEGATED; ipv6_addaddrs(&state->addrs); @@ -2856,7 +2856,7 @@ dhcp6_handledata(void *arg) logdebugx("%s: validated using 0x%08" PRIu32, ifp->name, state->auth.token->secretid); else - loginfo("%s: accepted reconfigure key", ifp->name); + loginfox("%s: accepted reconfigure key", ifp->name); } else if (ifo->auth.options & DHCPCD_AUTH_SEND) { if (ifo->auth.options & DHCPCD_AUTH_REQUIRE) { logerr("%s: no authentication from %s", @@ -2984,7 +2984,7 @@ dhcp6_handledata(void *arg) return; #ifdef AUTH } - loginfo("%s: %s from %s", ifp->name, op, ctx->sfrom); + loginfox("%s: %s from %s", ifp->name, op, ctx->sfrom); o = dhcp6_findmoption(r, len, D6_OPTION_RECONF_MSG, &ol); if (o == NULL) { logerrx("%s: missing Reconfigure Message option", @@ -3054,7 +3054,7 @@ dhcp6_handledata(void *arg) } if (ap == NULL) ap = TAILQ_FIRST(&state->addrs); - loginfo("%s: ADV %s from %s", ifp->name, ap->saddr, ctx->sfrom); + loginfox("%s: ADV %s from %s", ifp->name, ap->saddr, ctx->sfrom); if (ifp->ctx->options & DHCPCD_TEST) break; dhcp6_startrequest(ifp); @@ -3068,7 +3068,7 @@ dhcp6_handledata(void *arg) break; } } - lognewinfo = has_new ? loginfo : logdebugx; + lognewinfo = has_new ? loginfox : logdebugx; lognewinfo("%s: %s received from %s", ifp->name, op, ctx->sfrom); state->reason = NULL; @@ -3285,7 +3285,7 @@ dhcp6_activateinterfaces(struct interface *ifp) continue; } if (!ifd->active) { - loginfo("%s: activating for delegation", + loginfox("%s: activating for delegation", sla->ifname); dhcpcd_activateinterface(ifd, DHCPCD_IPV6 | DHCPCD_DHCP6); diff --git a/src/dhcpcd.c b/src/dhcpcd.c index aafe1a73..2f0bae11 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -294,7 +294,7 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) } if (ctx->options & DHCPCD_ONESHOT) { - loginfo("exiting due to oneshot"); + loginfox("exiting due to oneshot"); eloop_exit(ctx->eloop, EXIT_SUCCESS); return 0; } @@ -351,7 +351,7 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) if (read(sidpipe[0], &buf, 1) == -1) logerr("%s: read", __func__); close(sidpipe[0]); - loginfo("forked to background, child pid %d", pid); + loginfox("forked to background, child pid %d", pid); ctx->options |= DHCPCD_FORKED; eloop_exit(ctx->eloop, EXIT_SUCCESS); return pid; @@ -377,7 +377,7 @@ stop_interface(struct interface *ifp) struct dhcpcd_ctx *ctx; ctx = ifp->ctx; - loginfo("%s: removing interface", ifp->name); + loginfox("%s: removing interface", ifp->name); ifp->options->options |= DHCPCD_STOPPING; dhcpcd_drop(ifp, 1); @@ -562,7 +562,7 @@ dhcpcd_selectprofile(struct interface *ifp, const char *profile) } if (profile != NULL) { strlcpy(ifp->profile, profile, sizeof(ifp->profile)); - loginfo("%s: selected profile %s", ifp->name, profile); + loginfox("%s: selected profile %s", ifp->name, profile); } else *ifp->profile = '\0'; @@ -700,7 +700,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags, } else if (carrier == LINK_DOWN || (ifp->flags & IFF_UP) == 0) { if (ifp->carrier != LINK_DOWN) { if (ifp->carrier == LINK_UP) - loginfo("%s: carrier lost", ifp->name); + loginfox("%s: carrier lost", ifp->name); ifp->carrier = LINK_DOWN; script_runreason(ifp, "NOCARRIER"); #ifdef NOCARRIER_PRESERVE_IP @@ -715,7 +715,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags, } } else if (carrier == LINK_UP && ifp->flags & IFF_UP) { if (ifp->carrier != LINK_UP) { - loginfo("%s: carrier acquired", ifp->name); + loginfox("%s: carrier acquired", ifp->name); ifp->carrier = LINK_UP; #if !defined(__linux__) && !defined(__NetBSD__) /* BSD does not emit RTM_NEWADDR or RTM_CHGADDR when the @@ -794,7 +794,7 @@ dhcpcd_startinterface(void *arg) case LINK_UP: break; case LINK_DOWN: - loginfo("%s: waiting for carrier", ifp->name); + loginfox("%s: waiting for carrier", ifp->name); return; case LINK_UNKNOWN: /* No media state available. @@ -816,7 +816,7 @@ dhcpcd_startinterface(void *arg) if (ifp->ctx->duid == NULL) { if (duid_init(ifp) == 0) return; - loginfo("DUID %s", + loginfox("DUID %s", hwaddr_ntoa(ifp->ctx->duid, ifp->ctx->duid_len, buf, sizeof(buf))); @@ -825,7 +825,7 @@ dhcpcd_startinterface(void *arg) if (ifo->options & (DHCPCD_DUID | DHCPCD_IPV6)) { /* Report IAIDs */ - loginfo("%s: IAID %s", ifp->name, + loginfox("%s: IAID %s", ifp->name, hwaddr_ntoa(ifo->iaid, sizeof(ifo->iaid), buf, sizeof(buf))); warn_iaid_conflict(ifp, ifo->iaid); @@ -833,7 +833,7 @@ dhcpcd_startinterface(void *arg) if (memcmp(ifo->iaid, ifo->ia[i].iaid, sizeof(ifo->iaid))) { - loginfo("%s: IAID %s", + loginfox("%s: IAID %s", ifp->name, hwaddr_ntoa(ifo->ia[i].iaid, sizeof(ifo->ia[i].iaid), buf, sizeof(buf))); @@ -914,7 +914,7 @@ dhcpcd_prestartinterface(void *arg) ifp->flags, ifp->name); return; } - loginfo("%s: unknown carrier, waiting for interface flags", + loginfox("%s: unknown carrier, waiting for interface flags", ifp->name); } @@ -1070,7 +1070,7 @@ dhcpcd_handlehwaddr(struct dhcpcd_ctx *ctx, const char *ifname, if (ifp->hwlen == hwlen && memcmp(ifp->hwaddr, hwaddr, hwlen) == 0) return; - loginfo("%s: new hardware address: %s", ifp->name, + loginfox("%s: new hardware address: %s", ifp->name, hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf))); ifp->hwlen = hwlen; memcpy(ifp->hwaddr, hwaddr, hwlen); @@ -1193,19 +1193,19 @@ signal_cb(int sig, void *arg) exit_code = EXIT_FAILURE; switch (sig) { case SIGINT: - loginfo(sigmsg, "SIGINT", "stopping"); + loginfox(sigmsg, "SIGINT", "stopping"); break; case SIGTERM: - loginfo(sigmsg, "SIGTERM", "stopping"); + loginfox(sigmsg, "SIGTERM", "stopping"); exit_code = EXIT_SUCCESS; break; case SIGALRM: - loginfo(sigmsg, "SIGALRM", "releasing"); + loginfox(sigmsg, "SIGALRM", "releasing"); opts |= DHCPCD_RELEASE; exit_code = EXIT_SUCCESS; break; case SIGHUP: - loginfo(sigmsg, "SIGHUP", "rebinding"); + loginfox(sigmsg, "SIGHUP", "rebinding"); reload_config(ctx); /* Preserve any options passed on the commandline * when we were started. */ @@ -1213,11 +1213,11 @@ signal_cb(int sig, void *arg) ctx->argc - ctx->ifc); return; case SIGUSR1: - loginfo(sigmsg, "SIGUSR1", "renewing"); + loginfox(sigmsg, "SIGUSR1", "renewing"); dhcpcd_renew(ctx); return; case SIGUSR2: - loginfo(sigmsg, "SIGUSR2", "reopening log"); + loginfox(sigmsg, "SIGUSR2", "reopening log"); logclose(); if (logopen(ctx->logfile) == -1) logerr(__func__); @@ -1322,7 +1322,7 @@ dhcpcd_handleargs(struct dhcpcd_ctx *ctx, struct fd_list *fd, *p++ = ' '; } *--p = '\0'; - loginfo("control command: %s", tmp); + loginfox("control command: %s", tmp); free(tmp); optind = 0; @@ -1718,7 +1718,7 @@ printpidfile: if (ctx.control_fd == -1) ctx.control_fd = control_open(NULL); if (ctx.control_fd != -1) { - loginfo("sending commands to master dhcpcd process"); + loginfox("sending commands to master dhcpcd process"); len = control_send(&ctx, argc, argv); control_close(&ctx); if (len > 0) { @@ -1740,7 +1740,7 @@ printpidfile: if (sig != 0) { pid = pidfile_read(ctx.pidfile); if (pid != 0 && pid != -1) - loginfo("sending signal %s to pid %d", siga, pid); + loginfox("sending signal %s to pid %d", siga, pid); if (pid == 0 || pid == -1 || kill(pid, sig) != 0) { if (sig != SIGHUP && sig != SIGUSR1 && errno != EPERM) logerrx(PACKAGE" not running"); @@ -1757,7 +1757,7 @@ printpidfile: if (sig == SIGHUP || sig == SIGUSR1) goto exit_success; /* Spin until it exits */ - loginfo("waiting for pid %d to exit", pid); + loginfox("waiting for pid %d to exit", pid); ts.tv_sec = 0; ts.tv_nsec = 100000000; /* 10th of a second */ for(i = 0; i < 100; i++) { @@ -1964,7 +1964,7 @@ exit1: free(ctx.iov[0].iov_base); if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) - loginfo(PACKAGE " exited"); + loginfox(PACKAGE " exited"); logclose(); #ifdef USE_SIGNALS if (ctx.options & DHCPCD_FORKED) diff --git a/src/ipv4.c b/src/ipv4.c index e549f474..50c52426 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -749,13 +749,13 @@ ipv4_applyaddr(void *arg) nstate->addr->addr.s_addr == lease->addr.s_addr) { if (r == 0) { - loginfo("%s: preferring %s on %s", + loginfox("%s: preferring %s on %s", ifp->name, inet_ntoa(lease->addr), ifn->name); return; } - loginfo("%s: preferring %s on %s", + loginfox("%s: preferring %s on %s", ifn->name, inet_ntoa(lease->addr), ifp->name); diff --git a/src/ipv4ll.c b/src/ipv4ll.c index b7d3ca68..12ea2a71 100644 --- a/src/ipv4ll.c +++ b/src/ipv4ll.c @@ -189,7 +189,7 @@ ipv4ll_probed(struct arp_state *astate) #ifdef IN_IFF_NOTREADY if (ia == NULL || ia->addr_flags & IN_IFF_NOTREADY) #endif - loginfo("%s: using IPv4LL address %s", + loginfox("%s: using IPv4LL address %s", ifp->name, inet_ntoa(astate->addr)); if (ia == NULL) { if (ifp->ctx->options & DHCPCD_TEST) @@ -406,17 +406,17 @@ ipv4ll_start(void *arg) astate->addr = ia->addr; #ifdef IN_IFF_TENTATIVE if (ia->addr_flags & (IN_IFF_TENTATIVE | IN_IFF_DETACHED)) { - loginfo("%s: waiting for DAD to complete on %s", + loginfox("%s: waiting for DAD to complete on %s", ifp->name, inet_ntoa(ia->addr)); return; } - loginfo("%s: using IPv4LL address %s", ifp->name, ia->saddr); + loginfox("%s: using IPv4LL address %s", ifp->name, ia->saddr); #endif ipv4ll_probed(astate); return; } - loginfo("%s: probing for an IPv4LL address", ifp->name); + loginfox("%s: probing for an IPv4LL address", ifp->name); astate->addr.s_addr = ipv4ll_pickaddr(astate); #ifdef IN_IFF_TENTATIVE ipv4ll_probed(astate); diff --git a/src/ipv6.c b/src/ipv6.c index b7986140..d57354f3 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -584,7 +584,7 @@ ipv6_deleteaddr(struct ipv6_addr *ia) struct ipv6_state *state; struct ipv6_addr *ap; - loginfo("%s: deleting address %s", ia->iface->name, ia->saddr); + loginfox("%s: deleting address %s", ia->iface->name, ia->saddr); if (if_address6(RTM_DELADDR, ia) == -1 && errno != EADDRNOTAVAIL && errno != ESRCH && errno != ENXIO && errno != ENODEV) @@ -635,7 +635,7 @@ ipv6_addaddr1(struct ipv6_addr *ap, const struct timespec *now) ipv6_iffindaddr(ap->iface, &ap->addr, IN6_IFF_NOTUSEABLE)) ap->flags |= IPV6_AF_DADCOMPLETED; - logfunc = ap->flags & IPV6_AF_NEW ? loginfo : logdebugx; + logfunc = ap->flags & IPV6_AF_NEW ? loginfox : logdebugx; logfunc("%s: adding %saddress %s", ap->iface->name, #ifdef IPV6_AF_TEMPORARY ap->flags & IPV6_AF_TEMPORARY ? "temporary " : "", @@ -913,13 +913,13 @@ ipv6_addaddrs(struct ipv6_addrhead *addrs) &ap->addr, IPV6_AF_ADDED); if (apf && apf->iface != ap->iface) { if (apf->iface->metric <= ap->iface->metric) { - loginfo("%s: preferring %s on %s", + loginfox("%s: preferring %s on %s", ap->iface->name, ap->saddr, apf->iface->name); continue; } - loginfo("%s: preferring %s on %s", + loginfox("%s: preferring %s on %s", apf->iface->name, ap->saddr, ap->iface->name); @@ -1048,7 +1048,7 @@ ipv6_handleifa(struct dhcpcd_ctx *ctx, dbp = inet_ntop(AF_INET6, &addr->s6_addr, dbuf, INET6_ADDRSTRLEN); - loginfo("%s: cmd %d addr %s", + loginfox("%s: cmd %d addr %s", ifname, cmd, dbp); #endif @@ -1672,7 +1672,7 @@ ipv6_handleifa_addrs(int cmd, switch (cmd) { case RTM_DELADDR: if (ia->flags & IPV6_AF_ADDED) { - loginfo("%s: deleted address %s", + logwarnx("%s: deleted address %s", ia->iface->name, ia->saddr); ia->flags &= ~IPV6_AF_ADDED; } diff --git a/src/ipv6nd.c b/src/ipv6nd.c index e46196ca..dbae9b79 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -362,7 +362,7 @@ ipv6nd_reachable(struct ra *rap, int flags) if (flags & IPV6ND_REACHABLE) { if (rap->lifetime && rap->expired) { - loginfo("%s: %s is reachable again", + loginfox("%s: %s is reachable again", rap->iface->name, rap->sfrom); rap->expired = 0; rt_build(rap->iface->ctx, AF_INET6); @@ -639,7 +639,7 @@ ipv6nd_dadcallback(void *arg) ifp->name); goto try_script; } - loginfo("%s: deleting address %s", + loginfox("%s: deleting address %s", ifp->name, ap->saddr); if (if_address6(RTM_DELADDR, ap) == -1 && errno != EADDRNOTAVAIL && errno != ENXIO) @@ -836,7 +836,7 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx, struct interface *ifp, * 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 : logdebugx, + logfunc = new_rap ? loginfox : logdebugx, logfunc("%s: Router Advertisement from %s", ifp->name, ctx->sfrom); @@ -1508,7 +1508,7 @@ ipv6nd_handlena(struct dhcpcd_ctx *ctx, struct interface *ifp, /* Node is no longer a router, so remove it from consideration */ if (!is_router && !rap->expired) { - loginfo("%s: %s not a router (%s)", + loginfox("%s: %s not a router (%s)", ifp->name, taddr, ctx->sfrom); rap->expired = 1; rt_build(ifp->ctx, AF_INET6); @@ -1519,7 +1519,7 @@ ipv6nd_handlena(struct dhcpcd_ctx *ctx, struct interface *ifp, if (is_solicited && is_router && rap->lifetime) { if (rap->expired) { rap->expired = 0; - loginfo("%s: %s reachable (%s)", + loginfox("%s: %s reachable (%s)", ifp->name, taddr, ctx->sfrom); rt_build(ifp->ctx, AF_INET6); script_runreason(rap->iface, "ROUTERADVERT"); /* XXX */ @@ -1614,7 +1614,7 @@ ipv6nd_startrs1(void *arg) struct interface *ifp = arg; struct rs_state *state; - loginfo("%s: soliciting an IPv6 router", ifp->name); + loginfox("%s: soliciting an IPv6 router", ifp->name); if (ipv6nd_open(ifp->ctx) == -1) { logerr(__func__); return; diff --git a/src/logerr.c b/src/logerr.c index 1be66484..b5b2422f 100644 --- a/src/logerr.c +++ b/src/logerr.c @@ -245,6 +245,16 @@ loginfo(const char *fmt, ...) { va_list args; + va_start(args, fmt); + vlogerrmessage(LOG_INFO, fmt, args); + va_end(args); +} + +void +loginfox(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); vlogmessage(LOG_INFO, fmt, args); va_end(args); diff --git a/src/logerr.h b/src/logerr.h index ff22483f..0926385d 100644 --- a/src/logerr.h +++ b/src/logerr.h @@ -43,6 +43,7 @@ __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 loginfox(const char *, ...); __printflike(1, 2) void logwarn(const char *, ...); __printflike(1, 2) void logwarnx(const char *, ...); __printflike(1, 2) void logerr(const char *, ...); diff --git a/src/route.c b/src/route.c index e3e82cee..4cd26713 100644 --- a/src/route.c +++ b/src/route.c @@ -74,27 +74,27 @@ rt_desc(const char *cmd, const struct rt *rt) if (rt->rt_flags & RTF_HOST) { if (gateway_unspec) - loginfo("%s: %s host route to %s", + loginfox("%s: %s host route to %s", ifname, cmd, dest); else - loginfo("%s: %s host route to %s via %s", + loginfox("%s: %s host route to %s via %s", ifname, cmd, dest, gateway); } else if (sa_is_unspecified(&rt->rt_dest) && sa_is_unspecified(&rt->rt_netmask)) { if (gateway_unspec) - loginfo("%s: %s default route", + loginfox("%s: %s default route", ifname, cmd); else - loginfo("%s: %s default route via %s", + loginfox("%s: %s default route via %s", ifname, cmd, gateway); } else if (gateway_unspec) - loginfo("%s: %s%s route to %s/%d", + loginfox("%s: %s%s route to %s/%d", ifname, cmd, rt->rt_flags & RTF_REJECT ? " reject" : "", dest, prefix); else - loginfo("%s: %s%s route to %s/%d via %s", + loginfox("%s: %s%s route to %s/%d via %s", ifname, cmd, rt->rt_flags & RTF_REJECT ? " reject" : "", dest, prefix, gateway);