-/* $OpenBSD: engine.c,v 1.1 2017/06/03 10:00:29 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.2 2017/07/03 19:02:04 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
memcpy(&if_index, imsg.data, sizeof(if_index));
iface = get_slaacd_iface_by_id(if_index);
if (iface == NULL)
- log_warn("requested to send solicitation on "
+ log_warnx("requested to send solicitation on "
"non-autoconf interface: %u", if_index);
else
engine_imsg_compose_frontend(
cei_ra.other = ra->other;
if (strlcpy(cei_ra.rpref, rpref_name[ra->rpref], sizeof(
cei_ra.rpref)) >= sizeof(cei_ra.rpref))
- log_warn("truncated router preference");
+ log_warnx("truncated router preference");
cei_ra.router_lifetime = ra->router_lifetime;
cei_ra.reachable_time = ra->reachable_time;
cei_ra.retrans_time = ra->retrans_time;
proposal_state_name[addr_proposal->state],
sizeof(cei_addr_proposal.state)) >=
sizeof(cei_addr_proposal.state))
- log_warn("truncated state name");
+ log_warnx("truncated state name");
cei_addr_proposal.next_timeout = addr_proposal->next_timeout;
cei_addr_proposal.timeout_count = addr_proposal->timeout_count;
cei_addr_proposal.when = addr_proposal->when;
proposal_state_name[dfr_proposal->state],
sizeof(cei_dfr_proposal.state)) >=
sizeof(cei_dfr_proposal.state))
- log_warn("truncated state name");
+ log_warnx("truncated state name");
cei_dfr_proposal.next_timeout = dfr_proposal->next_timeout;
cei_dfr_proposal.timeout_count = dfr_proposal->timeout_count;
cei_dfr_proposal.when = dfr_proposal->when;
rpref_name[dfr_proposal->rpref],
sizeof(cei_dfr_proposal.rpref)) >=
sizeof(cei_dfr_proposal.rpref))
- log_warn("truncated router preference");
+ log_warnx("truncated router preference");
engine_imsg_compose_frontend(
IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSAL, pid,
&cei_dfr_proposal, sizeof(cei_dfr_proposal));
if (getnameinfo((struct sockaddr *)&ra->from, ra->from.sin6_len, hbuf,
sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
if (!IN6_IS_ADDR_LINKLOCAL(&ra->from.sin6_addr)) {
- log_warn("RA from non link local address %s", hbuf);
+ log_warnx("RA from non link local address %s", hbuf);
return;
}
if ((size_t)len < sizeof(struct nd_router_advert)) {
- log_warn("received too short message (%ld) from %s", len, hbuf);
+ log_warnx("received too short message (%ld) from %s", len,
+ hbuf);
return;
}
}
if (nd_ra->nd_ra_code != 0) {
- log_warn("invalid ICMPv6 code (%d) from %s", nd_ra->nd_ra_code,
+ log_warnx("invalid ICMPv6 code (%d) from %s", nd_ra->nd_ra_code,
hbuf);
goto err;
}
switch (nd_opt_hdr->nd_opt_type) {
case ND_OPT_PREFIX_INFORMATION:
if (nd_opt_hdr->nd_opt_len != 4) {
- log_warn("invalid ND_OPT_PREFIX_INFORMATION: "
+ log_warnx("invalid ND_OPT_PREFIX_INFORMATION: "
"len != 4");
goto err;
}
if (strlcpy(ra_dnssl->dnssl, nssl,
sizeof(ra_dnssl->dnssl)) >=
sizeof(ra_dnssl->dnssl)) {
- log_warn("dnssl too long");
+ log_warnx("dnssl too long");
goto err;
}
free(nssl);
if (getnameinfo((struct sockaddr *)&ra->from, ra->from.sin6_len, hbuf,
sizeof(hbuf), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
if (!IN6_IS_ADDR_LINKLOCAL(&ra->from.sin6_addr)) {
- log_warn("RA from non link local address %s", hbuf);
+ log_warnx("RA from non link local address %s", hbuf);
return;
}
if ((size_t)len < sizeof(struct nd_router_advert)) {
- log_warn("received too short message (%ld) from %s", len, hbuf);
+ log_warnx("received too short message (%ld) from %s", len,
+ hbuf);
return;
}
}
if (nd_ra->nd_ra_code != 0) {
- log_warn("invalid ICMPv6 code (%d) from %s", nd_ra->nd_ra_code,
+ log_warnx("invalid ICMPv6 code (%d) from %s", nd_ra->nd_ra_code,
hbuf);
return;
}
break;
case ND_OPT_PREFIX_INFORMATION:
if (nd_opt_hdr->nd_opt_len != 4) {
- log_warn("invalid ND_OPT_PREFIX_INFORMATION: "
+ log_warnx("invalid ND_OPT_PREFIX_INFORMATION: "
"len != 4");
return;
}
break;
case ND_OPT_MTU:
if (nd_opt_hdr->nd_opt_len != 1) {
- log_warn("invalid ND_OPT_MTU: len != 1");
+ log_warnx("invalid ND_OPT_MTU: len != 1");
return;
}
mtu = (struct nd_opt_mtu*) nd_opt_hdr;
if (real_lifetime(&dfr_proposal->uptime,
dfr_proposal->router_lifetime) >=
ra->router_lifetime)
- log_warn("ignoring router advertisement"
- " that lowers router lifetime");
+ log_warnx("ignoring router "
+ "advertisement that lowers router "
+ "lifetime");
else {
dfr_proposal->when = ra->when;
dfr_proposal->uptime = ra->uptime;
sizeof(hbuf), NULL, 0,
NI_NUMERICHOST |
NI_NUMERICSERV)) {
- log_warn("cannot get "
+ log_warnx("cannot get "
"proposal IP");
strlcpy(hbuf, "unknown",
sizeof(hbuf));
if (real_lifetime(&addr_proposal->uptime,
addr_proposal->vltime) >= prefix->vltime) {
- log_warn("ignoring router advertisement"
- " that lowers vltime");
+ log_warnx("ignoring router "
+ "advertisement that lowers vltime");
continue;
}
addr_proposal->addr.sin6_len, hbuf,
sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get proposal "
+ log_warnx("cannot get proposal "
"IP");
strlcpy(hbuf, "unknown",
sizeof(hbuf));
if (getnameinfo((struct sockaddr *)&addr_proposal->addr,
addr_proposal->addr.sin6_len, hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
log_debug("%s: iface %d: %s: %lld s", __func__,
if (getnameinfo((struct sockaddr *)&dfr_proposal->addr,
dfr_proposal->addr.sin6_len, hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
log_debug("%s: iface %d: %s: %lld s", __func__,
if (getnameinfo((struct sockaddr *)&addr_proposal->addr,
addr_proposal->addr.sin6_len, hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
log_debug("%s: iface %d: %s [%s], priv: %s", __func__,
if (getnameinfo((struct sockaddr *)&dfr_proposal->addr,
dfr_proposal->addr.sin6_len, hbuf, sizeof(hbuf), NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV)) {
- log_warn("cannot get router IP");
+ log_warnx("cannot get router IP");
strlcpy(hbuf, "unknown", sizeof(hbuf));
}
log_debug("%s: iface %d: %s [%s]", __func__, dfr_proposal->if_index,