summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-08-08 16:56:01 +0000
committerume <ume@FreeBSD.org>2003-08-08 16:56:01 +0000
commit958362f6a8e61ad6b4a95057c871838e4d4de29a (patch)
tree178f6af642cf6aacbd3415e4286f66d0b9bd3bba /usr.sbin/rtadvd
parent0820e437dc59b5da388bb504e58d1f00bd256862 (diff)
downloadFreeBSD-src-958362f6a8e61ad6b4a95057c871838e4d4de29a.zip
FreeBSD-src-958362f6a8e61ad6b4a95057c871838e4d4de29a.tar.gz
KNF, correct typos and cleanup spaces.
Obtained from: KAME MFC after: 1 week
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r--usr.sbin/rtadvd/advcap.c4
-rw-r--r--usr.sbin/rtadvd/config.c13
-rw-r--r--usr.sbin/rtadvd/dump.c47
-rw-r--r--usr.sbin/rtadvd/if.c31
-rw-r--r--usr.sbin/rtadvd/rrenum.c4
-rw-r--r--usr.sbin/rtadvd/rtadvd.c22
-rw-r--r--usr.sbin/rtadvd/rtadvd.h5
-rw-r--r--usr.sbin/rtadvd/timer.c12
-rw-r--r--usr.sbin/rtadvd/timer.h6
9 files changed, 66 insertions, 78 deletions
diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c
index 54c5369..2909801 100644
--- a/usr.sbin/rtadvd/advcap.c
+++ b/usr.sbin/rtadvd/advcap.c
@@ -161,7 +161,7 @@ getent(bp, name, cp)
}
break;
}
- if (cp >= bp+BUFSIZ) {
+ if (cp >= bp + BUFSIZ) {
write(STDERR_FILENO, "Remcap entry too long\n",
23);
break;
@@ -198,7 +198,7 @@ tnchktc()
p = tbuf + strlen(tbuf) - 2; /* before the last colon */
while (*--p != ':')
- if (p<tbuf) {
+ if (p < tbuf) {
write(STDERR_FILENO, "Bad remcap entry\n", 18);
return (0);
}
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index bc56cd3..e7d9409 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -233,8 +233,7 @@ getconfig(intface)
MAYHAVE(val64, "retrans", DEF_ADVRETRANSTIMER);
if (val64 < 0 || val64 > 0xffffffff) {
- syslog(LOG_ERR,
- "<%s> retrans time out of range", __func__);
+ syslog(LOG_ERR, "<%s> retrans time out of range", __func__);
exit(1);
}
tmp->retranstimer = (u_int32_t)val64;
@@ -276,7 +275,7 @@ getconfig(intface)
/* prefix information */
/*
- * This is an implementation specific parameter to consinder
+ * This is an implementation specific parameter to consider
* link propagation delays and poorly synchronized clocks when
* checking consistency of advertised lifetimes.
*/
@@ -567,6 +566,7 @@ get_prefix(struct rainfo *rai)
__func__);
exit(1);
}
+
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
int plen;
@@ -577,7 +577,6 @@ get_prefix(struct rainfo *rai)
a = &((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
if (IN6_IS_ADDR_LINKLOCAL(a))
continue;
-
/* get prefix length */
m = (u_char *)&((struct sockaddr_in6 *)ifa->ifa_netmask)->sin6_addr;
lim = (u_char *)(ifa->ifa_netmask) + ifa->ifa_netmask->sa_len;
@@ -611,7 +610,6 @@ get_prefix(struct rainfo *rai)
*p++ &= *m++;
while (p < ep)
*p++ = 0x00;
-
if (!inet_ntop(AF_INET6, &pp->prefix, ntopbuf,
sizeof(ntopbuf))) {
syslog(LOG_ERR, "<%s> inet_ntop failed", __func__);
@@ -839,7 +837,7 @@ init_prefix(struct in6_prefixreq *ipr)
ipr->ipr_pltime = DEF_ADVPREFERREDLIFETIME;
ipr->ipr_raf_onlink = 1;
ipr->ipr_raf_auto = 1;
- return 0;
+ return 0;
#endif
}
@@ -887,8 +885,7 @@ make_packet(struct rainfo *rainfo)
if ((lladdroptlen = lladdropt_length(rainfo->sdl)) == 0) {
syslog(LOG_INFO,
"<%s> link-layer address option has"
- " null length on %s."
- " Treat as not included.",
+ " null length on %s. Treat as not included.",
__func__, rainfo->ifname);
rainfo->advlinkopt = 0;
}
diff --git a/usr.sbin/rtadvd/dump.c b/usr.sbin/rtadvd/dump.c
index b6d2298..796ba90 100644
--- a/usr.sbin/rtadvd/dump.c
+++ b/usr.sbin/rtadvd/dump.c
@@ -90,10 +90,8 @@ ether_str(sdl)
cp = (u_char *)LLADDR(sdl);
sprintf(ebuf, "%x:%x:%x:%x:%x:%x",
cp[0], cp[1], cp[2], cp[3], cp[4], cp[5]);
- }
- else {
+ } else
sprintf(ebuf, "NONE");
- }
return(ebuf);
}
@@ -119,11 +117,11 @@ if_dump()
if (rai->lastsent.tv_sec) {
/* note that ctime() appends CR by itself */
fprintf(fp, " Last RA sent: %s",
- ctime((time_t *)&rai->lastsent.tv_sec));
+ ctime((time_t *)&rai->lastsent.tv_sec));
}
if (rai->timer) {
fprintf(fp, " Next RA will be sent: %s",
- ctime((time_t *)&rai->timer->tm.tv_sec));
+ ctime((time_t *)&rai->timer->tm.tv_sec));
}
else
fprintf(fp, " RA timer is stopped");
@@ -131,32 +129,30 @@ if_dump()
rai->waiting, rai->initcounter);
/* statistics */
- fprintf(fp,
- " statistics: RA(out/in/inconsistent): "
- LONGLONG "/" LONGLONG "/" LONGLONG ", ",
- (unsigned long long)rai->raoutput,
- (unsigned long long)rai->rainput,
- (unsigned long long)rai->rainconsistent);
+ fprintf(fp, " statistics: RA(out/in/inconsistent): "
+ LONGLONG "/" LONGLONG "/" LONGLONG ", ",
+ (unsigned long long)rai->raoutput,
+ (unsigned long long)rai->rainput,
+ (unsigned long long)rai->rainconsistent);
fprintf(fp, "RS(input): " LONGLONG "\n",
- (unsigned long long)rai->rsinput);
+ (unsigned long long)rai->rsinput);
/* interface information */
if (rai->advlinkopt)
fprintf(fp, " Link-layer address: %s\n",
- ether_str(rai->sdl));
+ ether_str(rai->sdl));
fprintf(fp, " MTU: %d\n", rai->phymtu);
/* Router configuration variables */
- fprintf(fp,
- " DefaultLifetime: %d, MaxAdvInterval: %d, "
- "MinAdvInterval: %d\n",
- rai->lifetime, rai->maxinterval, rai->mininterval);
+ fprintf(fp, " DefaultLifetime: %d, MaxAdvInterval: %d, "
+ "MinAdvInterval: %d\n", rai->lifetime, rai->maxinterval,
+ rai->mininterval);
fprintf(fp, " Flags: %s%s%s, ",
- rai->managedflg ? "M" : "", rai->otherflg ? "O" : "",
+ rai->managedflg ? "M" : "", rai->otherflg ? "O" : "",
#ifdef MIP6
- rai->haflg ? "H" :
+ rai->haflg ? "H" :
#endif
- "");
+ "");
fprintf(fp, "Preference: %s, ",
rtpref_str[(rai->rtpref >> 3) & 0xff]);
fprintf(fp, "MTU: %d\n", rai->linkmtu);
@@ -170,7 +166,7 @@ if_dump()
if (rai->clockskew)
fprintf(fp, " Clock skew: %ldsec\n",
- rai->clockskew);
+ rai->clockskew);
for (first = 1, pfx = rai->prefix.next; pfx != &rai->prefix;
pfx = pfx->next) {
if (first) {
@@ -178,10 +174,9 @@ if_dump()
first = 0;
}
fprintf(fp, " %s/%d(",
- inet_ntop(AF_INET6, &pfx->prefix,
- prefixbuf, sizeof(prefixbuf)),
- pfx->prefixlen);
- switch(pfx->origin) {
+ inet_ntop(AF_INET6, &pfx->prefix, prefixbuf,
+ sizeof(prefixbuf)), pfx->prefixlen);
+ switch (pfx->origin) {
case PREFIX_FROM_KERNEL:
fprintf(fp, "KERNEL, ");
break;
@@ -241,7 +236,7 @@ rtadvd_dump_file(dumpfile)
{
if ((fp = fopen(dumpfile, "w")) == NULL) {
syslog(LOG_WARNING, "<%s> open a dump file(%s)",
- __func__, dumpfile);
+ __func__, dumpfile);
return;
}
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c
index daf06aa..f483ff4 100644
--- a/usr.sbin/rtadvd/if.c
+++ b/usr.sbin/rtadvd/if.c
@@ -215,11 +215,11 @@ if_getflags(int ifindex, int oifflags)
int
lladdropt_length(struct sockaddr_dl *sdl)
{
- switch(sdl->sdl_type) {
- case IFT_ETHER:
- return(ROUNDUP8(ETHER_ADDR_LEN + 2));
- default:
- return(0);
+ switch (sdl->sdl_type) {
+ case IFT_ETHER:
+ return(ROUNDUP8(ETHER_ADDR_LEN + 2));
+ default:
+ return(0);
}
}
@@ -230,17 +230,16 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt)
ndopt->nd_opt_type = ND_OPT_SOURCE_LINKADDR; /* fixed */
- switch(sdl->sdl_type) {
- case IFT_ETHER:
- ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3;
- addr = (char *)(ndopt + 1);
- memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN);
- break;
- default:
- syslog(LOG_ERR,
- "<%s> unsupported link type(%d)",
- __func__, sdl->sdl_type);
- exit(1);
+ switch (sdl->sdl_type) {
+ case IFT_ETHER:
+ ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3;
+ addr = (char *)(ndopt + 1);
+ memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN);
+ break;
+ default:
+ syslog(LOG_ERR, "<%s> unsupported link type(%d)",
+ __func__, sdl->sdl_type);
+ exit(1);
}
return;
diff --git a/usr.sbin/rtadvd/rrenum.c b/usr.sbin/rtadvd/rrenum.c
index bca75ac..59c125b 100644
--- a/usr.sbin/rtadvd/rrenum.c
+++ b/usr.sbin/rtadvd/rrenum.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: rrenum.c,v 1.10 2001/01/21 15:32:16 itojun Exp $ */
+/* $KAME: rrenum.c,v 1.12 2002/06/10 19:59:47 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -92,7 +92,7 @@ rr_pco_check(int len, struct rr_pco_match *rpm)
return 1;
}
/* rpm->rpm_code must be valid value */
- switch(rpm->rpm_code) {
+ switch (rpm->rpm_code) {
case RPM_PCO_ADD:
case RPM_PCO_CHANGE:
case RPM_PCO_SETGLOBAL:
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index dffcab6..9673962 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -530,14 +530,14 @@ rtmsg_input()
}
/* check if an interface flag is changed */
- if ((oldifflags & IFF_UP) != 0 && /* UP to DOWN */
- (iflist[ifindex]->ifm_flags & IFF_UP) == 0) {
+ if ((oldifflags & IFF_UP) && /* UP to DOWN */
+ !(iflist[ifindex]->ifm_flags & IFF_UP)) {
syslog(LOG_INFO,
"<%s> interface %s becomes down. stop timer.",
__func__, rai->ifname);
rtadvd_remove_timer(&rai->timer);
- } else if ((oldifflags & IFF_UP) == 0 && /* DOWN to UP */
- (iflist[ifindex]->ifm_flags & IFF_UP) != 0) {
+ } else if (!(oldifflags & IFF_UP) && /* DOWN to UP */
+ (iflist[ifindex]->ifm_flags & IFF_UP)) {
syslog(LOG_INFO,
"<%s> interface %s becomes up. restart timer.",
__func__, rai->ifname);
@@ -760,7 +760,7 @@ rs_input(int len, struct nd_router_solicit *rs,
memset(&ndopts, 0, sizeof(ndopts));
if (nd6_options((struct nd_opt_hdr *)(rs + 1),
len - sizeof(struct nd_router_solicit),
- &ndopts, NDOPT_FLAG_SRCLINKADDR)) {
+ &ndopts, NDOPT_FLAG_SRCLINKADDR)) {
syslog(LOG_DEBUG,
"<%s> ND option check failed for an RS from %s on %s",
__func__,
@@ -1092,7 +1092,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
if (rai->clockskew &&
abs(preferred_time - pp->pltimeexpire) > rai->clockskew) {
syslog(LOG_INFO,
- "<%s> prefeerred lifetime for %s/%d"
+ "<%s> preferred lifetime for %s/%d"
" (decr. in real time) inconsistent on %s:"
" %d from %s, %ld from us",
__func__,
@@ -1107,7 +1107,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
}
} else if (preferred_time != pp->preflifetime) {
syslog(LOG_INFO,
- "<%s> prefeerred lifetime for %s/%d"
+ "<%s> preferred lifetime for %s/%d"
" inconsistent on %s:"
" %d from %s, %d from us",
__func__,
@@ -1227,16 +1227,14 @@ nd6_options(struct nd_opt_hdr *hdr, int limit,
}
if (hdr->nd_opt_type > ND_OPT_MTU) {
- syslog(LOG_INFO,
- "<%s> unknown ND option(type %d)",
+ syslog(LOG_INFO, "<%s> unknown ND option(type %d)",
__func__, hdr->nd_opt_type);
continue;
}
if ((ndopt_flags[hdr->nd_opt_type] & optflags) == 0) {
- syslog(LOG_INFO,
- "<%s> unexpected ND option(type %d)",
- __func__, hdr->nd_opt_type);
+ syslog(LOG_INFO, "<%s> unexpected ND option(type %d)",
+ __func__, hdr->nd_opt_type);
continue;
}
diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h
index 674ab12..c391249 100644
--- a/usr.sbin/rtadvd/rtadvd.h
+++ b/usr.sbin/rtadvd/rtadvd.h
@@ -90,7 +90,7 @@ struct prefix {
u_int routeraddr; /* bool: RouterAddress */
#endif
int prefixlen;
- int origin; /* from kernel or cofig */
+ int origin; /* from kernel or config */
struct in6_addr prefix;
};
@@ -99,7 +99,7 @@ struct rtinfo {
struct rtinfo *next; /* forward link */
u_int32_t ltime; /* route lifetime */
- u_int rtpref; /* router preference */
+ u_int rtpref; /* route preference */
int prefixlen;
struct in6_addr prefix;
};
@@ -135,6 +135,7 @@ struct rainfo {
#ifdef MIP6
int haflg; /* HAFlag */
#endif
+
int rtpref; /* router preference */
u_int32_t linkmtu; /* AdvLinkMTU */
u_int32_t reachabletime; /* AdvReachableTime */
diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c
index 73b7fe1..f30fb37 100644
--- a/usr.sbin/rtadvd/timer.c
+++ b/usr.sbin/rtadvd/timer.c
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: timer.c,v 1.4 2000/05/27 11:30:43 jinmei Exp $ */
+/* $KAME: timer.c,v 1.9 2002/06/10 19:59:47 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -45,7 +45,7 @@ static struct rtadvd_timer timer_head;
#define MILLION 1000000
#define TIMEVAL_EQUAL(t1,t2) ((t1)->tv_sec == (t2)->tv_sec &&\
- (t1)->tv_usec == (t2)->tv_usec)
+ (t1)->tv_usec == (t2)->tv_usec)
static struct timeval tm_max = {0x7fffffff, 0x7fffffff};
@@ -75,7 +75,7 @@ rtadvd_add_timer(struct rtadvd_timer *(*timeout) __P((void *)),
if (timeout == NULL) {
syslog(LOG_ERR,
- "<%s> timeout function unspecfied", __func__);
+ "<%s> timeout function unspecified", __func__);
exit(1);
}
newtimer->expire = timeout;
@@ -149,12 +149,10 @@ rtadvd_check_timer()
if (TIMEVAL_EQUAL(&tm_max, &timer_head.tm)) {
/* no need to timeout */
return(NULL);
- }
- else if (TIMEVAL_LT(timer_head.tm, now)) {
+ } else if (TIMEVAL_LT(timer_head.tm, now)) {
/* this may occur when the interval is too small */
returnval.tv_sec = returnval.tv_usec = 0;
- }
- else
+ } else
TIMEVAL_SUB(&timer_head.tm, &now, &returnval);
return(&returnval);
}
diff --git a/usr.sbin/rtadvd/timer.h b/usr.sbin/rtadvd/timer.h
index 2eebf15..d435bde 100644
--- a/usr.sbin/rtadvd/timer.h
+++ b/usr.sbin/rtadvd/timer.h
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* $KAME: timer.h,v 1.3 2000/05/27 11:30:43 jinmei Exp $ */
+/* $KAME: timer.h,v 1.5 2002/05/31 13:30:38 jinmei Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -60,6 +60,6 @@ void rtadvd_remove_timer __P((struct rtadvd_timer **));
struct timeval * rtadvd_check_timer __P((void));
struct timeval * rtadvd_timer_rest __P((struct rtadvd_timer *));
void TIMEVAL_ADD __P((struct timeval *, struct timeval *,
- struct timeval *));
+ struct timeval *));
void TIMEVAL_SUB __P((struct timeval *, struct timeval *,
- struct timeval *));
+ struct timeval *));
OpenPOWER on IntegriCloud