KNF
Obtained from: KAME
This commit is contained in:
parent
511dab6218
commit
99a92b2c8a
@ -242,11 +242,11 @@ main(argc, argv)
|
||||
|
||||
/* record the current PID */
|
||||
pid = getpid();
|
||||
if ((pidfp = fopen(pidfilename, "w")) == NULL)
|
||||
if ((pidfp = fopen(pidfilename, "w")) == NULL) {
|
||||
syslog(LOG_ERR,
|
||||
"<%s> failed to open a log file(%s), run anyway.",
|
||||
__FUNCTION__, pidfilename);
|
||||
else {
|
||||
} else {
|
||||
fprintf(pidfp, "%d\n", pid);
|
||||
fclose(pidfp);
|
||||
}
|
||||
@ -284,8 +284,7 @@ main(argc, argv)
|
||||
if (timeout != NULL) {
|
||||
syslog(LOG_DEBUG,
|
||||
"<%s> set timer to %ld:%ld. waiting for "
|
||||
"inputs or timeout",
|
||||
__FUNCTION__,
|
||||
"inputs or timeout", __FUNCTION__,
|
||||
(long int)timeout->tv_sec,
|
||||
(long int)timeout->tv_usec);
|
||||
} else {
|
||||
@ -364,11 +363,8 @@ rtmsg_input()
|
||||
|
||||
n = read(rtsock, msg, sizeof(msg));
|
||||
if (dflag > 1) {
|
||||
syslog(LOG_DEBUG,
|
||||
"<%s> received a routing message "
|
||||
"(type = %d, len = %d)",
|
||||
__FUNCTION__,
|
||||
rtmsg_type(msg), n);
|
||||
syslog(LOG_DEBUG, "<%s> received a routing message "
|
||||
"(type = %d, len = %d)", __FUNCTION__, rtmsg_type(msg), n);
|
||||
}
|
||||
if (n > rtmsg_len(msg)) {
|
||||
/*
|
||||
@ -439,8 +435,7 @@ rtmsg_input()
|
||||
case RTM_ADD:
|
||||
/* init ifflags because it may have changed */
|
||||
iflist[ifindex]->ifm_flags =
|
||||
if_getflags(ifindex,
|
||||
iflist[ifindex]->ifm_flags);
|
||||
if_getflags(ifindex, iflist[ifindex]->ifm_flags);
|
||||
|
||||
if (sflag)
|
||||
break; /* we aren't interested in prefixes */
|
||||
@ -448,8 +443,8 @@ rtmsg_input()
|
||||
addr = get_addr(msg);
|
||||
plen = get_prefixlen(msg);
|
||||
/* sanity check for plen */
|
||||
if (plen < 4 /* as RFC2373, prefixlen is at least 4 */
|
||||
|| plen > 127) {
|
||||
/* as RFC2373, prefixlen is at least 4 */
|
||||
if (plen < 4 || plen > 127) {
|
||||
syslog(LOG_INFO, "<%s> new interface route's"
|
||||
"plen %d is invalid for a prefix",
|
||||
__FUNCTION__, plen);
|
||||
@ -463,11 +458,9 @@ rtmsg_input()
|
||||
"added on %s, "
|
||||
"but it was already in list",
|
||||
__FUNCTION__,
|
||||
inet_ntop(AF_INET6,
|
||||
addr, (char *)addrbuf,
|
||||
INET6_ADDRSTRLEN),
|
||||
plen,
|
||||
rai->ifname);
|
||||
inet_ntop(AF_INET6, addr,
|
||||
(char *)addrbuf, INET6_ADDRSTRLEN),
|
||||
plen, rai->ifname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -476,8 +469,7 @@ rtmsg_input()
|
||||
case RTM_DELETE:
|
||||
/* init ifflags because it may have changed */
|
||||
iflist[ifindex]->ifm_flags =
|
||||
if_getflags(ifindex,
|
||||
iflist[ifindex]->ifm_flags);
|
||||
if_getflags(ifindex, iflist[ifindex]->ifm_flags);
|
||||
|
||||
if (sflag)
|
||||
break;
|
||||
@ -485,10 +477,10 @@ rtmsg_input()
|
||||
addr = get_addr(msg);
|
||||
plen = get_prefixlen(msg);
|
||||
/* sanity check for plen */
|
||||
if (plen < 4 /* as RFC2373, prefixlen is at least 4 */
|
||||
|| plen > 127) {
|
||||
syslog(LOG_INFO, "<%s> deleted interface"
|
||||
"route's"
|
||||
/* as RFC2373, prefixlen is at least 4 */
|
||||
if (plen < 4 || plen > 127) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> deleted interface route's "
|
||||
"plen %d is invalid for a prefix",
|
||||
__FUNCTION__, plen);
|
||||
break;
|
||||
@ -501,11 +493,9 @@ rtmsg_input()
|
||||
"deleted on %s, "
|
||||
"but it was not in list",
|
||||
__FUNCTION__,
|
||||
inet_ntop(AF_INET6,
|
||||
addr, (char *)addrbuf,
|
||||
INET6_ADDRSTRLEN),
|
||||
plen,
|
||||
rai->ifname);
|
||||
inet_ntop(AF_INET6, addr,
|
||||
(char *)addrbuf, INET6_ADDRSTRLEN),
|
||||
plen, rai->ifname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -515,8 +505,7 @@ rtmsg_input()
|
||||
case RTM_DELADDR:
|
||||
/* init ifflags because it may have changed */
|
||||
iflist[ifindex]->ifm_flags =
|
||||
if_getflags(ifindex,
|
||||
iflist[ifindex]->ifm_flags);
|
||||
if_getflags(ifindex, iflist[ifindex]->ifm_flags);
|
||||
break;
|
||||
case RTM_IFINFO:
|
||||
iflist[ifindex]->ifm_flags = get_ifm_flags(next);
|
||||
@ -539,8 +528,7 @@ rtmsg_input()
|
||||
"<%s> interface %s becomes down. stop timer.",
|
||||
__FUNCTION__, rai->ifname);
|
||||
rtadvd_remove_timer(&rai->timer);
|
||||
}
|
||||
else if ((oldifflags & IFF_UP) == 0 && /* DOWN to UP */
|
||||
} else if ((oldifflags & IFF_UP) == 0 && /* DOWN to UP */
|
||||
(iflist[ifindex]->ifm_flags & IFF_UP) != 0) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> interface %s becomes up. restart timer.",
|
||||
@ -549,8 +537,7 @@ rtmsg_input()
|
||||
rai->initcounter = 0; /* reset the counter */
|
||||
rai->waiting = 0; /* XXX */
|
||||
rai->timer = rtadvd_add_timer(ra_timeout,
|
||||
ra_timer_update,
|
||||
rai, rai);
|
||||
ra_timer_update, rai, rai);
|
||||
ra_timer_update((void *)rai, &rai->timer->tm);
|
||||
rtadvd_set_timer(&rai->timer->tm, rai->timer);
|
||||
}
|
||||
@ -723,8 +710,7 @@ rtadvd_input()
|
||||
break;
|
||||
case ICMP6_ROUTER_RENUMBERING:
|
||||
if (accept_rr == 0) {
|
||||
syslog(LOG_ERR,
|
||||
"<%s> received a router renumbering "
|
||||
syslog(LOG_ERR, "<%s> received a router renumbering "
|
||||
"message, but not allowed to be accepted",
|
||||
__FUNCTION__);
|
||||
break;
|
||||
@ -739,8 +725,7 @@ rtadvd_input()
|
||||
* could receive message after opening the socket and
|
||||
* before setting ICMP6 type filter(see sock_open()).
|
||||
*/
|
||||
syslog(LOG_ERR,
|
||||
"<%s> invalid icmp type(%d)",
|
||||
syslog(LOG_ERR, "<%s> invalid icmp type(%d)",
|
||||
__FUNCTION__, icp->icmp6_type);
|
||||
return;
|
||||
}
|
||||
@ -1112,8 +1097,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
|
||||
pp->pltimeexpire);
|
||||
inconsistent++;
|
||||
}
|
||||
}
|
||||
else if (preferred_time != pp->preflifetime) {
|
||||
} else if (preferred_time != pp->preflifetime) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> prefeerred lifetime for %s/%d"
|
||||
" inconsistent on %s:"
|
||||
@ -1149,8 +1133,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
|
||||
pp->vltimeexpire);
|
||||
inconsistent++;
|
||||
}
|
||||
}
|
||||
else if (valid_time != pp->validlifetime) {
|
||||
} else if (valid_time != pp->validlifetime) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> valid lifetime for %s/%d"
|
||||
" inconsistent on %s:"
|
||||
@ -1229,16 +1212,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)",
|
||||
__FUNCTION__,
|
||||
hdr->nd_opt_type);
|
||||
__FUNCTION__, hdr->nd_opt_type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ndopt_flags[hdr->nd_opt_type] & optflags) == 0) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> unexpected ND option(type %d)",
|
||||
__FUNCTION__,
|
||||
hdr->nd_opt_type);
|
||||
__FUNCTION__, hdr->nd_opt_type);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1249,10 +1230,8 @@ nd6_options(struct nd_opt_hdr *hdr, int limit,
|
||||
case ND_OPT_MTU:
|
||||
if (ndopts->nd_opt_array[hdr->nd_opt_type]) {
|
||||
syslog(LOG_INFO,
|
||||
"<%s> duplicated ND option"
|
||||
" (type = %d)",
|
||||
__FUNCTION__,
|
||||
hdr->nd_opt_type);
|
||||
"<%s> duplicated ND option (type = %d)",
|
||||
__FUNCTION__, hdr->nd_opt_type);
|
||||
}
|
||||
ndopts->nd_opt_array[hdr->nd_opt_type] = hdr;
|
||||
break;
|
||||
@ -1266,8 +1245,7 @@ nd6_options(struct nd_opt_hdr *hdr, int limit,
|
||||
continue;
|
||||
}
|
||||
if ((pfxlist = malloc(sizeof(*pfxlist))) == NULL) {
|
||||
syslog(LOG_ERR,
|
||||
"<%s> can't allocate memory",
|
||||
syslog(LOG_ERR, "<%s> can't allocate memory",
|
||||
__FUNCTION__);
|
||||
goto bad;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user