rtsol(8)/rtsold(8): make WARNS=3 clean
It is actually WARNS=6 clean for non-strict alignment archs. Approved by: ed (co-mentor)
This commit is contained in:
parent
f62e48f536
commit
bd2c49af72
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204407
@ -21,8 +21,8 @@ SRCDIR= ${.CURDIR}/../../usr.sbin/rtsold
|
|||||||
PROG= rtsol
|
PROG= rtsol
|
||||||
SRCS= rtsold.c rtsol.c if.c probe.c rtsock.c
|
SRCS= rtsold.c rtsol.c if.c probe.c rtsock.c
|
||||||
NO_MAN=
|
NO_MAN=
|
||||||
WARNS?= 0
|
|
||||||
|
|
||||||
|
WARNS?= 3
|
||||||
CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL
|
CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DSMALL
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -19,10 +19,8 @@ MAN= rtsold.8
|
|||||||
MLINKS= rtsold.8 rtsol.8
|
MLINKS= rtsold.8 rtsol.8
|
||||||
SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
|
SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
|
||||||
|
|
||||||
|
WARNS?= 3
|
||||||
CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H
|
CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H
|
||||||
|
|
||||||
WARNS?= 1
|
|
||||||
|
|
||||||
DPADD= ${LIBKVM}
|
DPADD= ${LIBKVM}
|
||||||
LDADD= -lkvm
|
LDADD= -lkvm
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ static FILE *fp;
|
|||||||
extern struct ifinfo *iflist;
|
extern struct ifinfo *iflist;
|
||||||
|
|
||||||
static void dump_interface_status(void);
|
static void dump_interface_status(void);
|
||||||
static char *sec2str(time_t);
|
static const char *sec2str(time_t);
|
||||||
char *ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
|
static const char * const ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_interface_status(void)
|
dump_interface_status(void)
|
||||||
@ -97,7 +97,7 @@ dump_interface_status(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rtsold_dump_file(char *dumpfile)
|
rtsold_dump_file(const char *dumpfile)
|
||||||
{
|
{
|
||||||
if ((fp = fopen(dumpfile, "w")) == NULL) {
|
if ((fp = fopen(dumpfile, "w")) == NULL) {
|
||||||
warnmsg(LOG_WARNING, __func__, "open a dump file(%s): %s",
|
warnmsg(LOG_WARNING, __func__, "open a dump file(%s): %s",
|
||||||
@ -108,7 +108,7 @@ rtsold_dump_file(char *dumpfile)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
sec2str(time_t total)
|
sec2str(time_t total)
|
||||||
{
|
{
|
||||||
static char result[256];
|
static char result[256];
|
||||||
|
@ -82,7 +82,6 @@ interface_up(char *name)
|
|||||||
struct in6_ndireq nd;
|
struct in6_ndireq nd;
|
||||||
int llflag;
|
int llflag;
|
||||||
int s;
|
int s;
|
||||||
int error;
|
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
||||||
|
@ -94,9 +94,9 @@ rtsock_input(int s)
|
|||||||
char *lim, *next;
|
char *lim, *next;
|
||||||
struct rt_msghdr *rtm;
|
struct rt_msghdr *rtm;
|
||||||
int idx;
|
int idx;
|
||||||
size_t len;
|
ssize_t len;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const size_t lenlim =
|
const ssize_t lenlim =
|
||||||
offsetof(struct rt_msghdr, rtm_msglen) + sizeof(rtm->rtm_msglen);
|
offsetof(struct rt_msghdr, rtm_msglen) + sizeof(rtm->rtm_msglen);
|
||||||
|
|
||||||
n = read(s, msg, sizeof(msg));
|
n = read(s, msg, sizeof(msg));
|
||||||
@ -135,7 +135,7 @@ rtsock_input(int s)
|
|||||||
|
|
||||||
#ifdef RTM_IFANNOUNCE /*NetBSD 1.5 or later*/
|
#ifdef RTM_IFANNOUNCE /*NetBSD 1.5 or later*/
|
||||||
static int
|
static int
|
||||||
rtsock_input_ifannounce(int s, struct rt_msghdr *rtm, char *lim)
|
rtsock_input_ifannounce(int s __unused, struct rt_msghdr *rtm, char *lim)
|
||||||
{
|
{
|
||||||
struct if_announcemsghdr *ifan;
|
struct if_announcemsghdr *ifan;
|
||||||
struct ifinfo *ifinfo;
|
struct ifinfo *ifinfo;
|
||||||
|
@ -72,8 +72,10 @@ static int rcvcmsglen;
|
|||||||
|
|
||||||
int rssock;
|
int rssock;
|
||||||
|
|
||||||
static struct sockaddr_in6 sin6_allrouters =
|
static struct sockaddr_in6 sin6_allrouters = {
|
||||||
{sizeof(sin6_allrouters), AF_INET6};
|
.sin6_len = sizeof(sin6_allrouters),
|
||||||
|
.sin6_family = AF_INET6,
|
||||||
|
};
|
||||||
|
|
||||||
static void call_script(char *, char *);
|
static void call_script(char *, char *);
|
||||||
static int safefile(const char *);
|
static int safefile(const char *);
|
||||||
@ -183,7 +185,7 @@ sendpacket(struct ifinfo *ifinfo)
|
|||||||
struct in6_pktinfo *pi;
|
struct in6_pktinfo *pi;
|
||||||
struct cmsghdr *cm;
|
struct cmsghdr *cm;
|
||||||
int hoplimit = 255;
|
int hoplimit = 255;
|
||||||
int i;
|
ssize_t i;
|
||||||
struct sockaddr_in6 dst;
|
struct sockaddr_in6 dst;
|
||||||
|
|
||||||
dst = sin6_allrouters;
|
dst = sin6_allrouters;
|
||||||
@ -213,7 +215,7 @@ sendpacket(struct ifinfo *ifinfo)
|
|||||||
"send RS on %s, whose state is %d",
|
"send RS on %s, whose state is %d",
|
||||||
ifinfo->ifname, ifinfo->state);
|
ifinfo->ifname, ifinfo->state);
|
||||||
i = sendmsg(rssock, &sndmhdr, 0);
|
i = sendmsg(rssock, &sndmhdr, 0);
|
||||||
if (i < 0 || i != ifinfo->rs_datalen) {
|
if (i < 0 || (size_t)i != ifinfo->rs_datalen) {
|
||||||
/*
|
/*
|
||||||
* ENETDOWN is not so serious, especially when using several
|
* ENETDOWN is not so serious, especially when using several
|
||||||
* network cards on a mobile node. We ignore it.
|
* network cards on a mobile node. We ignore it.
|
||||||
@ -231,7 +233,8 @@ void
|
|||||||
rtsol_input(int s)
|
rtsol_input(int s)
|
||||||
{
|
{
|
||||||
u_char ntopbuf[INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
|
u_char ntopbuf[INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
|
||||||
int ifindex = 0, i, *hlimp = NULL;
|
int ifindex = 0, *hlimp = NULL;
|
||||||
|
ssize_t i;
|
||||||
struct in6_pktinfo *pi = NULL;
|
struct in6_pktinfo *pi = NULL;
|
||||||
struct ifinfo *ifi = NULL;
|
struct ifinfo *ifi = NULL;
|
||||||
struct icmp6_hdr *icp;
|
struct icmp6_hdr *icp;
|
||||||
@ -272,9 +275,9 @@ rtsol_input(int s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < sizeof(struct nd_router_advert)) {
|
if ((size_t)i < sizeof(struct nd_router_advert)) {
|
||||||
warnmsg(LOG_INFO, __func__,
|
warnmsg(LOG_INFO, __func__,
|
||||||
"packet size(%d) is too short", i);
|
"packet size(%zd) is too short", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ int main(int, char **);
|
|||||||
static int mobile_node = 0;
|
static int mobile_node = 0;
|
||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
static int do_dump;
|
static int do_dump;
|
||||||
static char *dumpfilename = "/var/run/rtsold.dump"; /* XXX: should be configurable */
|
static const char *dumpfilename = "/var/run/rtsold.dump"; /* XXX: should be configurable */
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
static char *pidfilename = "/var/run/rtsold.pid"; /* should be configurable */
|
static const char *pidfilename = "/var/run/rtsold.pid"; /* should be configurable */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -113,7 +113,8 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int s, ch, once = 0;
|
int s, ch, once = 0;
|
||||||
struct timeval *timeout;
|
struct timeval *timeout;
|
||||||
char *argv0, *opts;
|
char *argv0;
|
||||||
|
const char *opts;
|
||||||
#ifdef HAVE_POLL_H
|
#ifdef HAVE_POLL_H
|
||||||
struct pollfd set[2];
|
struct pollfd set[2];
|
||||||
#else
|
#else
|
||||||
@ -734,7 +735,7 @@ rtsol_timer_update(struct ifinfo *ifinfo)
|
|||||||
|
|
||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
static void
|
static void
|
||||||
rtsold_set_dump_file(int sig)
|
rtsold_set_dump_file(int sig __unused)
|
||||||
{
|
{
|
||||||
do_dump = 1;
|
do_dump = 1;
|
||||||
}
|
}
|
||||||
@ -790,7 +791,7 @@ autoifprobe(void)
|
|||||||
static char **argv = NULL;
|
static char **argv = NULL;
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
char **a;
|
char **a;
|
||||||
int s, i, found;
|
int s = 0, i, found;
|
||||||
struct ifaddrs *ifap, *ifa, *target;
|
struct ifaddrs *ifap, *ifa, *target;
|
||||||
struct in6_ndireq nd;
|
struct in6_ndireq nd;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ extern int probe_init(void);
|
|||||||
extern void defrouter_probe(struct ifinfo *);
|
extern void defrouter_probe(struct ifinfo *);
|
||||||
|
|
||||||
/* dump.c */
|
/* dump.c */
|
||||||
extern void rtsold_dump_file(char *);
|
extern void rtsold_dump_file(const char *);
|
||||||
|
|
||||||
/* rtsock.c */
|
/* rtsock.c */
|
||||||
extern int rtsock_open(void);
|
extern int rtsock_open(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user