- Add static for functions and variables with internal linkage.

- Quiet down -Wcast-align warnings.
- Remove dead code.

There is no functionality change.
This commit is contained in:
Hiroki Sato 2017-01-13 06:22:49 +00:00
parent ee5d5813c0
commit 1296e1b0b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312013

View File

@ -100,7 +100,7 @@ struct ifc { /* Configuration of an interface */
TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */ TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */
int ifc_joined; /* joined to ff02::9 */ int ifc_joined; /* joined to ff02::9 */
}; };
TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); static TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head);
struct ifac { /* Adddress associated to an interface */ struct ifac { /* Adddress associated to an interface */
TAILQ_ENTRY(ifac) ifac_next; TAILQ_ENTRY(ifac) ifac_next;
@ -120,21 +120,21 @@ struct iff { /* Filters for an interface */
int iff_plen; int iff_plen;
}; };
struct ifc **index2ifc; static struct ifc **index2ifc;
unsigned int nindex2ifc; static unsigned int nindex2ifc;
struct ifc *loopifcp = NULL; /* pointing to loopback */ static struct ifc *loopifcp = NULL; /* pointing to loopback */
#ifdef HAVE_POLL_H #ifdef HAVE_POLL_H
struct pollfd set[2]; static struct pollfd set[2];
#else #else
fd_set *sockvecp; /* vector to select() for receiving */ static fd_set *sockvecp; /* vector to select() for receiving */
fd_set *recvecp; static fd_set *recvecp;
int fdmasks; static int fdmasks;
int maxfd; /* maximum fd for select() */ static int maxfd; /* maximum fd for select() */
#endif #endif
int rtsock; /* the routing socket */ static int rtsock; /* the routing socket */
int ripsock; /* socket to send/receive RIP datagram */ static int ripsock; /* socket to send/receive RIP datagram */
struct rip6 *ripbuf; /* packet buffer for sending */ static struct rip6 *ripbuf; /* packet buffer for sending */
/* /*
* Maintain the routes in a linked list. When the number of the routes * Maintain the routes in a linked list. When the number of the routes
@ -159,41 +159,43 @@ struct riprt {
time_t rrt_t; /* when the route validated */ time_t rrt_t; /* when the route validated */
int rrt_index; /* ifindex from which this route got */ int rrt_index; /* ifindex from which this route got */
}; };
TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); static TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head);
int dflag = 0; /* debug flag */ static int dflag = 0; /* debug flag */
int qflag = 0; /* quiet flag */ static int qflag = 0; /* quiet flag */
int nflag = 0; /* don't update kernel routing table */ static int nflag = 0; /* don't update kernel routing table */
int aflag = 0; /* age out even the statically defined routes */ static int aflag = 0; /* age out even the statically defined routes */
int hflag = 0; /* don't split horizon */ static int hflag = 0; /* don't split horizon */
int lflag = 0; /* exchange site local routes */ static int lflag = 0; /* exchange site local routes */
int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ static int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */
int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ static int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */
int sflag = 0; /* announce static routes w/ split horizon */ static int sflag = 0; /* announce static routes w/ split horizon */
int Sflag = 0; /* announce static routes to every interface */ static int Sflag = 0; /* announce static routes to every interface */
unsigned long routetag = 0; /* route tag attached on originating case */ static unsigned long routetag = 0; /* route tag attached on originating case */
char *filter[MAXFILTER]; static char *filter[MAXFILTER];
int filtertype[MAXFILTER]; static int filtertype[MAXFILTER];
int nfilter = 0; static int nfilter = 0;
pid_t pid; static pid_t pid;
struct sockaddr_storage ripsin; static struct sockaddr_storage ripsin;
int interval = 1; static int interval = 1;
time_t nextalarm = 0; static time_t nextalarm = 0;
time_t sup_trig_update = 0; #if 0
static time_t sup_trig_update = 0;
#endif
FILE *rtlog = NULL; static FILE *rtlog = NULL;
int logopened = 0; static int logopened = 0;
static int seq = 0; static int seq = 0;
volatile sig_atomic_t seenalrm; static volatile sig_atomic_t seenalrm;
volatile sig_atomic_t seenquit; static volatile sig_atomic_t seenquit;
volatile sig_atomic_t seenusr1; static volatile sig_atomic_t seenusr1;
#define RRTF_AGGREGATE 0x08000000 #define RRTF_AGGREGATE 0x08000000
#define RRTF_NOADVERTISE 0x10000000 #define RRTF_NOADVERTISE 0x10000000
@ -202,66 +204,67 @@ volatile sig_atomic_t seenusr1;
#define RRTF_CHANGED 0x80000000 #define RRTF_CHANGED 0x80000000
int main(int, char **); int main(int, char **);
void sighandler(int); static void sighandler(int);
void ripalarm(void); static void ripalarm(void);
void riprecv(void); static void riprecv(void);
void ripsend(struct ifc *, struct sockaddr_in6 *, int); static void ripsend(struct ifc *, struct sockaddr_in6 *, int);
int out_filter(struct riprt *, struct ifc *); static int out_filter(struct riprt *, struct ifc *);
void init(void); static void init(void);
void sockopt(struct ifc *); static void ifconfig(void);
void ifconfig(void); static int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int);
int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int); static void rtrecv(void);
void rtrecv(void); static int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *,
int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *,
const struct sockaddr_in6 *); const struct sockaddr_in6 *);
int rt_deladdr(struct ifc *, const struct sockaddr_in6 *, static int rt_deladdr(struct ifc *, const struct sockaddr_in6 *,
const struct sockaddr_in6 *); const struct sockaddr_in6 *);
void filterconfig(void); static void filterconfig(void);
int getifmtu(int); static int getifmtu(int);
const char *rttypes(struct rt_msghdr *); static const char *rttypes(struct rt_msghdr *);
const char *rtflags(struct rt_msghdr *); static const char *rtflags(struct rt_msghdr *);
const char *ifflags(int); static const char *ifflags(int);
int ifrt(struct ifc *, int); static int ifrt(struct ifc *, int);
void ifrt_p2p(struct ifc *, int); static void ifrt_p2p(struct ifc *, int);
void applymask(struct in6_addr *, struct in6_addr *); static void applyplen(struct in6_addr *, int);
void applyplen(struct in6_addr *, int); static void ifrtdump(int);
void ifrtdump(int); static void ifdump(int);
void ifdump(int); static void ifdump0(FILE *, const struct ifc *);
void ifdump0(FILE *, const struct ifc *); static void ifremove(int);
void ifremove(int); static void rtdump(int);
void rtdump(int); static void rt_entry(struct rt_msghdr *, int);
void rt_entry(struct rt_msghdr *, int); static void rtdexit(void);
void rtdexit(void); static void riprequest(struct ifc *, struct netinfo6 *, int,
void riprequest(struct ifc *, struct netinfo6 *, int,
struct sockaddr_in6 *); struct sockaddr_in6 *);
void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np); static void ripflush(struct ifc *, struct sockaddr_in6 *, int, struct netinfo6 *np);
void sendrequest(struct ifc *); static void sendrequest(struct ifc *);
int sin6mask2len(const struct sockaddr_in6 *); static int sin6mask2len(const struct sockaddr_in6 *);
int mask2len(const struct in6_addr *, int); static int mask2len(const struct in6_addr *, int);
int sendpacket(struct sockaddr_in6 *, int); static int sendpacket(struct sockaddr_in6 *, int);
int addroute(struct riprt *, const struct in6_addr *, struct ifc *); static int addroute(struct riprt *, const struct in6_addr *, struct ifc *);
int delroute(struct netinfo6 *, struct in6_addr *); static int delroute(struct netinfo6 *, struct in6_addr *);
struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *); #if 0
void krtread(int); static struct in6_addr *getroute(struct netinfo6 *, struct in6_addr *);
int tobeadv(struct riprt *, struct ifc *); #endif
char *allocopy(char *); static void krtread(int);
char *hms(void); static int tobeadv(struct riprt *, struct ifc *);
const char *inet6_n2p(const struct in6_addr *); static char *allocopy(char *);
struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int); static char *hms(void);
struct in6_addr *plen2mask(int); static const char *inet6_n2p(const struct in6_addr *);
struct riprt *rtsearch(struct netinfo6 *); static struct ifac *ifa_match(const struct ifc *, const struct in6_addr *, int);
int ripinterval(int); static struct in6_addr *plen2mask(int);
time_t ripsuptrig(void); static struct riprt *rtsearch(struct netinfo6 *);
void fatal(const char *, ...) static int ripinterval(int);
#if 0
static time_t ripsuptrig(void);
#endif
static void fatal(const char *, ...)
__attribute__((__format__(__printf__, 1, 2))); __attribute__((__format__(__printf__, 1, 2)));
void trace(int, const char *, ...) static void trace(int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3))); __attribute__((__format__(__printf__, 2, 3)));
void tracet(int, const char *, ...) static void tracet(int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3))); __attribute__((__format__(__printf__, 2, 3)));
unsigned int if_maxindex(void); static struct ifc *ifc_find(char *);
struct ifc *ifc_find(char *); static struct iff *iff_find(struct ifc *, int);
struct iff *iff_find(struct ifc *, int); static void setindex2ifc(int, struct ifc *);
void setindex2ifc(int, struct ifc *);
#define MALLOC(type) ((type *)malloc(sizeof(type))) #define MALLOC(type) ((type *)malloc(sizeof(type)))
@ -523,7 +526,7 @@ main(int argc, char *argv[])
} }
} }
void static void
sighandler(int signo) sighandler(int signo)
{ {
@ -547,7 +550,7 @@ sighandler(int signo)
* gracefully exits after resetting sockopts. * gracefully exits after resetting sockopts.
*/ */
/* ARGSUSED */ /* ARGSUSED */
void static void
rtdexit(void) rtdexit(void)
{ {
struct riprt *rrt; struct riprt *rrt;
@ -574,7 +577,7 @@ rtdexit(void)
* routes more precisely. * routes more precisely.
*/ */
/* ARGSUSED */ /* ARGSUSED */
void static void
ripalarm(void) ripalarm(void)
{ {
struct ifc *ifcp; struct ifc *ifcp;
@ -602,7 +605,7 @@ ripalarm(void)
alarm(ripinterval(SUPPLY_INTERVAL6)); alarm(ripinterval(SUPPLY_INTERVAL6));
} }
void static void
init(void) init(void)
{ {
int error; int error;
@ -752,7 +755,7 @@ init(void)
/* /*
* ripflush flushes the rip datagram stored in the rip buffer * ripflush flushes the rip datagram stored in the rip buffer
*/ */
void static void
ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np) ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *np)
{ {
int i; int i;
@ -807,7 +810,7 @@ ripflush(struct ifc *ifcp, struct sockaddr_in6 *sin6, int nrt, struct netinfo6 *
/* /*
* Generate RIP6_RESPONSE packets and send them. * Generate RIP6_RESPONSE packets and send them.
*/ */
void static void
ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag) ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag)
{ {
struct riprt *rrt; struct riprt *rrt;
@ -948,7 +951,7 @@ ripsend(struct ifc *ifcp, struct sockaddr_in6 *sin6, int flag)
/* /*
* outbound filter logic, per-route/interface. * outbound filter logic, per-route/interface.
*/ */
int static int
out_filter(struct riprt *rrt, struct ifc *ifcp) out_filter(struct riprt *rrt, struct ifc *ifcp)
{ {
struct iff *iffp; struct iff *iffp;
@ -1019,7 +1022,7 @@ out_filter(struct riprt *rrt, struct ifc *ifcp)
* Determine if the route is to be advertised on the specified interface. * Determine if the route is to be advertised on the specified interface.
* It checks options specified in the arguments and the split horizon rule. * It checks options specified in the arguments and the split horizon rule.
*/ */
int static int
tobeadv(struct riprt *rrt, struct ifc *ifcp) tobeadv(struct riprt *rrt, struct ifc *ifcp)
{ {
@ -1044,14 +1047,14 @@ tobeadv(struct riprt *rrt, struct ifc *ifcp)
/* /*
* Send a rip packet actually. * Send a rip packet actually.
*/ */
int static int
sendpacket(struct sockaddr_in6 *sin6, int len) sendpacket(struct sockaddr_in6 *sin6, int len)
{ {
struct msghdr m; struct msghdr m;
struct cmsghdr *cm; struct cmsghdr *cm;
struct iovec iov[2]; struct iovec iov[2];
u_char cmsgbuf[256];
struct in6_pktinfo *pi; struct in6_pktinfo *pi;
u_char cmsgbuf[256];
int idx; int idx;
struct sockaddr_in6 sincopy; struct sockaddr_in6 sincopy;
@ -1077,14 +1080,14 @@ sendpacket(struct sockaddr_in6 *sin6, int len)
m.msg_controllen = 0; m.msg_controllen = 0;
} else { } else {
memset(cmsgbuf, 0, sizeof(cmsgbuf)); memset(cmsgbuf, 0, sizeof(cmsgbuf));
cm = (struct cmsghdr *)cmsgbuf; cm = (struct cmsghdr *)(void *)cmsgbuf;
m.msg_control = (caddr_t)cm; m.msg_control = (caddr_t)cm;
m.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo)); m.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
cm->cmsg_level = IPPROTO_IPV6; cm->cmsg_level = IPPROTO_IPV6;
cm->cmsg_type = IPV6_PKTINFO; cm->cmsg_type = IPV6_PKTINFO;
pi = (struct in6_pktinfo *)CMSG_DATA(cm); pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm);
memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*::*/ memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*::*/
pi->ipi6_ifindex = idx; pi->ipi6_ifindex = idx;
} }
@ -1101,7 +1104,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len)
* Receive and process RIP packets. Update the routes/kernel forwarding * Receive and process RIP packets. Update the routes/kernel forwarding
* table if necessary. * table if necessary.
*/ */
void static void
riprecv(void) riprecv(void)
{ {
struct ifc *ifcp, *ic; struct ifc *ifcp, *ic;
@ -1133,7 +1136,7 @@ riprecv(void)
iov[0].iov_len = sizeof(buf); iov[0].iov_len = sizeof(buf);
m.msg_iov = iov; m.msg_iov = iov;
m.msg_iovlen = 1; m.msg_iovlen = 1;
cm = (struct cmsghdr *)cmsgbuf; cm = (struct cmsghdr *)(void *)cmsgbuf;
m.msg_control = (caddr_t)cm; m.msg_control = (caddr_t)cm;
m.msg_controllen = sizeof(cmsgbuf); m.msg_controllen = sizeof(cmsgbuf);
m.msg_flags = 0; m.msg_flags = 0;
@ -1154,7 +1157,7 @@ riprecv(void)
"invalid cmsg length for IPV6_PKTINFO\n"); "invalid cmsg length for IPV6_PKTINFO\n");
return; return;
} }
pi = (struct in6_pktinfo *)(CMSG_DATA(cm)); pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm);
idx = pi->ipi6_ifindex; idx = pi->ipi6_ifindex;
break; break;
case IPV6_HOPLIMIT: case IPV6_HOPLIMIT:
@ -1163,7 +1166,7 @@ riprecv(void)
"invalid cmsg length for IPV6_HOPLIMIT\n"); "invalid cmsg length for IPV6_HOPLIMIT\n");
return; return;
} }
hlimp = (int *)CMSG_DATA(cm); hlimp = (int *)(void *)CMSG_DATA(cm);
break; break;
} }
} }
@ -1188,7 +1191,7 @@ riprecv(void)
nh = fsock.sin6_addr; nh = fsock.sin6_addr;
nn = (len - sizeof(struct rip6) + sizeof(struct netinfo6)) / nn = (len - sizeof(struct rip6) + sizeof(struct netinfo6)) /
sizeof(struct netinfo6); sizeof(struct netinfo6);
rp = (struct rip6 *)buf; rp = (struct rip6 *)(void *)buf;
np = rp->rip6_nets; np = rp->rip6_nets;
if (rp->rip6_vers != RIP6_VERSION) { if (rp->rip6_vers != RIP6_VERSION) {
@ -1449,7 +1452,7 @@ riprecv(void)
/* /*
* Send all routes request packet to the specified interface. * Send all routes request packet to the specified interface.
*/ */
void static void
sendrequest(struct ifc *ifcp) sendrequest(struct ifc *ifcp)
{ {
struct netinfo6 *np; struct netinfo6 *np;
@ -1477,7 +1480,7 @@ sendrequest(struct ifc *ifcp)
/* /*
* Process a RIP6_REQUEST packet. * Process a RIP6_REQUEST packet.
*/ */
void static void
riprequest(struct ifc *ifcp, riprequest(struct ifc *ifcp,
struct netinfo6 *np, struct netinfo6 *np,
int nn, int nn,
@ -1508,7 +1511,7 @@ riprequest(struct ifc *ifcp,
/* /*
* Get information of each interface. * Get information of each interface.
*/ */
void static void
ifconfig(void) ifconfig(void)
{ {
struct ifaddrs *ifap, *ifa; struct ifaddrs *ifap, *ifa;
@ -1583,7 +1586,7 @@ ifconfig(void)
freeifaddrs(ifap); freeifaddrs(ifap);
} }
int static int
ifconfig1(const char *name, ifconfig1(const char *name,
const struct sockaddr *sa, const struct sockaddr *sa,
struct ifc *ifcp, struct ifc *ifcp,
@ -1595,7 +1598,7 @@ ifconfig1(const char *name,
int plen; int plen;
char buf[BUFSIZ]; char buf[BUFSIZ];
sin6 = (const struct sockaddr_in6 *)sa; sin6 = (const struct sockaddr_in6 *)(const void *)sa;
if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && !lflag) if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr) && !lflag)
return (-1); return (-1);
ifr.ifr_addr = *sin6; ifr.ifr_addr = *sin6;
@ -1663,7 +1666,7 @@ ifconfig1(const char *name,
return 0; return 0;
} }
void static void
ifremove(int ifindex) ifremove(int ifindex)
{ {
struct ifc *ifcp; struct ifc *ifcp;
@ -1691,7 +1694,7 @@ ifremove(int ifindex)
* Receive and process routing messages. * Receive and process routing messages.
* Update interface information as necesssary. * Update interface information as necesssary.
*/ */
void static void
rtrecv(void) rtrecv(void)
{ {
char buf[BUFSIZ]; char buf[BUFSIZ];
@ -1730,33 +1733,34 @@ rtrecv(void)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
for (p = buf; p - buf < len; p += ((struct rt_msghdr *)p)->rtm_msglen) { for (p = buf; p - buf < len; p +=
if (((struct rt_msghdr *)p)->rtm_version != RTM_VERSION) ((struct rt_msghdr *)(void *)p)->rtm_msglen) {
if (((struct rt_msghdr *)(void *)p)->rtm_version != RTM_VERSION)
continue; continue;
/* safety against bogus message */ /* safety against bogus message */
if (((struct rt_msghdr *)p)->rtm_msglen <= 0) { if (((struct rt_msghdr *)(void *)p)->rtm_msglen <= 0) {
trace(1, "bogus rtmsg: length=%d\n", trace(1, "bogus rtmsg: length=%d\n",
((struct rt_msghdr *)p)->rtm_msglen); ((struct rt_msghdr *)(void *)p)->rtm_msglen);
break; break;
} }
rtm = NULL; rtm = NULL;
ifam = NULL; ifam = NULL;
ifm = NULL; ifm = NULL;
switch (((struct rt_msghdr *)p)->rtm_type) { switch (((struct rt_msghdr *)(void *)p)->rtm_type) {
case RTM_NEWADDR: case RTM_NEWADDR:
case RTM_DELADDR: case RTM_DELADDR:
ifam = (struct ifa_msghdr *)p; ifam = (struct ifa_msghdr *)(void *)p;
addrs = ifam->ifam_addrs; addrs = ifam->ifam_addrs;
q = (char *)(ifam + 1); q = (char *)(ifam + 1);
break; break;
case RTM_IFINFO: case RTM_IFINFO:
ifm = (struct if_msghdr *)p; ifm = (struct if_msghdr *)(void *)p;
addrs = ifm->ifm_addrs; addrs = ifm->ifm_addrs;
q = (char *)(ifm + 1); q = (char *)(ifm + 1);
break; break;
case RTM_IFANNOUNCE: case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)p; ifan = (struct if_announcemsghdr *)(void *)p;
switch (ifan->ifan_what) { switch (ifan->ifan_what) {
case IFAN_ARRIVAL: case IFAN_ARRIVAL:
iface++; iface++;
@ -1768,7 +1772,7 @@ rtrecv(void)
} }
break; break;
default: default:
rtm = (struct rt_msghdr *)p; rtm = (struct rt_msghdr *)(void *)p;
addrs = rtm->rtm_addrs; addrs = rtm->rtm_addrs;
q = (char *)(rtm + 1); q = (char *)(rtm + 1);
if (rtm->rtm_version != RTM_VERSION) { if (rtm->rtm_version != RTM_VERSION) {
@ -1788,16 +1792,16 @@ rtrecv(void)
memset(&rta, 0, sizeof(rta)); memset(&rta, 0, sizeof(rta));
for (i = 0; i < RTAX_MAX; i++) { for (i = 0; i < RTAX_MAX; i++) {
if (addrs & (1 << i)) { if (addrs & (1 << i)) {
rta[i] = (struct sockaddr_in6 *)q; rta[i] = (struct sockaddr_in6 *)(void *)q;
q += ROUNDUP(rta[i]->sin6_len); q += ROUNDUP(rta[i]->sin6_len);
} }
} }
trace(1, "rtsock: %s (addrs=%x)\n", trace(1, "rtsock: %s (addrs=%x)\n",
rttypes((struct rt_msghdr *)p), addrs); rttypes((struct rt_msghdr *)(void *)p), addrs);
if (dflag >= 2) { if (dflag >= 2) {
for (i = 0; for (i = 0;
i < ((struct rt_msghdr *)p)->rtm_msglen; i < ((struct rt_msghdr *)(void *)p)->rtm_msglen;
i++) { i++) {
fprintf(stderr, "%02x ", p[i] & 0xff); fprintf(stderr, "%02x ", p[i] & 0xff);
if (i % 16 == 15) fprintf(stderr, "\n"); if (i % 16 == 15) fprintf(stderr, "\n");
@ -1811,7 +1815,7 @@ rtrecv(void)
* We may be able to optimize by using ifm->ifm_index or * We may be able to optimize by using ifm->ifm_index or
* ifam->ifam_index. For simplicity we don't do that here. * ifam->ifam_index. For simplicity we don't do that here.
*/ */
switch (((struct rt_msghdr *)p)->rtm_type) { switch (((struct rt_msghdr *)(void *)p)->rtm_type) {
case RTM_NEWADDR: case RTM_NEWADDR:
case RTM_IFINFO: case RTM_IFINFO:
iface++; iface++;
@ -1852,7 +1856,7 @@ rtrecv(void)
#endif #endif
/* hard ones */ /* hard ones */
switch (((struct rt_msghdr *)p)->rtm_type) { switch (((struct rt_msghdr *)(void *)p)->rtm_type) {
case RTM_NEWADDR: case RTM_NEWADDR:
case RTM_IFINFO: case RTM_IFINFO:
case RTM_ADD: case RTM_ADD:
@ -1940,7 +1944,7 @@ rtrecv(void)
/* /*
* remove specified route from the internal routing table. * remove specified route from the internal routing table.
*/ */
int static int
rt_del(const struct sockaddr_in6 *sdst, rt_del(const struct sockaddr_in6 *sdst,
const struct sockaddr_in6 *sgw, const struct sockaddr_in6 *sgw,
const struct sockaddr_in6 *smask) const struct sockaddr_in6 *smask)
@ -2038,7 +2042,7 @@ rt_del(const struct sockaddr_in6 *sdst,
/* /*
* remove specified address from internal interface/routing table. * remove specified address from internal interface/routing table.
*/ */
int static int
rt_deladdr(struct ifc *ifcp, rt_deladdr(struct ifc *ifcp,
const struct sockaddr_in6 *sifa, const struct sockaddr_in6 *sifa,
const struct sockaddr_in6 *smask) const struct sockaddr_in6 *smask)
@ -2139,7 +2143,7 @@ rt_deladdr(struct ifc *ifcp,
* Get each interface address and put those interface routes to the route * Get each interface address and put those interface routes to the route
* list. * list.
*/ */
int static int
ifrt(struct ifc *ifcp, int again) ifrt(struct ifc *ifcp, int again)
{ {
struct ifac *ifac; struct ifac *ifac;
@ -2250,7 +2254,7 @@ ifrt(struct ifc *ifcp, int again)
* you pick one. it looks that gated behavior fits best with BSDs, * you pick one. it looks that gated behavior fits best with BSDs,
* since BSD kernels do not look at prefix length on p2p interfaces. * since BSD kernels do not look at prefix length on p2p interfaces.
*/ */
void static void
ifrt_p2p(struct ifc *ifcp, int again) ifrt_p2p(struct ifc *ifcp, int again)
{ {
struct ifac *ifac; struct ifac *ifac;
@ -2414,7 +2418,7 @@ ifrt_p2p(struct ifc *ifcp, int again)
#undef P2PADVERT_MAX #undef P2PADVERT_MAX
} }
int static int
getifmtu(int ifindex) getifmtu(int ifindex)
{ {
int mib[6]; int mib[6];
@ -2441,7 +2445,7 @@ getifmtu(int ifindex)
fatal("sysctl NET_RT_IFLIST"); fatal("sysctl NET_RT_IFLIST");
/*NOTREACHED*/ /*NOTREACHED*/
} }
ifm = (struct if_msghdr *)buf; ifm = (struct if_msghdr *)(void *)buf;
mtu = ifm->ifm_data.ifi_mtu; mtu = ifm->ifm_data.ifi_mtu;
if (ifindex != ifm->ifm_index) { if (ifindex != ifm->ifm_index) {
fatal("ifindex does not match with ifm_index"); fatal("ifindex does not match with ifm_index");
@ -2451,7 +2455,7 @@ getifmtu(int ifindex)
return mtu; return mtu;
} }
const char * static const char *
rttypes(struct rt_msghdr *rtm) rttypes(struct rt_msghdr *rtm)
{ {
#define RTTYPE(s, f) \ #define RTTYPE(s, f) \
@ -2486,7 +2490,7 @@ do { \
return NULL; return NULL;
} }
const char * static const char *
rtflags(struct rt_msghdr *rtm) rtflags(struct rt_msghdr *rtm)
{ {
static char buf[BUFSIZ]; static char buf[BUFSIZ];
@ -2546,7 +2550,7 @@ do { \
return buf; return buf;
} }
const char * static const char *
ifflags(int flags) ifflags(int flags)
{ {
static char buf[BUFSIZ]; static char buf[BUFSIZ];
@ -2582,7 +2586,7 @@ do { \
return buf; return buf;
} }
void static void
krtread(int again) krtread(int again)
{ {
int mib[6]; int mib[6];
@ -2631,13 +2635,13 @@ krtread(int again)
lim = buf + msize; lim = buf + msize;
for (p = buf; p < lim; p += rtm->rtm_msglen) { for (p = buf; p < lim; p += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)p; rtm = (struct rt_msghdr *)(void *)p;
rt_entry(rtm, again); rt_entry(rtm, again);
} }
free(buf); free(buf);
} }
void static void
rt_entry(struct rt_msghdr *rtm, int again) rt_entry(struct rt_msghdr *rtm, int again)
{ {
struct sockaddr_in6 *sin6_dst, *sin6_gw, *sin6_mask; struct sockaddr_in6 *sin6_dst, *sin6_gw, *sin6_mask;
@ -2674,22 +2678,22 @@ rt_entry(struct rt_msghdr *rtm, int again)
/* Destination */ /* Destination */
if ((rtm->rtm_addrs & RTA_DST) == 0) if ((rtm->rtm_addrs & RTA_DST) == 0)
return; /* ignore routes without destination address */ return; /* ignore routes without destination address */
sin6_dst = (struct sockaddr_in6 *)rtmp; sin6_dst = (struct sockaddr_in6 *)(void *)rtmp;
rtmp += ROUNDUP(sin6_dst->sin6_len); rtmp += ROUNDUP(sin6_dst->sin6_len);
if (rtm->rtm_addrs & RTA_GATEWAY) { if (rtm->rtm_addrs & RTA_GATEWAY) {
sin6_gw = (struct sockaddr_in6 *)rtmp; sin6_gw = (struct sockaddr_in6 *)(void *)rtmp;
rtmp += ROUNDUP(sin6_gw->sin6_len); rtmp += ROUNDUP(sin6_gw->sin6_len);
} }
if (rtm->rtm_addrs & RTA_NETMASK) { if (rtm->rtm_addrs & RTA_NETMASK) {
sin6_mask = (struct sockaddr_in6 *)rtmp; sin6_mask = (struct sockaddr_in6 *)(void *)rtmp;
rtmp += ROUNDUP(sin6_mask->sin6_len); rtmp += ROUNDUP(sin6_mask->sin6_len);
} }
if (rtm->rtm_addrs & RTA_GENMASK) { if (rtm->rtm_addrs & RTA_GENMASK) {
sin6_genmask = (struct sockaddr_in6 *)rtmp; sin6_genmask = (struct sockaddr_in6 *)(void *)rtmp;
rtmp += ROUNDUP(sin6_genmask->sin6_len); rtmp += ROUNDUP(sin6_genmask->sin6_len);
} }
if (rtm->rtm_addrs & RTA_IFP) { if (rtm->rtm_addrs & RTA_IFP) {
sin6_ifp = (struct sockaddr_in6 *)rtmp; sin6_ifp = (struct sockaddr_in6 *)(void *)rtmp;
rtmp += ROUNDUP(sin6_ifp->sin6_len); rtmp += ROUNDUP(sin6_ifp->sin6_len);
} }
@ -2798,7 +2802,7 @@ rt_entry(struct rt_msghdr *rtm, int again)
TAILQ_INSERT_HEAD(&riprt_head, rrt, rrt_next); TAILQ_INSERT_HEAD(&riprt_head, rrt, rrt_next);
} }
int static int
addroute(struct riprt *rrt, addroute(struct riprt *rrt,
const struct in6_addr *gw, const struct in6_addr *gw,
struct ifc *ifcp) struct ifc *ifcp)
@ -2823,7 +2827,7 @@ addroute(struct riprt *rrt,
return 0; return 0;
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
rtm = (struct rt_msghdr *)buf; rtm = (struct rt_msghdr *)(void *)buf;
rtm->rtm_type = RTM_ADD; rtm->rtm_type = RTM_ADD;
rtm->rtm_version = RTM_VERSION; rtm->rtm_version = RTM_VERSION;
rtm->rtm_seq = ++seq; rtm->rtm_seq = ++seq;
@ -2833,24 +2837,24 @@ addroute(struct riprt *rrt,
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
rtm->rtm_rmx.rmx_hopcount = np->rip6_metric - 1; rtm->rtm_rmx.rmx_hopcount = np->rip6_metric - 1;
rtm->rtm_inits = RTV_HOPCOUNT; rtm->rtm_inits = RTV_HOPCOUNT;
sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)];
/* Destination */ /* Destination */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = np->rip6_dest; sin6->sin6_addr = np->rip6_dest;
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
/* Gateway */ /* Gateway */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = *gw; sin6->sin6_addr = *gw;
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
sin6->sin6_scope_id = ifcp->ifc_index; sin6->sin6_scope_id = ifcp->ifc_index;
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
/* Netmask */ /* Netmask */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = *(plen2mask(np->rip6_plen)); sin6->sin6_addr = *(plen2mask(np->rip6_plen));
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
len = (char *)sin6 - (char *)buf; len = (char *)sin6 - (char *)buf;
rtm->rtm_msglen = len; rtm->rtm_msglen = len;
@ -2873,7 +2877,7 @@ addroute(struct riprt *rrt,
return -1; return -1;
} }
int static int
delroute(struct netinfo6 *np, struct in6_addr *gw) delroute(struct netinfo6 *np, struct in6_addr *gw)
{ {
u_char buf[BUFSIZ], buf2[BUFSIZ]; u_char buf[BUFSIZ], buf2[BUFSIZ];
@ -2891,7 +2895,7 @@ delroute(struct netinfo6 *np, struct in6_addr *gw)
return 0; return 0;
memset(buf, 0, sizeof(buf)); memset(buf, 0, sizeof(buf));
rtm = (struct rt_msghdr *)buf; rtm = (struct rt_msghdr *)(void *)buf;
rtm->rtm_type = RTM_DELETE; rtm->rtm_type = RTM_DELETE;
rtm->rtm_version = RTM_VERSION; rtm->rtm_version = RTM_VERSION;
rtm->rtm_seq = ++seq; rtm->rtm_seq = ++seq;
@ -2901,22 +2905,22 @@ delroute(struct netinfo6 *np, struct in6_addr *gw)
if (np->rip6_plen == sizeof(struct in6_addr) * 8) if (np->rip6_plen == sizeof(struct in6_addr) * 8)
rtm->rtm_flags |= RTF_HOST; rtm->rtm_flags |= RTF_HOST;
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK; rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)];
/* Destination */ /* Destination */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = np->rip6_dest; sin6->sin6_addr = np->rip6_dest;
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
/* Gateway */ /* Gateway */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = *gw; sin6->sin6_addr = *gw;
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
/* Netmask */ /* Netmask */
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = *(plen2mask(np->rip6_plen)); sin6->sin6_addr = *(plen2mask(np->rip6_plen));
sin6 = (struct sockaddr_in6 *)((char *)sin6 + ROUNDUP(sin6->sin6_len)); sin6 = (struct sockaddr_in6 *)(void *)((char *)sin6 + ROUNDUP(sin6->sin6_len));
len = (char *)sin6 - (char *)buf; len = (char *)sin6 - (char *)buf;
rtm->rtm_msglen = len; rtm->rtm_msglen = len;
@ -2939,7 +2943,8 @@ delroute(struct netinfo6 *np, struct in6_addr *gw)
return -1; return -1;
} }
struct in6_addr * #if 0
static struct in6_addr *
getroute(struct netinfo6 *np, struct in6_addr *gw) getroute(struct netinfo6 *np, struct in6_addr *gw)
{ {
u_char buf[BUFSIZ]; u_char buf[BUFSIZ];
@ -2948,7 +2953,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw)
struct rt_msghdr *rtm; struct rt_msghdr *rtm;
struct sockaddr_in6 *sin6; struct sockaddr_in6 *sin6;
rtm = (struct rt_msghdr *)buf; rtm = (struct rt_msghdr *)(void *)buf;
len = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in6); len = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in6);
memset(rtm, 0, len); memset(rtm, 0, len);
rtm->rtm_type = RTM_GET; rtm->rtm_type = RTM_GET;
@ -2957,7 +2962,7 @@ getroute(struct netinfo6 *np, struct in6_addr *gw)
rtm->rtm_seq = myseq; rtm->rtm_seq = myseq;
rtm->rtm_addrs = RTA_DST; rtm->rtm_addrs = RTA_DST;
rtm->rtm_msglen = len; rtm->rtm_msglen = len;
sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)];
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_addr = np->rip6_dest; sin6->sin6_addr = np->rip6_dest;
@ -2972,11 +2977,11 @@ getroute(struct netinfo6 *np, struct in6_addr *gw)
perror("read from rtsock"); perror("read from rtsock");
exit(1); exit(1);
} }
rtm = (struct rt_msghdr *)buf; rtm = (struct rt_msghdr *)(void *)buf;
} while (rtm->rtm_seq != myseq || rtm->rtm_pid != pid); } while (rtm->rtm_seq != myseq || rtm->rtm_pid != pid);
sin6 = (struct sockaddr_in6 *)&buf[sizeof(struct rt_msghdr)]; sin6 = (struct sockaddr_in6 *)(void *)&buf[sizeof(struct rt_msghdr)];
if (rtm->rtm_addrs & RTA_DST) { if (rtm->rtm_addrs & RTA_DST) {
sin6 = (struct sockaddr_in6 *) sin6 = (struct sockaddr_in6 *)(void *)
((char *)sin6 + ROUNDUP(sin6->sin6_len)); ((char *)sin6 + ROUNDUP(sin6->sin6_len));
} }
if (rtm->rtm_addrs & RTA_GATEWAY) { if (rtm->rtm_addrs & RTA_GATEWAY) {
@ -2985,8 +2990,9 @@ getroute(struct netinfo6 *np, struct in6_addr *gw)
} }
return NULL; return NULL;
} }
#endif
const char * static const char *
inet6_n2p(const struct in6_addr *p) inet6_n2p(const struct in6_addr *p)
{ {
static char buf[BUFSIZ]; static char buf[BUFSIZ];
@ -2994,7 +3000,7 @@ inet6_n2p(const struct in6_addr *p)
return inet_ntop(AF_INET6, (const void *)p, buf, sizeof(buf)); return inet_ntop(AF_INET6, (const void *)p, buf, sizeof(buf));
} }
void static void
ifrtdump(int sig) ifrtdump(int sig)
{ {
@ -3002,7 +3008,7 @@ ifrtdump(int sig)
rtdump(sig); rtdump(sig);
} }
void static void
ifdump(int sig) ifdump(int sig)
{ {
struct ifc *ifcp; struct ifc *ifcp;
@ -3041,7 +3047,7 @@ ifdump(int sig)
fclose(dump); fclose(dump);
} }
void static void
ifdump0(FILE *dump, const struct ifc *ifcp) ifdump0(FILE *dump, const struct ifc *ifcp)
{ {
struct ifac *ifac; struct ifac *ifac;
@ -3097,7 +3103,7 @@ ifdump0(FILE *dump, const struct ifc *ifcp)
fprintf(dump, "\n"); fprintf(dump, "\n");
} }
void static void
rtdump(int sig) rtdump(int sig)
{ {
struct riprt *rrt; struct riprt *rrt;
@ -3146,7 +3152,7 @@ rtdump(int sig)
* syntax: -A 5f09:c400::/32,ef0,ef1 (aggregate) * syntax: -A 5f09:c400::/32,ef0,ef1 (aggregate)
* -O 5f09:c400::/32,ef0,ef1 (only when match) * -O 5f09:c400::/32,ef0,ef1 (only when match)
*/ */
void static void
filterconfig(void) filterconfig(void)
{ {
int i; int i;
@ -3277,7 +3283,7 @@ filterconfig(void)
* Returns a pointer to ifac whose address and prefix length matches * Returns a pointer to ifac whose address and prefix length matches
* with the address and prefix length specified in the arguments. * with the address and prefix length specified in the arguments.
*/ */
struct ifac * static struct ifac *
ifa_match(const struct ifc *ifcp, ifa_match(const struct ifc *ifcp,
const struct in6_addr *ia, const struct in6_addr *ia,
int plen) int plen)
@ -3298,7 +3304,7 @@ ifa_match(const struct ifc *ifcp,
* matches with the address and prefix length found in the argument. * matches with the address and prefix length found in the argument.
* Note: This is not a rtalloc(). Therefore exact match is necessary. * Note: This is not a rtalloc(). Therefore exact match is necessary.
*/ */
struct riprt * static struct riprt *
rtsearch(struct netinfo6 *np) rtsearch(struct netinfo6 *np)
{ {
struct riprt *rrt; struct riprt *rrt;
@ -3313,7 +3319,7 @@ rtsearch(struct netinfo6 *np)
return (rrt); return (rrt);
} }
int static int
sin6mask2len(const struct sockaddr_in6 *sin6) sin6mask2len(const struct sockaddr_in6 *sin6)
{ {
@ -3321,7 +3327,7 @@ sin6mask2len(const struct sockaddr_in6 *sin6)
sin6->sin6_len - offsetof(struct sockaddr_in6, sin6_addr)); sin6->sin6_len - offsetof(struct sockaddr_in6, sin6_addr));
} }
int static int
mask2len(const struct in6_addr *addr, int lenlim) mask2len(const struct in6_addr *addr, int lenlim)
{ {
int i = 0, j; int i = 0, j;
@ -3348,22 +3354,11 @@ mask2len(const struct in6_addr *addr, int lenlim)
return i; return i;
} }
void
applymask(struct in6_addr *addr, struct in6_addr *mask)
{
int i;
u_long *p, *q;
p = (u_long *)addr; q = (u_long *)mask;
for (i = 0; i < 4; i++)
*p++ &= *q++;
}
static const u_char plent[8] = { static const u_char plent[8] = {
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
}; };
void static void
applyplen(struct in6_addr *ia, int plen) applyplen(struct in6_addr *ia, int plen)
{ {
u_char *p; u_char *p;
@ -3383,7 +3378,7 @@ static const int pl2m[9] = {
0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
}; };
struct in6_addr * static struct in6_addr *
plen2mask(int n) plen2mask(int n)
{ {
static struct in6_addr ia; static struct in6_addr ia;
@ -3403,7 +3398,7 @@ plen2mask(int n)
return &ia; return &ia;
} }
char * static char *
allocopy(char *p) allocopy(char *p)
{ {
int len = strlen(p) + 1; int len = strlen(p) + 1;
@ -3418,7 +3413,7 @@ allocopy(char *p)
return q; return q;
} }
char * static char *
hms(void) hms(void)
{ {
static char buf[BUFSIZ]; static char buf[BUFSIZ];
@ -3437,7 +3432,7 @@ hms(void)
#define RIPRANDDEV 1.0 /* 30 +- 15, max - min = 30 */ #define RIPRANDDEV 1.0 /* 30 +- 15, max - min = 30 */
int static int
ripinterval(int timer) ripinterval(int timer)
{ {
double r = rand(); double r = rand();
@ -3447,7 +3442,8 @@ ripinterval(int timer)
return interval; return interval;
} }
time_t #if 0
static time_t
ripsuptrig(void) ripsuptrig(void)
{ {
time_t t; time_t t;
@ -3458,8 +3454,9 @@ ripsuptrig(void)
sup_trig_update = time(NULL) + t; sup_trig_update = time(NULL) + t;
return t; return t;
} }
#endif
void static void
#ifdef __STDC__ #ifdef __STDC__
fatal(const char *fmt, ...) fatal(const char *fmt, ...)
#else #else
@ -3486,7 +3483,7 @@ fatal(fmt, va_alist)
rtdexit(); rtdexit();
} }
void static void
#ifdef __STDC__ #ifdef __STDC__
tracet(int level, const char *fmt, ...) tracet(int level, const char *fmt, ...)
#else #else
@ -3522,7 +3519,7 @@ tracet(level, fmt, va_alist)
} }
} }
void static void
#ifdef __STDC__ #ifdef __STDC__
trace(int level, const char *fmt, ...) trace(int level, const char *fmt, ...)
#else #else
@ -3557,22 +3554,7 @@ trace(level, fmt, va_alist)
} }
} }
unsigned int static struct ifc *
if_maxindex(void)
{
struct if_nameindex *p, *p0;
unsigned int max = 0;
p0 = if_nameindex();
for (p = p0; p && p->if_index && p->if_name; p++) {
if (max < p->if_index)
max = p->if_index;
}
if_freenameindex(p0);
return max;
}
struct ifc *
ifc_find(char *name) ifc_find(char *name)
{ {
struct ifc *ifcp; struct ifc *ifcp;
@ -3584,7 +3566,7 @@ ifc_find(char *name)
return (ifcp); return (ifcp);
} }
struct iff * static struct iff *
iff_find(struct ifc *ifcp, int type) iff_find(struct ifc *ifcp, int type)
{ {
struct iff *iffp; struct iff *iffp;
@ -3598,7 +3580,7 @@ iff_find(struct ifc *ifcp, int type)
return (iffp); return (iffp);
} }
void static void
setindex2ifc(int idx, struct ifc *ifcp) setindex2ifc(int idx, struct ifc *ifcp)
{ {
int n, nsize; int n, nsize;