Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rtadvd print function names as %s: not <%s> everywh...
details: https://anonhg.NetBSD.org/src/rev/725b65cca286
branches: trunk
changeset: 953897:725b65cca286
user: christos <christos%NetBSD.org@localhost>
date: Tue Mar 23 18:16:53 2021 +0000
description:
print function names as %s: not <%s> everywhere for consistency.
diffstat:
usr.sbin/rtadvd/advcap.c | 4 +-
usr.sbin/rtadvd/config.c | 151 +++++++++++++++++++++++-----------------------
usr.sbin/rtadvd/dump.c | 6 +-
usr.sbin/rtadvd/if.c | 10 +-
usr.sbin/rtadvd/timer.c | 4 +-
5 files changed, 87 insertions(+), 88 deletions(-)
diffs (truncated from 640 to 300 lines):
diff -r 9efeb6d9c93f -r 725b65cca286 usr.sbin/rtadvd/advcap.c
--- a/usr.sbin/rtadvd/advcap.c Tue Mar 23 18:16:21 2021 +0000
+++ b/usr.sbin/rtadvd/advcap.c Tue Mar 23 18:16:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: advcap.c,v 1.18 2019/02/03 03:19:31 mrg Exp $ */
+/* $NetBSD: advcap.c,v 1.19 2021/03/23 18:16:53 christos Exp $ */
/* $KAME: advcap.c,v 1.11 2003/05/19 09:46:50 keiichi Exp $ */
/*
@@ -139,7 +139,7 @@
tf = open(RM = cp, O_RDONLY);
}
if (tf < 0) {
- logit(LOG_INFO, "<%s> open: %m", __func__);
+ logit(LOG_INFO, "%s: open `%s': %m", __func__, cp);
return (-2);
}
for (;;) {
diff -r 9efeb6d9c93f -r 725b65cca286 usr.sbin/rtadvd/config.c
--- a/usr.sbin/rtadvd/config.c Tue Mar 23 18:16:21 2021 +0000
+++ b/usr.sbin/rtadvd/config.c Tue Mar 23 18:16:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.c,v 1.45 2021/03/22 18:41:11 christos Exp $ */
+/* $NetBSD: config.c,v 1.46 2021/03/23 18:16:53 christos Exp $ */
/* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */
/*
@@ -169,44 +169,46 @@
struct rdnss *rdnss;
struct dnssl *dnssl;
-#define MUSTHAVE(var, cap) \
+#define MUSTHAVE(var, cap) \
do { \
int64_t t; \
if ((t = agetnum(cap)) < 0) { \
- fprintf(stderr, "rtadvd: need %s for interface %s\n", \
- cap, intface); \
+ logit(LOG_ERR, "%s: need %s for interface %s", \
+ __func__, cap, intface); \
goto errexit; \
} \
var = t; \
- } while (0)
-#define MAYHAVE(var, cap, def) \
+ } while (/*CONSTCOND*/0)
+
+#define MAYHAVE(var, cap, def) \
do { \
if ((var = agetnum(cap)) < 0) \
var = def; \
- } while (0)
-#define ELM_MALLOC(p) \
+ } while (/*CONSTCOND*/0)
+
+#define ELM_MALLOC(p) \
do { \
p = calloc(1, sizeof(*p)); \
if (p == NULL) { \
- logit(LOG_ERR, "<%s> calloc failed: %m", \
+ logit(LOG_ERR, "%s: calloc failed: %m", \
__func__); \
goto errexit; \
} \
} while(/*CONSTCOND*/0)
if (if_nametoindex(intface) == 0) {
- logit(LOG_INFO, "<%s> interface %s not found, ignoring",
+ logit(LOG_INFO, "%s: interface %s not found, ignoring",
__func__, intface);
return;
}
- logit(LOG_DEBUG, "<%s> loading configuration for interface %s",
+ logit(LOG_DEBUG, "%s: loading configuration for interface %s",
__func__, intface);
if ((stat = agetent(tbuf, intface)) <= 0) {
memset(tbuf, 0, sizeof(tbuf));
logit(LOG_INFO,
- "<%s> %s isn't defined in the configuration file"
+ "%s: %s isn't defined in the configuration file"
" or the configuration file doesn't exist."
" Treat it as default",
__func__, intface);
@@ -222,7 +224,7 @@
/* check if we are allowed to forward packets (if not determined) */
if (forwarding < 0) {
if ((forwarding = getinet6sysctl(IPV6CTL_FORWARDING)) < 0)
- exit(1);
+ exit(EXIT_FAILURE);
}
/* get interface information */
@@ -233,7 +235,7 @@
if (tmp->advlinkopt) {
if ((tmp->sdl = if_nametosdl(intface)) == NULL) {
logit(LOG_ERR,
- "<%s> can't get information of %s",
+ "%s: can't get information of %s",
__func__, intface);
goto errexit;
}
@@ -242,7 +244,7 @@
tmp->ifindex = if_nametoindex(intface);
if (tmp->ifindex == 0) {
logit(LOG_ERR,
- "<%s> can't get information of %s",
+ "%s: can't get information of %s",
__func__, intface);
goto errexit;
}
@@ -252,7 +254,7 @@
if ((tmp->phymtu = if_getmtu(intface)) == 0) {
tmp->phymtu = IPV6_MMTU;
logit(LOG_WARNING,
- "<%s> can't get interface mtu of %s. Treat as %d",
+ "%s: can't get interface mtu of %s. Treat as %d",
__func__, intface, IPV6_MMTU);
}
@@ -262,7 +264,7 @@
MAYHAVE(val, "maxinterval", DEF_MAXRTRADVINTERVAL);
if (val < MIN_MAXINTERVAL || val > MAX_MAXINTERVAL) {
logit(LOG_ERR,
- "<%s> maxinterval (%d) on %s is invalid "
+ "%s: maxinterval (%d) on %s is invalid "
"(must be between %u and %u)", __func__, val,
intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL);
goto errexit;
@@ -271,7 +273,7 @@
MAYHAVE(val, "mininterval", tmp->maxinterval/3);
if (val < MIN_MININTERVAL || val > (tmp->maxinterval * 3) / 4) {
logit(LOG_ERR,
- "<%s> mininterval (%d) on %s is invalid "
+ "%s: mininterval (%d) on %s is invalid "
"(must be between %u and %d)",
__func__, val, intface, MIN_MININTERVAL,
(tmp->maxinterval * 3) / 4);
@@ -282,7 +284,7 @@
MAYHAVE(val, "chlim", DEF_ADVCURHOPLIMIT);
tmp->hoplimit = val & 0xff;
- if ((flagstr = (char *)agetstr("raflags", &bp))) {
+ if ((flagstr = agetstr("raflags", &bp))) {
val = 0;
if (strchr(flagstr, 'm'))
val |= ND_RA_FLAG_MANAGED;
@@ -292,7 +294,7 @@
val |= ND_RA_FLAG_RTPREF_HIGH;
if (strchr(flagstr, 'l')) {
if ((val & ND_RA_FLAG_RTPREF_HIGH)) {
- logit(LOG_ERR, "<%s> the \'h\' and \'l\'"
+ logit(LOG_ERR, "%s: the \'h\' and \'l\'"
" router flags are exclusive", __func__);
goto errexit;
}
@@ -309,15 +311,14 @@
#endif
tmp->rtpref = val & ND_RA_FLAG_RTPREF_MASK;
if (tmp->rtpref == ND_RA_FLAG_RTPREF_RSV) {
- logit(LOG_ERR, "<%s> invalid router preference (%02x) on %s",
+ logit(LOG_ERR, "%s: invalid router preference (%02x) on %s",
__func__, tmp->rtpref, intface);
goto errexit;
}
MAYHAVE(val, "rltime", DEF_ADVROUTERLIFETIME);
if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) {
- logit(LOG_ERR,
- "<%s> router lifetime (%d) on %s is invalid "
+ logit(LOG_ERR, "%s: router lifetime (%d) on %s is invalid "
"(must be 0 or between %d and %d)",
__func__, val, intface,
tmp->maxinterval, MAXROUTERLIFETIME);
@@ -333,7 +334,7 @@
*/
if (val && forwarding == 0) {
logit(LOG_ERR,
- "<%s> non zero router lifetime is specified for %s, "
+ "%s: non zero router lifetime is specified for %s, "
"which must not be allowed for hosts. you must "
"change router lifetime or enable IPv6 forwarding.",
__func__, intface);
@@ -344,7 +345,7 @@
MAYHAVE(val, "rtime", DEF_ADVREACHABLETIME);
if (val < 0 || val > MAXREACHABLETIME) {
logit(LOG_ERR,
- "<%s> reachable time (%d) on %s is invalid "
+ "%s: reachable time (%d) on %s is invalid "
"(must be no greater than %d)",
__func__, val, intface, MAXREACHABLETIME);
goto errexit;
@@ -353,7 +354,7 @@
MAYHAVE(val64, "retrans", DEF_ADVRETRANSTIMER);
if (val64 < 0 || val64 > 0xffffffff) {
- logit(LOG_ERR, "<%s> retrans time (%lld) on %s out of range",
+ logit(LOG_ERR, "%s: retrans time (%lld) on %s out of range",
__func__, (long long)val64, intface);
goto errexit;
}
@@ -361,7 +362,7 @@
if (agetnum("hapref") != -1 || agetnum("hatime") != -1) {
logit(LOG_ERR,
- "<%s> mobile-ip6 configuration not supported",
+ "%s: mobile-ip6 configuration not supported",
__func__);
goto errexit;
}
@@ -387,7 +388,7 @@
/* allocate memory to store prefix information */
if ((pfx = calloc(1, sizeof(*pfx))) == NULL) {
logit(LOG_ERR,
- "<%s> can't allocate memory: %m",
+ "%s: can't allocate memory: %m",
__func__);
goto errexit;
}
@@ -400,27 +401,27 @@
if (inet_pton(AF_INET6, addr, &pfx->prefix) != 1) {
logit(LOG_ERR,
- "<%s> inet_pton failed for %s",
+ "%s: inet_pton failed for %s",
__func__, addr);
goto errexit;
}
if (IN6_IS_ADDR_MULTICAST(&pfx->prefix)) {
logit(LOG_ERR,
- "<%s> multicast prefix (%s) must "
+ "%s: multicast prefix (%s) must "
"not be advertised on %s",
__func__, addr, intface);
goto errexit;
}
if (IN6_IS_ADDR_LINKLOCAL(&pfx->prefix))
logit(LOG_NOTICE,
- "<%s> link-local prefix (%s) will be"
+ "%s: link-local prefix (%s) will be"
" advertised on %s",
__func__, addr, intface);
makeentry(entbuf, sizeof(entbuf), i, "prefixlen");
MAYHAVE(val, entbuf, 64);
if (val < 0 || val > 128) {
- logit(LOG_ERR, "<%s> prefixlen (%d) for %s "
+ logit(LOG_ERR, "%s: prefixlen (%d) for %s "
"on %s out of range",
__func__, val, addr, intface);
goto errexit;
@@ -444,7 +445,7 @@
makeentry(entbuf, sizeof(entbuf), i, "vltime");
MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
- logit(LOG_ERR, "<%s> vltime (%lld) for "
+ logit(LOG_ERR, "%s: vltime (%lld) for "
"%s/%d on %s is out of range",
__func__, (long long)val64,
addr, pfx->prefixlen, intface);
@@ -464,7 +465,7 @@
MAYHAVE(val64, entbuf, DEF_ADVPREFERREDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
logit(LOG_ERR,
- "<%s> pltime (%lld) for %s/%d on %s "
+ "%s: pltime (%lld) for %s/%d on %s "
"is out of range",
__func__, (long long)val64,
addr, pfx->prefixlen, intface);
@@ -486,7 +487,7 @@
MAYHAVE(val64, "mtu", 0);
if (val64 < 0 || val64 > 0xffffffff) {
logit(LOG_ERR,
- "<%s> mtu (%" PRIi64 ") on %s out of range",
+ "%s: mtu (%" PRIi64 ") on %s out of range",
__func__, val64, intface);
goto errexit;
}
@@ -500,7 +501,7 @@
}
else if (tmp->linkmtu < IPV6_MMTU || tmp->linkmtu > tmp->phymtu) {
logit(LOG_ERR,
- "<%s> advertised link mtu (%d) on %s is invalid (must "
+ "%s: advertised link mtu (%d) on %s is invalid (must "
"be between least MTU (%d) and physical link MTU (%d)",
__func__, tmp->linkmtu, intface,
IPV6_MMTU, tmp->phymtu);
@@ -532,7 +533,7 @@
TAILQ_INSERT_TAIL(&tmp->route, rti, next);
if (inet_pton(AF_INET6, addr, &rti->prefix) != 1) {
- logit(LOG_ERR, "<%s> inet_pton failed for %s",
+ logit(LOG_ERR, "%s: inet_pton failed for %s",
__func__, addr);
goto errexit;
}
@@ -546,14 +547,14 @@
MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME);
if (IN6_IS_ADDR_MULTICAST(&rti->prefix)) {
Home |
Main Index |
Thread Index |
Old Index