Pull up following revision(s) (requested by ozaki-r in ticket #358):

usr.sbin/rtadvd/rtadvd.c: revision 1.54-1.58
	usr.sbin/rtadvd/config.c: revision 1.37
	usr.sbin/rtadvd/if.c: revision 1.25
	usr.sbin/rtadvd/dump.c: revision 1.15
	usr.sbin/rtadvd/rrenum.c: revision 1.20
	usr.sbin/rtadvd/logit.h: revision 1.1
	usr.sbin/rtadvd/rtadvd.8: revision 1.26
	tests/net/ndp/t_ra.sh: revision 1.30
	usr.sbin/rtadvd/timer.c: revision 1.14
	tests/net/ndp/t_ra.sh: revision 1.31
	usr.sbin/rtadvd/advcap.c: revision 1.17

KNF, fix time printing formats.

Don't start another copy of rtadvd if one is running.

PR/52618: Shinichi Doyashiki: Don't exit if adding interface to multicast
group fails. This happens with empty vlan interfaces
- make syscalls checks against -1
- fix errors to print %s: instead of <%s>
XXX: if_vlan is the only pseudo interface in net/ that returns such an
error..

Kill rtadvd surely even if the tests fail in the middle
It may help PR bin/52701.

Change the meaning of the D flag to print errors to stderr instead of
syslog(3) and exit if poll(2) fails (intended to be used with unit-tests).

Mark expandm as preserving format strings.

Let rtadvd not use syslog for logging
Thanks to christos@ now rtadvd can log via stderr instead of syslog
by -D option.
Address PR bin/52701
This commit is contained in:
martin 2017-11-21 10:54:18 +00:00
parent 8110923119
commit 3c11e1583d
10 changed files with 444 additions and 404 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: t_ra.sh,v 1.27.2.1 2017/07/07 13:57:26 martin Exp $
# $NetBSD: t_ra.sh,v 1.27.2.2 2017/11/21 10:54:19 martin Exp $
#
# Copyright (c) 2015 Internet Initiative Japan Inc.
# All rights reserved.
@ -85,6 +85,34 @@ wait_term()
return 0
}
kill_rtadvd()
{
local pidfile=$1
kill -KILL `cat $pidfile`
rm -f $pidfile
}
terminate_rtadvd()
{
local pidfile=$1
local n=5
if [ ! -f $pidfile ]; then
return
fi
kill -TERM `cat $pidfile`
while [ -f $pidfile ]; do
n=$((n - 1))
if [ $n = 0 ]; then
kill_rtadvd $pidfile
break
fi
sleep 0.2
done
}
create_rtadvdconfig()
{
@ -123,7 +151,8 @@ start_rtadvd()
local pidfile=$2
export RUMP_SERVER=$sock
atf_check -s exit:0 rump.rtadvd -c ${CONFIG} -p $pidfile shmif0
atf_check -s exit:0 -e ignore \
rump.rtadvd -D -c ${CONFIG} -p $pidfile shmif0
while [ ! -f $pidfile ]; do
sleep 0.2
done
@ -203,8 +232,7 @@ ra_basic_body()
atf_check -s exit:0 -o not-match:'fc00:1:' rump.ifconfig shmif0 inet6
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
terminate_rtadvd $PIDFILE
export RUMP_SERVER=${RUMPCLI}
atf_check -s exit:0 -o match:'0.->.1' rump.sysctl -w net.inet6.ip6.accept_rtadv=1
@ -215,8 +243,7 @@ ra_basic_body()
check_entries $RUMPCLI $RUMPSRV $IP6SRV_PREFIX
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
terminate_rtadvd $PIDFILE
rump_server_destroy_ifaces
}
@ -224,12 +251,8 @@ ra_basic_body()
ra_basic_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -267,7 +290,7 @@ ra_flush_prefix_entries_body()
# Terminate rtadvd to prevent new RA messages from coming
# Note that ifconfig down; kill -TERM doesn't work
kill -KILL `cat ${PIDFILE}`
kill_rtadvd $PIDFILE
# Flush all the entries in the prefix list
atf_check -s exit:0 rump.ndp -P
@ -288,6 +311,7 @@ ra_flush_prefix_entries_cleanup()
{
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -325,7 +349,7 @@ ra_flush_defrouter_entries_body()
# Terminate rtadvd to prevent new RA messages from coming
# Note that ifconfig down; kill -TERM doesn't work
kill -KILL `cat ${PIDFILE}`
kill_rtadvd $PIDFILE
# Flush all the entries in the default router list
atf_check -s exit:0 rump.ndp -R
@ -345,6 +369,7 @@ ra_flush_defrouter_entries_cleanup()
{
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -384,8 +409,7 @@ ra_delete_address_body()
$(rump.ifconfig shmif0 |awk '/AUTOCONF/ {print $2}') delete
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
terminate_rtadvd $PIDFILE
rump_server_destroy_ifaces
}
@ -393,12 +417,8 @@ ra_delete_address_body()
ra_delete_address_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -444,10 +464,8 @@ ra_multiple_routers_body()
atf_check_equal $n 2
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
wait_term ${PIDFILE3}
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE3
rump_server_destroy_ifaces
}
@ -455,16 +473,9 @@ ra_multiple_routers_body()
ra_multiple_routers_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
if [ -f ${PIDFILE3} ]; then
kill -TERM `cat ${PIDFILE3}`
wait_term ${PIDFILE3}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE3
cleanup
}
@ -510,10 +521,8 @@ ra_multiple_routers_single_prefix_body()
atf_check_equal $n 1
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
atf_check -s exit:0 kill -TERM `cat ${PIDFILE1_2}`
wait_term ${PIDFILE1_2}
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE1_2
rump_server_destroy_ifaces
}
@ -521,16 +530,9 @@ ra_multiple_routers_single_prefix_body()
ra_multiple_routers_single_prefix_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
if [ -f ${PIDFILE1_2} ]; then
kill -TERM `cat ${PIDFILE1_2}`
wait_term ${PIDFILE1_2}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE1_2
cleanup
}
@ -588,12 +590,9 @@ ra_multiple_routers_maxifprefixes_body()
# TODO check other conditions
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
atf_check -s exit:0 kill -TERM `cat ${PIDFILE3}`
wait_term ${PIDFILE3}
atf_check -s exit:0 kill -TERM `cat ${PIDFILE4}`
wait_term ${PIDFILE4}
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE3
terminate_rtadvd $PIDFILE4
rump_server_destroy_ifaces
}
@ -601,20 +600,10 @@ ra_multiple_routers_maxifprefixes_body()
ra_multiple_routers_maxifprefixes_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
if [ -f ${PIDFILE3} ]; then
kill -TERM `cat ${PIDFILE3}`
wait_term ${PIDFILE3}
fi
if [ -f ${PIDFILE4} ]; then
kill -TERM `cat ${PIDFILE4}`
wait_term ${PIDFILE4}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
terminate_rtadvd $PIDFILE3
terminate_rtadvd $PIDFILE4
cleanup
}
@ -693,8 +682,7 @@ ra_temporary_address_body()
unset RUMP_SERVER
atf_check -s exit:0 kill -TERM `cat ${PIDFILE}`
wait_term $PIDFILE
terminate_rtadvd $PIDFILE
rump_server_destroy_ifaces
}
@ -702,12 +690,8 @@ ra_temporary_address_body()
ra_temporary_address_cleanup()
{
if [ -f ${PIDFILE} ]; then
kill -TERM `cat ${PIDFILE}`
wait_term ${PIDFILE}
fi
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -747,7 +731,7 @@ ra_defrouter_expiration_body()
# Terminate rtadvd to prevent new RA messages from coming
# Note that ifconfig down; kill -TERM doesn't work
kill -KILL `cat ${PIDFILE}`
kill_rtadvd $PIDFILE
# Wait until the default routers and prefix entries are expired
sleep $expire_time
@ -772,6 +756,7 @@ ra_defrouter_expiration_cleanup()
{
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}
@ -811,7 +796,7 @@ ra_prefix_expiration_body()
# Terminate rtadvd to prevent new RA messages from coming
# Note that ifconfig down; kill -TERM doesn't work
kill -KILL `cat ${PIDFILE}`
kill_rtadvd $PIDFILE
# Wait until the default routers and prefix entries are expired
sleep $expire_time
@ -837,6 +822,7 @@ ra_prefix_expiration_cleanup()
{
$DEBUG && dump
terminate_rtadvd $PIDFILE
cleanup
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: advcap.c,v 1.16 2015/11/11 07:48:41 ozaki-r Exp $ */
/* $NetBSD: advcap.c,v 1.16.8.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: advcap.c,v 1.11 2003/05/19 09:46:50 keiichi Exp $ */
/*
@ -48,6 +48,8 @@
#include "pathnames.h"
#include "prog_ops.h"
#include "logit.h"
#ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
#endif
@ -137,7 +139,7 @@ getent(char *bp, char *name, char *cp)
tf = open(RM = cp, O_RDONLY);
}
if (tf < 0) {
syslog(LOG_INFO, "<%s> open: %m", __func__);
logit(LOG_INFO, "<%s> open: %m", __func__);
return (-2);
}
for (;;) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.c,v 1.36 2017/02/27 05:41:36 ozaki-r Exp $ */
/* $NetBSD: config.c,v 1.36.4.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: config.c,v 1.93 2005/10/17 14:40:02 suz Exp $ */
/*
@ -67,6 +67,7 @@
#include "timer.h"
#include "if.h"
#include "config.h"
#include "logit.h"
#include "prog_ops.h"
#ifndef __arraycount
@ -180,24 +181,24 @@ getconfig(const char *intface, int exithard)
do { \
p = calloc(1, sizeof(*p)); \
if (p == NULL) { \
syslog(LOG_ERR, "<%s> calloc failed: %m", \
logit(LOG_ERR, "<%s> calloc failed: %m", \
__func__); \
goto errexit; \
} \
} while(/*CONSTCOND*/0)
if (if_nametoindex(intface) == 0) {
syslog(LOG_INFO, "<%s> interface %s not found, ignoring",
logit(LOG_INFO, "<%s> interface %s not found, ignoring",
__func__, intface);
return;
}
syslog(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));
syslog(LOG_INFO,
logit(LOG_INFO,
"<%s> %s isn't defined in the configuration file"
" or the configuration file doesn't exist."
" Treat it as default",
@ -223,7 +224,7 @@ getconfig(const char *intface, int exithard)
tmp->advlinkopt = 1;
if (tmp->advlinkopt) {
if ((tmp->sdl = if_nametosdl(intface)) == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't get information of %s",
__func__, intface);
goto errexit;
@ -232,7 +233,7 @@ getconfig(const char *intface, int exithard)
} else {
tmp->ifindex = if_nametoindex(intface);
if (tmp->ifindex == 0) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't get information of %s",
__func__, intface);
goto errexit;
@ -242,7 +243,7 @@ getconfig(const char *intface, int exithard)
strlcpy(tmp->ifname, intface, sizeof(tmp->ifname));
if ((tmp->phymtu = if_getmtu(intface)) == 0) {
tmp->phymtu = IPV6_MMTU;
syslog(LOG_WARNING,
logit(LOG_WARNING,
"<%s> can't get interface mtu of %s. Treat as %d",
__func__, intface, IPV6_MMTU);
}
@ -252,7 +253,7 @@ getconfig(const char *intface, int exithard)
*/
MAYHAVE(val, "maxinterval", DEF_MAXRTRADVINTERVAL);
if (val < MIN_MAXINTERVAL || val > MAX_MAXINTERVAL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> maxinterval (%d) on %s is invalid "
"(must be between %u and %u)", __func__, val,
intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL);
@ -261,7 +262,7 @@ getconfig(const char *intface, int exithard)
tmp->maxinterval = val;
MAYHAVE(val, "mininterval", tmp->maxinterval/3);
if (val < MIN_MININTERVAL || val > (tmp->maxinterval * 3) / 4) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> mininterval (%d) on %s is invalid "
"(must be between %u and %d)",
__func__, val, intface, MIN_MININTERVAL,
@ -283,7 +284,7 @@ getconfig(const char *intface, int exithard)
val |= ND_RA_FLAG_RTPREF_HIGH;
if (strchr(flagstr, 'l')) {
if ((val & ND_RA_FLAG_RTPREF_HIGH)) {
syslog(LOG_ERR, "<%s> the \'h\' and \'l\'"
logit(LOG_ERR, "<%s> the \'h\' and \'l\'"
" router flags are exclusive", __func__);
goto errexit;
}
@ -300,14 +301,14 @@ getconfig(const char *intface, int exithard)
#endif
tmp->rtpref = val & ND_RA_FLAG_RTPREF_MASK;
if (tmp->rtpref == ND_RA_FLAG_RTPREF_RSV) {
syslog(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)) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> router lifetime (%d) on %s is invalid "
"(must be 0 or between %d and %d)",
__func__, val, intface,
@ -323,7 +324,7 @@ getconfig(const char *intface, int exithard)
* explicitly set zero. (see also the above section)
*/
if (val && forwarding == 0) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%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.",
@ -334,7 +335,7 @@ getconfig(const char *intface, int exithard)
MAYHAVE(val, "rtime", DEF_ADVREACHABLETIME);
if (val < 0 || val > MAXREACHABLETIME) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> reachable time (%d) on %s is invalid "
"(must be no greater than %d)",
__func__, val, intface, MAXREACHABLETIME);
@ -344,14 +345,14 @@ getconfig(const char *intface, int exithard)
MAYHAVE(val64, "retrans", DEF_ADVRETRANSTIMER);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(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;
}
tmp->retranstimer = (uint32_t)val64;
if (agetnum("hapref") != -1 || agetnum("hatime") != -1) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> mobile-ip6 configuration not supported",
__func__);
goto errexit;
@ -377,7 +378,7 @@ getconfig(const char *intface, int exithard)
/* allocate memory to store prefix information */
if ((pfx = calloc(1, sizeof(*pfx))) == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't allocate memory: %m",
__func__);
goto errexit;
@ -390,20 +391,20 @@ getconfig(const char *intface, int exithard)
pfx->origin = PREFIX_FROM_CONFIG;
if (inet_pton(AF_INET6, addr, &pfx->prefix) != 1) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> inet_pton failed for %s",
__func__, addr);
goto errexit;
}
if (IN6_IS_ADDR_MULTICAST(&pfx->prefix)) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> multicast prefix (%s) must "
"not be advertised on %s",
__func__, addr, intface);
goto errexit;
}
if (IN6_IS_ADDR_LINKLOCAL(&pfx->prefix))
syslog(LOG_NOTICE,
logit(LOG_NOTICE,
"<%s> link-local prefix (%s) will be"
" advertised on %s",
__func__, addr, intface);
@ -411,7 +412,7 @@ getconfig(const char *intface, int exithard)
makeentry(entbuf, sizeof(entbuf), i, "prefixlen");
MAYHAVE(val, entbuf, 64);
if (val < 0 || val > 128) {
syslog(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;
@ -435,7 +436,7 @@ getconfig(const char *intface, int exithard)
makeentry(entbuf, sizeof(entbuf), i, "vltime");
MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(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);
@ -454,7 +455,7 @@ getconfig(const char *intface, int exithard)
makeentry(entbuf, sizeof(entbuf), i, "pltime");
MAYHAVE(val64, entbuf, DEF_ADVPREFERREDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> pltime (%lld) for %s/%d on %s "
"is out of range",
__func__, (long long)val64,
@ -476,7 +477,7 @@ getconfig(const char *intface, int exithard)
MAYHAVE(val64, "mtu", 0);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> mtu (%" PRIi64 ") on %s out of range",
__func__, val64, intface);
goto errexit;
@ -490,7 +491,7 @@ getconfig(const char *intface, int exithard)
tmp->linkmtu = tmp->phymtu;
}
else if (tmp->linkmtu < IPV6_MMTU || tmp->linkmtu > tmp->phymtu) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> advertised link mtu (%d) on %s is invalid (must "
"be between least MTU (%d) and physical link MTU (%d)",
__func__, tmp->linkmtu, intface,
@ -504,13 +505,13 @@ getconfig(const char *intface, int exithard)
int s;
if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
syslog(LOG_ERR, "<%s> socket: %m", __func__);
logit(LOG_ERR, "<%s> socket: %m", __func__);
goto errexit;
}
memset(&ndi, 0, sizeof(ndi));
strncpy(ndi.ifname, intface, IFNAMSIZ);
if (prog_ioctl(s, SIOCGIFINFO_IN6, &ndi) < 0) {
syslog(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %m",
logit(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %m",
__func__, intface);
}
@ -519,7 +520,7 @@ getconfig(const char *intface, int exithard)
ndi.ndi.retrans = tmp->retranstimer;
ndi.ndi.basereachable = tmp->reachabletime;
if (prog_ioctl(s, SIOCSIFINFO_IN6, &ndi) < 0) {
syslog(LOG_INFO, "<%s> ioctl:SIOCSIFINFO_IN6 at %s: %m",
logit(LOG_INFO, "<%s> ioctl:SIOCSIFINFO_IN6 at %s: %m",
__func__, intface);
}
prog_close(s);
@ -551,7 +552,7 @@ getconfig(const char *intface, int exithard)
TAILQ_INSERT_TAIL(&tmp->route, rti, next);
if (inet_pton(AF_INET6, addr, &rti->prefix) != 1) {
syslog(LOG_ERR, "<%s> inet_pton failed for %s",
logit(LOG_ERR, "<%s> inet_pton failed for %s",
__func__, addr);
goto errexit;
}
@ -564,14 +565,14 @@ getconfig(const char *intface, int exithard)
*/
MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME);
if (IN6_IS_ADDR_MULTICAST(&rti->prefix)) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> multicast route (%s) must "
"not be advertised on %s",
__func__, addr, intface);
goto errexit;
}
if (IN6_IS_ADDR_LINKLOCAL(&rti->prefix)) {
syslog(LOG_NOTICE,
logit(LOG_NOTICE,
"<%s> link-local route (%s) will "
"be advertised on %s",
__func__, addr, intface);
@ -592,7 +593,7 @@ getconfig(const char *intface, int exithard)
val = 64;
}
if (val < 0 || val > 128) {
syslog(LOG_ERR, "<%s> prefixlen (%d) for %s on %s "
logit(LOG_ERR, "<%s> prefixlen (%d) for %s on %s "
"out of range",
__func__, val, addr, intface);
goto errexit;
@ -606,7 +607,7 @@ getconfig(const char *intface, int exithard)
val |= ND_RA_FLAG_RTPREF_HIGH;
if (strchr(flagstr, 'l')) {
if ((val & ND_RA_FLAG_RTPREF_HIGH)) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> the \'h\' and \'l\' route"
" preferences are exclusive",
__func__);
@ -627,7 +628,7 @@ getconfig(const char *intface, int exithard)
}
rti->rtpref = val & ND_RA_FLAG_RTPREF_MASK;
if (rti->rtpref == ND_RA_FLAG_RTPREF_RSV) {
syslog(LOG_ERR, "<%s> invalid route preference (%02x) "
logit(LOG_ERR, "<%s> invalid route preference (%02x) "
"for %s/%d on %s",
__func__, rti->rtpref, addr,
rti->prefixlen, intface);
@ -656,7 +657,7 @@ getconfig(const char *intface, int exithard)
}
}
if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR, "<%s> route lifetime (%lld) for "
logit(LOG_ERR, "<%s> route lifetime (%lld) for "
"%s/%d on %s out of range", __func__,
(long long)val64, addr, rti->prefixlen, intface);
goto errexit;
@ -684,7 +685,7 @@ getconfig(const char *intface, int exithard)
ELM_MALLOC(rdnsa);
TAILQ_INSERT_TAIL(&rdnss->list, rdnsa, next);
if (inet_pton(AF_INET6, abuf, &rdnsa->addr) != 1) {
syslog(LOG_ERR, "<%s> inet_pton failed for %s",
logit(LOG_ERR, "<%s> inet_pton failed for %s",
__func__, addr);
goto errexit;
}
@ -695,7 +696,7 @@ getconfig(const char *intface, int exithard)
if (val64 < tmp->maxinterval ||
val64 > tmp->maxinterval * 2)
{
syslog(LOG_ERR, "<%s> %s (%lld) on %s is invalid",
logit(LOG_ERR, "<%s> %s (%lld) on %s is invalid",
__func__, entbuf, (long long)val64, intface);
goto errexit;
}
@ -731,7 +732,7 @@ getconfig(const char *intface, int exithard)
if (val64 < tmp->maxinterval ||
val64 > tmp->maxinterval * 2)
{
syslog(LOG_ERR, "<%s> %s (%lld) on %s is invalid",
logit(LOG_ERR, "<%s> %s (%lld) on %s is invalid",
__func__, entbuf, (long long)val64, intface);
goto errexit;
}
@ -803,7 +804,7 @@ get_prefix(struct rainfo *rai)
char ntopbuf[INET6_ADDRSTRLEN];
if (getifaddrs(&ifap) < 0) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't get interface addresses",
__func__);
exit(1);
@ -824,7 +825,7 @@ get_prefix(struct rainfo *rai)
lim = (unsigned char *)(ifa->ifa_netmask) + ifa->ifa_netmask->sa_len;
plen = prefixlen(m, lim);
if (plen <= 0 || plen > 128) {
syslog(LOG_ERR, "<%s> failed to get prefixlen "
logit(LOG_ERR, "<%s> failed to get prefixlen "
"or prefix is invalid",
__func__);
exit(1);
@ -838,7 +839,7 @@ get_prefix(struct rainfo *rai)
/* allocate memory to store prefix info. */
if ((pp = calloc(1, sizeof(*pp))) == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't get allocate buffer for prefix",
__func__);
exit(1);
@ -858,10 +859,10 @@ get_prefix(struct rainfo *rai)
}
if (!inet_ntop(AF_INET6, &pp->prefix, ntopbuf,
sizeof(ntopbuf))) {
syslog(LOG_ERR, "<%s> inet_ntop failed", __func__);
logit(LOG_ERR, "<%s> inet_ntop failed", __func__);
exit(1);
}
syslog(LOG_DEBUG,
logit(LOG_DEBUG,
"<%s> add %s/%d to prefix list on %s",
__func__, ntopbuf, pp->prefixlen, rai->ifname);
@ -905,7 +906,7 @@ add_prefix(struct rainfo *rai, struct in6_prefixreq *ipr)
char ntopbuf[INET6_ADDRSTRLEN];
if ((prefix = calloc(1, sizeof(*prefix))) == NULL) {
syslog(LOG_ERR, "<%s> memory allocation failed",
logit(LOG_ERR, "<%s> memory allocation failed",
__func__);
return; /* XXX: error or exit? */
}
@ -921,7 +922,7 @@ add_prefix(struct rainfo *rai, struct in6_prefixreq *ipr)
TAILQ_INSERT_TAIL(&rai->prefix, prefix, next);
rai->pfxs++;
syslog(LOG_DEBUG, "<%s> new prefix %s/%d was added on %s",
logit(LOG_DEBUG, "<%s> new prefix %s/%d was added on %s",
__func__, inet_ntop(AF_INET6, &ipr->ipr_prefix.sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
ipr->ipr_plen, rai->ifname);
@ -947,7 +948,7 @@ delete_prefix(struct prefix *prefix)
TAILQ_REMOVE(&rai->prefix, prefix, next);
rai->pfxs--;
syslog(LOG_DEBUG, "<%s> prefix %s/%d was deleted on %s",
logit(LOG_DEBUG, "<%s> prefix %s/%d was deleted on %s",
__func__, inet_ntop(AF_INET6, &prefix->prefix,
ntopbuf, INET6_ADDRSTRLEN),
prefix->prefixlen, rai->ifname);
@ -963,13 +964,13 @@ invalidate_prefix(struct prefix *prefix)
struct rainfo *rai = prefix->rainfo;
if (prefix->timer) { /* sanity check */
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> assumption failure: timer already exists",
__func__);
exit(1);
}
syslog(LOG_DEBUG, "<%s> prefix %s/%d was invalidated on %s, "
logit(LOG_DEBUG, "<%s> prefix %s/%d was invalidated on %s, "
"will expire in %ld seconds", __func__,
inet_ntop(AF_INET6, &prefix->prefix, ntopbuf, INET6_ADDRSTRLEN),
prefix->prefixlen, rai->ifname, (long)prefix_timo);
@ -977,7 +978,7 @@ invalidate_prefix(struct prefix *prefix)
/* set the expiration timer */
prefix->timer = rtadvd_add_timer(prefix_timeout, NULL, prefix, NULL);
if (prefix->timer == NULL) {
syslog(LOG_ERR, "<%s> failed to add a timer for a prefix. "
logit(LOG_ERR, "<%s> failed to add a timer for a prefix. "
"remove the prefix", __func__);
delete_prefix(prefix);
}
@ -1003,13 +1004,13 @@ update_prefix(struct prefix * prefix)
struct rainfo *rai = prefix->rainfo;
if (prefix->timer == NULL) { /* sanity check */
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> assumption failure: timer does not exist",
__func__);
exit(1);
}
syslog(LOG_DEBUG, "<%s> prefix %s/%d was re-enabled on %s",
logit(LOG_DEBUG, "<%s> prefix %s/%d was re-enabled on %s",
__func__, inet_ntop(AF_INET6, &prefix->prefix, ntopbuf,
INET6_ADDRSTRLEN), prefix->prefixlen, rai->ifname);
@ -1029,12 +1030,12 @@ init_prefix(struct in6_prefixreq *ipr)
int s;
if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
syslog(LOG_ERR, "<%s> socket: %m", __func__);
logit(LOG_ERR, "<%s> socket: %m", __func__);
exit(1);
}
if (prog_ioctl(s, SIOCGIFPREFIX_IN6, ipr) < 0) {
syslog(LOG_INFO, "<%s> ioctl:SIOCGIFPREFIX: %m", __func__);
logit(LOG_INFO, "<%s> ioctl:SIOCGIFPREFIX: %m", __func__);
ipr->ipr_vltime = DEF_ADVVALIDLIFETIME;
ipr->ipr_pltime = DEF_ADVPREFERREDLIFETIME;
@ -1045,7 +1046,7 @@ init_prefix(struct in6_prefixreq *ipr)
else if (ipr->ipr_origin < PR_ORIG_RR) {
char ntopbuf[INET6_ADDRSTRLEN];
syslog(LOG_WARNING, "<%s> Added prefix(%s)'s origin %d is"
logit(LOG_WARNING, "<%s> Added prefix(%s)'s origin %d is"
"lower than PR_ORIG_RR(router renumbering)."
"This should not happen if I am router", __func__,
inet_ntop(AF_INET6, &ipr->ipr_prefix.sin6_addr, ntopbuf,
@ -1072,7 +1073,7 @@ make_prefix(struct rainfo *rai, int ifindex, struct in6_addr *addr, int plen)
memset(&ipr, 0, sizeof(ipr));
if (if_indextoname(ifindex, ipr.ipr_name) == NULL) {
syslog(LOG_ERR, "<%s> Prefix added interface No.%d doesn't"
logit(LOG_ERR, "<%s> Prefix added interface No.%d doesn't"
"exist. This should not happen: %m", __func__,
ifindex);
exit(1);
@ -1110,7 +1111,7 @@ make_packet(struct rainfo *rainfo)
packlen = sizeof(struct nd_router_advert);
if (rainfo->advlinkopt) {
if ((lladdroptlen = lladdropt_length(rainfo->sdl)) == 0) {
syslog(LOG_INFO,
logit(LOG_INFO,
"<%s> link-layer address option has"
" null length on %s. Treat as not included.",
__func__, rainfo->ifname);
@ -1142,7 +1143,7 @@ make_packet(struct rainfo *rainfo)
/* allocate memory for the packet */
if ((buf = realloc(rainfo->ra_data, packlen)) == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't get enough memory for an RA packet %m",
__func__);
exit(1);
@ -1153,7 +1154,7 @@ make_packet(struct rainfo *rainfo)
#define CHECKLEN(size) \
do { \
if (buf + size > rainfo->ra_data + packlen) { \
syslog(LOG_ERR, \
logit(LOG_ERR, \
"<%s, %d> RA packet does not fit in %zu",\
__func__, __LINE__, packlen); \
exit(1); \
@ -1316,7 +1317,7 @@ getinet6sysctl(int code)
size = sizeof(value);
if (prog_sysctl(mib, __arraycount(mib), &value, &size, NULL, 0)
< 0) {
syslog(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %m",
logit(LOG_ERR, "<%s>: failed to get ip6 sysctl(%d): %m",
__func__, code);
return -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dump.c,v 1.14 2016/06/15 13:57:39 riastradh Exp $ */
/* $NetBSD: dump.c,v 1.14.8.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: dump.c,v 1.34 2004/06/14 05:35:59 itojun Exp $ */
/*
@ -57,6 +57,7 @@
#include "rtadvd.h"
#include "timer.h"
#include "logit.h"
#include "if.h"
#include "dump.h"
#include "prog_ops.h"
@ -266,11 +267,11 @@ if_dump(void)
void
rtadvd_dump_file(const char *dumpfile)
{
syslog(LOG_DEBUG, "<%s> dump current status to %s", __func__,
logit(LOG_DEBUG, "<%s> dump current status to %s", __func__,
dumpfile);
if ((fp = fopen(dumpfile, "w")) == NULL) {
syslog(LOG_WARNING, "<%s> open a dump file(%s): %m",
logit(LOG_WARNING, "<%s> open a dump file(%s): %m",
__func__, dumpfile);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.24 2015/11/11 07:48:41 ozaki-r Exp $ */
/* $NetBSD: if.c,v 1.24.8.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: if.c,v 1.36 2004/11/30 22:32:01 suz Exp $ */
/*
@ -55,6 +55,7 @@
#include "rtadvd.h"
#include "if.h"
#include "logit.h"
#include "prog_ops.h"
#ifndef RT_ROUNDUP
@ -135,14 +136,14 @@ if_getflags(int ifindex, int oifflags)
int s;
if ((s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
syslog(LOG_ERR, "<%s> socket: %m", __func__);
logit(LOG_ERR, "<%s> socket: %m", __func__);
return (oifflags & ~IFF_UP);
}
memset(&ifr, 0, sizeof(ifr));
if_indextoname(ifindex, ifr.ifr_name);
if (prog_ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
syslog(LOG_ERR, "<%s> ioctl:SIOCGIFFLAGS: failed for %s",
logit(LOG_ERR, "<%s> ioctl:SIOCGIFFLAGS: failed for %s",
__func__, ifr.ifr_name);
prog_close(s);
return (oifflags & ~IFF_UP);
@ -179,7 +180,7 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt)
memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN);
break;
default:
syslog(LOG_ERR, "<%s> unsupported link type(%d)",
logit(LOG_ERR, "<%s> unsupported link type(%d)",
__func__, sdl->sdl_type);
exit(1);
}
@ -203,7 +204,7 @@ get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter)
rtm = (struct rt_msghdr *)(((char *)rtm) + rtm->rtm_msglen)) {
/* just for safety */
if (!rtm->rtm_msglen) {
syslog(LOG_WARNING, "<%s> rtm_msglen is 0 "
logit(LOG_WARNING, "<%s> rtm_msglen is 0 "
"(buf=%p lim=%p rtm=%p)", __func__,
buf, lim, rtm);
break;

2
usr.sbin/rtadvd/logit.h Normal file
View File

@ -0,0 +1,2 @@
void logit(int, const char *, ...) __sysloglike(2, 3);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rrenum.c,v 1.19 2015/11/11 07:48:41 ozaki-r Exp $ */
/* $NetBSD: rrenum.c,v 1.19.8.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: rrenum.c,v 1.14 2004/06/14 05:36:00 itojun Exp $ */
/*
@ -53,6 +53,7 @@
#include "rtadvd.h"
#include "rrenum.h"
#include "if.h"
#include "logit.h"
#include "prog_ops.h"
#define RR_ISSET_SEGNUM(segnum_bits, segnum) \
@ -88,7 +89,7 @@ rr_pco_check(int len, struct rr_pco_match *rpm)
/* rpm->rpm_len must be (4N * 3) as router-renum-05.txt */
if ((rpm->rpm_len - 3) < 0 || /* must be at least 3 */
(rpm->rpm_len - 3) & 0x3) { /* must be multiple of 4 */
syslog(LOG_WARNING, "<%s> rpm_len %d is not 4N * 3",
logit(LOG_WARNING, "<%s> rpm_len %d is not 4N * 3",
__func__, rpm->rpm_len);
return 1;
}
@ -99,13 +100,13 @@ rr_pco_check(int len, struct rr_pco_match *rpm)
case RPM_PCO_SETGLOBAL:
break;
default:
syslog(LOG_WARNING, "<%s> unknown rpm_code %d", __func__,
logit(LOG_WARNING, "<%s> unknown rpm_code %d", __func__,
rpm->rpm_code);
return 1;
}
/* rpm->rpm_matchlen must be 0 to 128 inclusive */
if (rpm->rpm_matchlen > 128) {
syslog(LOG_WARNING, "<%s> rpm_matchlen %d is over 128",
logit(LOG_WARNING, "<%s> rpm_matchlen %d is over 128",
__func__, rpm->rpm_matchlen);
return 1;
}
@ -128,7 +129,7 @@ rr_pco_check(int len, struct rr_pco_match *rpm)
* (rpu_uselen + rpu_keeplen > 0)
*/
if (checklen > 128) {
syslog(LOG_WARNING, "<%s> sum of rpu_uselen %d and"
logit(LOG_WARNING, "<%s> sum of rpu_uselen %d and"
" rpu_keeplen %d is %d(over 128)",
__func__, rpu->rpu_uselen,
rpu->rpu_keeplen,
@ -166,7 +167,7 @@ do_use_prefix(int len, struct rr_pco_match *rpm,
irr->irr_useprefix.sin6_addr = in6addr_any;
if (prog_ioctl(s, rrcmd2pco[rpm->rpm_code], irr) < 0 &&
errno != EADDRNOTAVAIL)
syslog(LOG_ERR, "<%s> ioctl: %m", __func__);
logit(LOG_ERR, "<%s> ioctl: %m", __func__);
return;
}
@ -197,7 +198,7 @@ do_use_prefix(int len, struct rr_pco_match *rpm,
if (prog_ioctl(s, rrcmd2pco[rpm->rpm_code], irr) < 0 &&
errno != EADDRNOTAVAIL)
syslog(LOG_ERR, "<%s> ioctl: %m", __func__);
logit(LOG_ERR, "<%s> ioctl: %m", __func__);
/* very adhoc: should be rewritten */
if (rpm->rpm_code == RPM_PCO_CHANGE &&
@ -251,7 +252,7 @@ do_pco(struct icmp6_router_renum *rr, int len, struct rr_pco_match *rpm)
return 1;
if (s == -1 && (s = prog_socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
syslog(LOG_ERR, "<%s> socket: %m", __func__);
logit(LOG_ERR, "<%s> socket: %m", __func__);
exit(1);
}
@ -281,7 +282,7 @@ do_pco(struct icmp6_router_renum *rr, int len, struct rr_pco_match *rpm)
if (errno == ENXIO)
return 0;
else if (errno) {
syslog(LOG_ERR, "<%s> if_indextoname: %m", __func__);
logit(LOG_ERR, "<%s> if_indextoname: %m", __func__);
return 1;
}
return 0;
@ -308,7 +309,7 @@ do_rr(size_t len, struct icmp6_router_renum *rr)
rpm = (struct rr_pco_match *)cp;
if (len < sizeof(struct rr_pco_match)) {
tooshort:
syslog(LOG_ERR, "<%s> pkt too short. left len = %zd. "
logit(LOG_ERR, "<%s> pkt too short. left len = %zd. "
"garbage at end of pkt?", __func__, len);
return 1;
}
@ -317,7 +318,7 @@ do_rr(size_t len, struct icmp6_router_renum *rr)
goto tooshort;
if (do_pco(rr, rpmlen, rpm)) {
syslog(LOG_WARNING, "<%s> invalid PCO", __func__);
logit(LOG_WARNING, "<%s> invalid PCO", __func__);
goto next;
}
@ -343,7 +344,7 @@ rr_command_check(size_t len, struct icmp6_router_renum *rr,
/* rr_command length check */
if (len < (sizeof(struct icmp6_router_renum) +
sizeof(struct rr_pco_match))) {
syslog(LOG_ERR, "<%s> rr_command len %zd is too short",
logit(LOG_ERR, "<%s> rr_command len %zd is too short",
__func__, len);
return 1;
}
@ -351,7 +352,7 @@ rr_command_check(size_t len, struct icmp6_router_renum *rr,
/* destination check. only for multicast. omit unicast check. */
if (IN6_IS_ADDR_MULTICAST(dst) && !IN6_IS_ADDR_MC_LINKLOCAL(dst) &&
!IN6_IS_ADDR_MC_SITELOCAL(dst)) {
syslog(LOG_ERR, "<%s> dst mcast addr %s is illegal",
logit(LOG_ERR, "<%s> dst mcast addr %s is illegal",
__func__,
inet_ntop(AF_INET6, dst, ntopbuf, INET6_ADDRSTRLEN));
return 1;
@ -359,7 +360,7 @@ rr_command_check(size_t len, struct icmp6_router_renum *rr,
/* seqnum and segnum check */
if (rro.rro_seqnum > rr->rr_seqnum) {
syslog(LOG_WARNING,
logit(LOG_WARNING,
"<%s> rcvd old seqnum %d from %s",
__func__, (uint32_t)ntohl(rr->rr_seqnum),
inet_ntop(AF_INET6, from, ntopbuf, INET6_ADDRSTRLEN));
@ -369,7 +370,7 @@ rr_command_check(size_t len, struct icmp6_router_renum *rr,
(rr->rr_flags & ICMP6_RR_FLAGS_TEST) == 0 &&
RR_ISSET_SEGNUM(rro.rro_segnum_bits, rr->rr_segnum)) {
if ((rr->rr_flags & ICMP6_RR_FLAGS_REQRESULT) != 0)
syslog(LOG_WARNING,
logit(LOG_WARNING,
"<%s> rcvd duped segnum %d from %s",
__func__, rr->rr_segnum,
inet_ntop(AF_INET6, from, ntopbuf,
@ -412,7 +413,7 @@ rr_command_input(int len, struct icmp6_router_renum *rr,
return;
failed:
syslog(LOG_ERR, "<%s> received RR was invalid", __func__);
logit(LOG_ERR, "<%s> received RR was invalid", __func__);
return;
}
@ -422,7 +423,7 @@ rr_input(size_t len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
{
char ntopbuf[2][INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
syslog(LOG_DEBUG,
logit(LOG_DEBUG,
"<%s> RR received from %s to %s on %s",
__func__,
inet_ntop(AF_INET6, &from->sin6_addr,
@ -432,7 +433,7 @@ rr_input(size_t len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
/* packet validation based on Section 4.1 of RFC2894 */
if (len < sizeof(struct icmp6_router_renum)) {
syslog(LOG_NOTICE,
logit(LOG_NOTICE,
"<%s>: RR short message (size %zd) from %s to %s on %s",
__func__, len,
inet_ntop(AF_INET6, &from->sin6_addr,
@ -454,7 +455,7 @@ rr_input(size_t len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
!IN6_ARE_ADDR_EQUAL(&sin6_sitelocal_allrouters.sin6_addr,
&pi->ipi6_addr))
{
syslog(LOG_NOTICE,
logit(LOG_NOTICE,
"<%s>: RR message with invalid destination (%s) "
"from %s on %s",
__func__,
@ -479,7 +480,7 @@ rr_input(size_t len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi,
/* TODO: sequence number reset */
break;
default:
syslog(LOG_ERR, "<%s> received unknown code %d",
logit(LOG_ERR, "<%s> received unknown code %d",
__func__, rr->rr_code);
break;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rtadvd.8,v 1.25 2016/12/16 09:09:38 ozaki-r Exp $
.\" $NetBSD: rtadvd.8,v 1.25.6.1 2017/11/21 10:54:18 martin Exp $
.\" $KAME: rtadvd.8,v 1.24 2002/05/31 16:16:08 jinmei Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd December 16, 2016
.Dd November 6, 2017
.Dt RTADVD 8
.Os
.Sh NAME
@ -120,11 +120,16 @@ By default,
.Pa /etc/rtadvd.conf
is used.
.It Fl D
Even more debugging information than that offered by the
.Fl d
option is printed.
Instead of printing errors using
.Xr syslog 3
send them to
.Dv stderr .
Also when
.Xr poll 2
fails, exit instead of retrying.
.It Fl d
Print debugging information.
Repeating this option, adds more verbose debugging.
.It Fl f
Foreground mode (useful when debugging).
Log messages will be dumped to stderr when this option is specified.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: timer.c,v 1.13 2015/11/11 07:48:41 ozaki-r Exp $ */
/* $NetBSD: timer.c,v 1.13.8.1 2017/11/21 10:54:18 martin Exp $ */
/* $KAME: timer.c,v 1.11 2005/04/14 06:22:35 suz Exp $ */
/*
@ -40,6 +40,7 @@
#include <string.h>
#include <search.h>
#include "timer.h"
#include "logit.h"
#include "prog_ops.h"
struct rtadvd_timer_head_t ra_timer = TAILQ_HEAD_INITIALIZER(ra_timer);
@ -62,7 +63,7 @@ rtadvd_add_timer(struct rtadvd_timer *(*timeout) (void *),
struct rtadvd_timer *newtimer;
if ((newtimer = malloc(sizeof(*newtimer))) == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> can't allocate memory", __func__);
exit(1);
}
@ -70,7 +71,7 @@ rtadvd_add_timer(struct rtadvd_timer *(*timeout) (void *),
memset(newtimer, 0, sizeof(*newtimer));
if (timeout == NULL) {
syslog(LOG_ERR,
logit(LOG_ERR,
"<%s> timeout function unspecified", __func__);
exit(1);
}
@ -156,7 +157,7 @@ rtadvd_timer_rest(struct rtadvd_timer *timer)
prog_clock_gettime(CLOCK_MONOTONIC, &now);
if (timespeccmp(&timer->tm, &now, <=)) {
syslog(LOG_DEBUG,
logit(LOG_DEBUG,
"<%s> a timer must be expired, but not yet",
__func__);
returnval.tv_sec = 0;