diff options
author | hrs <hrs@FreeBSD.org> | 2011-05-31 12:54:32 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2011-05-31 12:54:32 +0000 |
commit | bf953fdd578951ac90740831931fc9d46d7213e0 (patch) | |
tree | ce0a2d30fe252402fa8af467b6707dad15d3155e /usr.sbin/rtadvd | |
parent | 44b307b34139603f9baa4ad13e4eae27fe63922c (diff) | |
download | FreeBSD-src-bf953fdd578951ac90740831931fc9d46d7213e0.zip FreeBSD-src-bf953fdd578951ac90740831931fc9d46d7213e0.tar.gz |
- Remove #ifdef RDNSS.
- Style(9).
- Define sin6_{linklocal,sitelocal}_all{nodes,routers} vars consistently.
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/rtadvd/advcap.c | 27 | ||||
-rw-r--r-- | usr.sbin/rtadvd/config.c | 26 | ||||
-rw-r--r-- | usr.sbin/rtadvd/config.h | 4 | ||||
-rw-r--r-- | usr.sbin/rtadvd/dump.c | 20 | ||||
-rw-r--r-- | usr.sbin/rtadvd/dump.h | 4 | ||||
-rw-r--r-- | usr.sbin/rtadvd/if.c | 50 | ||||
-rw-r--r-- | usr.sbin/rtadvd/if.h | 4 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rrenum.c | 37 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rrenum.h | 4 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 181 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.h | 44 | ||||
-rw-r--r-- | usr.sbin/rtadvd/timer.c | 12 | ||||
-rw-r--r-- | usr.sbin/rtadvd/timer.h | 4 |
14 files changed, 184 insertions, 235 deletions
diff --git a/usr.sbin/rtadvd/Makefile b/usr.sbin/rtadvd/Makefile index 29c26fe..9dbfc99 100644 --- a/usr.sbin/rtadvd/Makefile +++ b/usr.sbin/rtadvd/Makefile @@ -21,7 +21,7 @@ SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c dump.c DPADD= ${LIBUTIL} LDADD= -lutil -CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO -DRDNSS +CFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_POLL_H -DROUTEINFO WARNS?= 1 diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c index 792ea27..83c780e 100644 --- a/usr.sbin/rtadvd/advcap.c +++ b/usr.sbin/rtadvd/advcap.c @@ -103,8 +103,7 @@ static char *tdecode(char *, char **); * we just notice escaped newlines. */ int -tgetent(bp, name) - char *bp, *name; +tgetent(char *bp, char *name) { char *cp; @@ -113,8 +112,7 @@ tgetent(bp, name) } int -getent(bp, name, cp) - char *bp, *name, *cp; +getent(char *bp, char *name, char *cp) { int c; int i = 0, cnt = 0; @@ -184,7 +182,7 @@ getent(bp, name, cp) * Note that this works because of the left to right scan. */ int -tnchktc() +tnchktc(void) { char *p, *q; char tcname[16]; /* name of similar terminal */ @@ -233,8 +231,7 @@ tnchktc() * name (before the first field) stops us. */ int -tnamatch(np) - char *np; +tnamatch(char *np) { char *Np, *Bp; @@ -260,8 +257,7 @@ tnamatch(np) * into the termcap file in octal. */ static char * -tskip(bp) - char *bp; +tskip(char *bp) { int dquote; @@ -305,8 +301,7 @@ breakbreak: * Note that we handle octal numbers beginning with 0. */ int64_t -tgetnum(id) - char *id; +tgetnum(char *id) { int64_t i; int base; @@ -341,8 +336,7 @@ tgetnum(id) * not given. */ int -tgetflag(id) - char *id; +tgetflag(char *id) { char *bp = tbuf; @@ -369,8 +363,7 @@ tgetflag(id) * No checking on area overflow. */ char * -tgetstr(id, area) - char *id, **area; +tgetstr(char *id, char **area) { char *bp = tbuf; @@ -395,9 +388,7 @@ tgetstr(id, area) * string capability escapes. */ static char * -tdecode(str, area) - char *str; - char **area; +tdecode(char *str, char **area) { char *cp; int c; diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index 086a23c..011e8d3 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -155,10 +155,8 @@ getconfig(intface) #ifdef ROUTEINFO tmp->route.next = tmp->route.prev = &tmp->route; #endif -#ifdef RDNSS TAILQ_INIT(&tmp->rdnss); TAILQ_INIT(&tmp->dnssl); -#endif /* check if we are allowed to forward packets (if not determined) */ if (forwarding < 0) { @@ -619,7 +617,6 @@ getconfig(intface) } #endif -#ifdef RDNSS /* DNS server and DNS search list information */ for (i = -1; i < MAXRDNSSENT ; i++) { struct rdnss *rdn; @@ -658,7 +655,7 @@ getconfig(intface) syslog(LOG_ERR, "<%s> inet_pton failed for %s", __func__, abuf); exit(1); - } + } TAILQ_INSERT_TAIL(&rdn->rd_list, rdna, ra_next); } @@ -730,7 +727,6 @@ getconfig(intface) /* link into chain */ insque(dns, &tmp->dnssl); } -#endif /* okey */ tmp->next = ralist; ralist = tmp; @@ -948,7 +944,7 @@ static struct rtadvd_timer * prefix_timeout(void *arg) { struct prefix *prefix = (struct prefix *)arg; - + delete_prefix(prefix); return(NULL); @@ -1059,13 +1055,11 @@ make_packet(struct rainfo *rainfo) struct nd_opt_route_info *ndopt_rti; struct rtinfo *rti; #endif -#ifdef RDNSS struct nd_opt_rdnss *ndopt_rdnss; struct rdnss *rdn; struct nd_opt_dnssl *ndopt_dnssl; struct dnssl *dns; size_t len; -#endif struct prefix *pfx; /* calculate total length */ @@ -1086,10 +1080,9 @@ make_packet(struct rainfo *rainfo) packlen += sizeof(struct nd_opt_mtu); #ifdef ROUTEINFO for (rti = rainfo->route.next; rti != &rainfo->route; rti = rti->next) - packlen += sizeof(struct nd_opt_route_info) + + packlen += sizeof(struct nd_opt_route_info) + ((rti->prefixlen + 0x3f) >> 6) * 8; #endif -#ifdef RDNSS TAILQ_FOREACH(rdn, &rainfo->rdnss, rd_next) { struct rdnss_addr *rdna; @@ -1111,8 +1104,6 @@ make_packet(struct rainfo *rainfo) packlen += len; } -#endif - /* allocate memory for the packet */ if ((buf = malloc(packlen)) == NULL) { syslog(LOG_ERR, @@ -1200,7 +1191,7 @@ make_packet(struct rainfo *rainfo) if (pfx->pltimeexpire == 0) pltime = pfx->preflifetime; else - pltime = (pfx->pltimeexpire > now.tv_sec) ? + pltime = (pfx->pltimeexpire > now.tv_sec) ? pfx->pltimeexpire - now.tv_sec : 0; } if (vltime < pltime) { @@ -1232,8 +1223,6 @@ make_packet(struct rainfo *rainfo) buf += sizeof(struct nd_opt_route_info) + psize * 8; } #endif - -#ifdef RDNSS TAILQ_FOREACH(rdn, &rainfo->rdnss, rd_next) { struct rdnss_addr *rdna; @@ -1272,7 +1261,7 @@ make_packet(struct rainfo *rainfo) /* A zero octet after encoded DNS server list. */ *buf++ = '\0'; - + /* Padding to next 8 octets boundary */ len = buf - (char *)ndopt_dnssl; len += 8 - (len % 8); @@ -1283,7 +1272,6 @@ make_packet(struct rainfo *rainfo) syslog(LOG_DEBUG, "<%s>: nd_opt_dnssl_len = %d", __func__, ndopt_dnssl->nd_opt_dnssl_len); } -#endif return; } diff --git a/usr.sbin/rtadvd/config.h b/usr.sbin/rtadvd/config.h index 3fa14f9..88c31e3 100644 --- a/usr.sbin/rtadvd/config.h +++ b/usr.sbin/rtadvd/config.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/usr.sbin/rtadvd/dump.c b/usr.sbin/rtadvd/dump.c index a94a62e..8f3b0d2 100644 --- a/usr.sbin/rtadvd/dump.c +++ b/usr.sbin/rtadvd/dump.c @@ -4,7 +4,7 @@ /* * Copyright (C) 2000 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -74,8 +74,7 @@ static char *rtpref_str[] = { }; static char * -ether_str(sdl) - struct sockaddr_dl *sdl; +ether_str(struct sockaddr_dl *sdl) { static char hbuf[32]; u_char *cp; @@ -87,21 +86,19 @@ ether_str(sdl) } else snprintf(hbuf, sizeof(hbuf), "NONE"); - return(hbuf); + return (hbuf); } static void -if_dump() +if_dump(void) { struct rainfo *rai; struct prefix *pfx; #ifdef ROUTEINFO struct rtinfo *rti; #endif -#ifdef RDNSS struct rdnss *rdn; struct dnssl *dns; -#endif char prefixbuf[INET6_ADDRSTRLEN]; int first; struct timeval now; @@ -236,7 +233,6 @@ if_dump() fprintf(fp, ")\n"); } #endif -#ifdef RDNSS TAILQ_FOREACH(rdn, &rai->rdnss, rd_next) { struct rdnss_addr *rdna; @@ -248,7 +244,7 @@ if_dump() TAILQ_FOREACH(rdna, &rdn->rd_list, ra_next) { inet_ntop(AF_INET6, &rdna->ra_dns, prefixbuf, sizeof(prefixbuf)); - + if (rdna != TAILQ_FIRST(&rdn->rd_list)) fprintf(fp, " \t"); fprintf(fp, "%s\n", prefixbuf); @@ -273,13 +269,11 @@ if_dump() } fprintf(fp, "\n"); } -#endif } } void -rtadvd_dump_file(dumpfile) - char *dumpfile; +rtadvd_dump_file(char *dumpfile) { syslog(LOG_DEBUG, "<%s> dump current status to %s", __func__, dumpfile); diff --git a/usr.sbin/rtadvd/dump.h b/usr.sbin/rtadvd/dump.h index c8a6b22..9b93ddd 100644 --- a/usr.sbin/rtadvd/dump.h +++ b/usr.sbin/rtadvd/dump.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c index 6cd8dd8..a15e3c1 100644 --- a/usr.sbin/rtadvd/if.c +++ b/usr.sbin/rtadvd/if.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -72,7 +72,7 @@ static void get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info) { int i; - + for (i = 0; i < RTAX_MAX; i++) { if (addrs & (1 << i)) { rti_info[i] = sa; @@ -94,12 +94,12 @@ if_nametosdl(char *name) struct sockaddr_dl *sdl = NULL, *ret_sdl; if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) - return(NULL); + return (NULL); if ((buf = malloc(len)) == NULL) - return(NULL); + return (NULL); if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { free(buf); - return(NULL); + return (NULL); } lim = buf + len; @@ -125,7 +125,7 @@ if_nametosdl(char *name) if (next == lim) { /* search failed */ free(buf); - return(NULL); + return (NULL); } if ((ret_sdl = malloc(sdl->sdl_len)) == NULL) @@ -134,7 +134,7 @@ if_nametosdl(char *name) end: free(buf); - return(ret_sdl); + return (ret_sdl); } int @@ -145,7 +145,7 @@ if_getmtu(char *name) u_long mtu = 0; if (getifaddrs(&ifap) < 0) - return(0); + return (0); for (ifa = ifap; ifa; ifa = ifa->ifa_next) { if (strcmp(ifa->ifa_name, name) == 0) { ifd = ifa->ifa_data; @@ -162,14 +162,14 @@ if_getmtu(char *name) int s; if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) - return(0); + return (0); ifr.ifr_addr.sa_family = AF_INET6; strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0) { close(s); - return(0); + return (0); } close(s); @@ -177,7 +177,7 @@ if_getmtu(char *name) } #endif - return(mtu); + return (mtu); } /* give interface index and its old flags, then new flags returned */ @@ -210,9 +210,9 @@ lladdropt_length(struct sockaddr_dl *sdl) { switch (sdl->sdl_type) { case IFT_ETHER: - return(ROUNDUP8(ETHER_ADDR_LEN + 2)); + return (ROUNDUP8(ETHER_ADDR_LEN + 2)); default: - return(0); + return (0); } } @@ -246,9 +246,9 @@ rtbuf_len() int mib[6] = {CTL_NET, AF_ROUTE, 0, AF_INET6, NET_RT_DUMP, 0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) - return(-1); + return (-1); - return(len); + return (len); } #define FILTER_MATCH(type, filter) ((0x1 << type) & filter) @@ -336,7 +336,7 @@ get_next_msg(char *buf, char *lim, int ifindex, size_t *lenp, int filter) } } - return (char *)rtm; + return ((char *)rtm); } #undef FILTER_MATCH @@ -349,7 +349,7 @@ get_addr(char *buf) sa = (struct sockaddr *)(rtm + 1); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - return(&SIN6(rti_info[RTAX_DST])->sin6_addr); + return (&SIN6(rti_info[RTAX_DST])->sin6_addr); } int @@ -361,7 +361,7 @@ get_rtm_ifindex(char *buf) sa = (struct sockaddr *)(rtm + 1); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - return(((struct sockaddr_dl *)rti_info[RTAX_GATEWAY])->sdl_index); + return (((struct sockaddr_dl *)rti_info[RTAX_GATEWAY])->sdl_index); } int @@ -394,7 +394,7 @@ get_prefixlen(char *buf) struct rt_msghdr *rtm = (struct rt_msghdr *)buf; struct sockaddr *sa, *rti_info[RTAX_MAX]; u_char *p, *lim; - + sa = (struct sockaddr *)(rtm + 1); get_rtaddrs(rtm->rtm_addrs, sa, rti_info); sa = rti_info[RTAX_NETMASK]; @@ -438,11 +438,11 @@ prefixlen(u_char *p, u_char *lim) case 0x00: break; default: - return(-1); + return (-1); } } - return(masklen); + return (masklen); } int @@ -450,7 +450,7 @@ rtmsg_type(char *buf) { struct rt_msghdr *rtm = (struct rt_msghdr *)buf; - return(rtm->rtm_type); + return (rtm->rtm_type); } int @@ -458,7 +458,7 @@ rtmsg_len(char *buf) { struct rt_msghdr *rtm = (struct rt_msghdr *)buf; - return(rtm->rtm_msglen); + return (rtm->rtm_msglen); } int @@ -466,7 +466,7 @@ ifmsg_len(char *buf) { struct if_msghdr *ifm = (struct if_msghdr *)buf; - return(ifm->ifm_msglen); + return (ifm->ifm_msglen); } /* diff --git a/usr.sbin/rtadvd/if.h b/usr.sbin/rtadvd/if.h index 216eaa0..8728e19 100644 --- a/usr.sbin/rtadvd/if.h +++ b/usr.sbin/rtadvd/if.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/usr.sbin/rtadvd/rrenum.c b/usr.sbin/rtadvd/rrenum.c index b2ea902..e2a6311 100644 --- a/usr.sbin/rtadvd/rrenum.c +++ b/usr.sbin/rtadvd/rrenum.c @@ -75,7 +75,7 @@ static int s = -1; /* * Check validity of a Prefix Control Operation(PCO). - * Return 0 on success, 1 on failure. + * return 0 on success, 1 on failure. */ static int rr_pco_check(int len, struct rr_pco_match *rpm) @@ -88,7 +88,7 @@ rr_pco_check(int len, struct rr_pco_match *rpm) (rpm->rpm_len - 3) & 0x3) { /* must be multiple of 4 */ syslog(LOG_WARNING, "<%s> rpm_len %d is not 4N * 3", __func__, rpm->rpm_len); - return 1; + return (1); } /* rpm->rpm_code must be valid value */ switch (rpm->rpm_code) { @@ -99,13 +99,13 @@ rr_pco_check(int len, struct rr_pco_match *rpm) default: syslog(LOG_WARNING, "<%s> unknown rpm_code %d", __func__, rpm->rpm_code); - return 1; + 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", __func__, rpm->rpm_matchlen); - return 1; + return (1); } /* @@ -131,10 +131,10 @@ rr_pco_check(int len, struct rr_pco_match *rpm) __func__, rpu->rpu_uselen, rpu->rpu_keeplen, rpu->rpu_uselen + rpu->rpu_keeplen); - return 1; + return (1); } } - return 0; + return (0); } static void @@ -246,7 +246,7 @@ do_pco(struct icmp6_router_renum *rr, int len, struct rr_pco_match *rpm) struct in6_rrenumreq irr; if ((rr_pco_check(len, rpm) != 0)) - return 1; + return (1); if (s == -1 && (s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { syslog(LOG_ERR, "<%s> socket: %s", __func__, @@ -275,13 +275,13 @@ do_pco(struct icmp6_router_renum *rr, int len, struct rr_pco_match *rpm) do_use_prefix(len, rpm, &irr, ifindex); } if (errno == ENXIO) - return 0; + return (0); else if (errno) { syslog(LOG_ERR, "<%s> if_indextoname: %s", __func__, strerror(errno)); - return 1; + return (1); } - return 0; + return (0); } /* @@ -310,7 +310,7 @@ do_rr(int len, struct icmp6_router_renum *rr) tooshort: syslog(LOG_ERR, "<%s> pkt too short. left len = %d. " "gabage at end of pkt?", __func__, len); - return 1; + return (1); } rpmlen = rpm->rpm_len << 3; if (len < rpmlen) @@ -326,7 +326,7 @@ do_rr(int len, struct icmp6_router_renum *rr) len -= rpmlen; } - return 0; + return (0); } /* @@ -345,7 +345,7 @@ rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from, sizeof(struct rr_pco_match))) { syslog(LOG_ERR, "<%s> rr_command len %d is too short", __func__, len); - return 1; + return (1); } /* destination check. only for multicast. omit unicast check. */ @@ -354,7 +354,7 @@ rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from, syslog(LOG_ERR, "<%s> dst mcast addr %s is illegal", __func__, inet_ntop(AF_INET6, dst, ntopbuf, INET6_ADDRSTRLEN)); - return 1; + return (1); } /* seqnum and segnum check */ @@ -363,7 +363,7 @@ rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from, "<%s> rcvd old seqnum %d from %s", __func__, (u_int32_t)ntohl(rr->rr_seqnum), inet_ntop(AF_INET6, from, ntopbuf, INET6_ADDRSTRLEN)); - return 1; + return (1); } if (rro.rro_seqnum == rr->rr_seqnum && (rr->rr_flags & ICMP6_RR_FLAGS_TEST) == 0 && @@ -374,7 +374,7 @@ rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from, __func__, rr->rr_segnum, inet_ntop(AF_INET6, from, ntopbuf, INET6_ADDRSTRLEN)); - return 0; + return (0); } /* update seqnum */ @@ -387,7 +387,7 @@ rr_command_check(int len, struct icmp6_router_renum *rr, struct in6_addr *from, } rro.rro_seqnum = rr->rr_seqnum; - return 0; + return (0); } static void @@ -451,7 +451,8 @@ rr_input(int len, struct icmp6_router_renum *rr, struct in6_pktinfo *pi, * check multicast destinations only. */ if (IN6_IS_ADDR_MULTICAST(&pi->ipi6_addr) && - !IN6_ARE_ADDR_EQUAL(&in6a_site_allrouters, &pi->ipi6_addr)) { + !IN6_ARE_ADDR_EQUAL(&sin6_sitelocal_allrouters.sin6_addr, + &pi->ipi6_addr)) { syslog(LOG_NOTICE, "<%s>: RR message with invalid destination (%s) " "from %s on %s", diff --git a/usr.sbin/rtadvd/rrenum.h b/usr.sbin/rtadvd/rrenum.h index c358a2b..2b20d59 100644 --- a/usr.sbin/rtadvd/rrenum.h +++ b/usr.sbin/rtadvd/rrenum.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 3652e20..a08846c 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -80,8 +80,6 @@ struct msghdr sndmhdr; struct iovec rcviov[2]; struct iovec sndiov[2]; struct sockaddr_in6 rcvfrom; -struct sockaddr_in6 sin6_allnodes = {sizeof(sin6_allnodes), AF_INET6}; -struct in6_addr in6a_site_allrouters; static char *dumpfilename = "/var/run/rtadvd.dump"; static char *pidfilename = "/var/run/rtadvd.pid"; static struct pidfh *pfh; @@ -122,10 +120,8 @@ union nd_opts { #define NDOPT_FLAG_PREFIXINFO (1 << 2) #define NDOPT_FLAG_RDHDR (1 << 3) #define NDOPT_FLAG_MTU (1 << 4) -#ifdef RDNSS #define NDOPT_FLAG_RDNSS (1 << 5) #define NDOPT_FLAG_DNSSL (1 << 6) -#endif u_int32_t ndopt_flags[] = { [ND_OPT_SOURCE_LINKADDR] = NDOPT_FLAG_SRCLINKADDR, @@ -133,13 +129,25 @@ u_int32_t ndopt_flags[] = { [ND_OPT_PREFIX_INFORMATION] = NDOPT_FLAG_PREFIXINFO, [ND_OPT_REDIRECTED_HEADER] = NDOPT_FLAG_RDHDR, [ND_OPT_MTU] = NDOPT_FLAG_MTU, -#ifdef RDNSS [ND_OPT_RDNSS] = NDOPT_FLAG_RDNSS, [ND_OPT_DNSSL] = NDOPT_FLAG_DNSSL, -#endif +}; +const struct sockaddr_in6 sin6_linklocal_allnodes = { + .sin6_len = sizeof(sin6_linklocal_allnodes), + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_LINKLOCAL_ALLNODES_INIT, +}; +const struct sockaddr_in6 sin6_linklocal_allrouters = { + .sin6_len = sizeof(sin6_linklocal_allrouters), + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT, +}; +const struct sockaddr_in6 sin6_sitelocal_allrouters = { + .sin6_len = sizeof(sin6_sitelocal_allrouters), + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_SITELOCAL_ALLROUTERS_INIT, }; -int main(int, char *[]); static void set_die(int); static void die(void); static void sock_open(void); @@ -160,9 +168,7 @@ static void rtadvd_set_dump_file(int); static void set_short_delay(struct rainfo *); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { #ifdef HAVE_POLL_H struct pollfd set[2]; @@ -249,11 +255,6 @@ main(argc, argv) while (argc--) getconfig(*argv++); - if (inet_pton(AF_INET6, ALLNODES, &sin6_allnodes.sin6_addr) != 1) { - fprintf(stderr, "fatal: inet_pton failed\n"); - exit(1); - } - pfh = pidfile_open(pidfilename, 0600, &otherpid); if (pfh == NULL) { if (errno == EEXIST) @@ -372,27 +373,24 @@ main(argc, argv) } static void -rtadvd_set_dump_file(sig) - int sig; +rtadvd_set_dump_file(int sig) { do_dump = 1; } static void -set_die(sig) - int sig; +set_die(int sig) { do_die = 1; } static void -die() +die(void) { struct rainfo *ra; -#ifdef RDNSS struct rdnss *rdn; struct dnssl *dns; -#endif + int i; const int retrans = MAX_FINAL_RTR_ADVERTISEMENTS; @@ -403,12 +401,10 @@ die() for (ra = ralist; ra; ra = ra->next) { ra->lifetime = 0; -#ifdef RDNSS TAILQ_FOREACH(rdn, &ra->rdnss, rd_next) rdn->rd_ltime = 0; TAILQ_FOREACH(dns, &ra->dnssl, dn_next) dns->dn_ltime = 0; -#endif make_packet(ra); } for (i = 0; i < retrans; i++) { @@ -417,12 +413,12 @@ die() sleep(MIN_DELAY_BETWEEN_RAS); } pidfile_remove(pfh); + exit(0); - /*NOTREACHED*/ } static void -rtmsg_input() +rtmsg_input(void) { int n, type, ifindex = 0, plen; size_t len; @@ -441,7 +437,7 @@ rtmsg_input() } if (n > rtmsg_len(msg)) { /* - * This usually won't happen for messages received on + * This usually won't happen for messages received on * a routing socket. */ if (dflag > 1) @@ -637,13 +633,13 @@ rtmsg_input() } void -rtadvd_input() +rtadvd_input(void) { int i; int *hlimp = NULL; #ifdef OLDRAWSOCKET struct ip6_hdr *ip; -#endif +#endif struct icmp6_hdr *icp; int ifindex = 0; struct cmsghdr *cm; @@ -766,7 +762,7 @@ rtadvd_input() case ND_ROUTER_ADVERT: /* * Message verification - RFC-2461 6.1.2 - * XXX: there's a same dilemma as above... + * XXX: there's a same dilemma as above... */ if (*hlimp != 255) { syslog(LOG_NOTICE, @@ -916,8 +912,7 @@ rs_input(int len, struct nd_router_solicit *rs, } static void -set_short_delay(rai) - struct rainfo *rai; +set_short_delay(struct rainfo *rai) { long delay; /* must not be greater than 1000000 */ struct timeval interval, now, min_delay, tm_tmp, *rest; @@ -978,17 +973,14 @@ ra_input(int len, struct nd_router_advert *ra, inet_ntop(AF_INET6, &from->sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf)); - + /* ND option check */ memset(&ndopts, 0, sizeof(ndopts)); if (nd6_options((struct nd_opt_hdr *)(ra + 1), len - sizeof(struct nd_router_advert), &ndopts, NDOPT_FLAG_SRCLINKADDR | - NDOPT_FLAG_PREFIXINFO | NDOPT_FLAG_MTU -#ifdef RDNSS - | NDOPT_FLAG_RDNSS | NDOPT_FLAG_DNSSL -#endif - )) { + NDOPT_FLAG_PREFIXINFO | NDOPT_FLAG_MTU | + NDOPT_FLAG_RDNSS | NDOPT_FLAG_DNSSL)) { syslog(LOG_INFO, "<%s> ND option check failed for an RA from %s on %s", __func__, @@ -1012,7 +1004,7 @@ ra_input(int len, struct nd_router_advert *ra, goto done; } rai->rainput++; /* increment statistics */ - + /* Cur Hop Limit value */ if (ra->nd_ra_curhoplimit && rai->hoplimit && ra->nd_ra_curhoplimit != rai->hoplimit) { @@ -1118,7 +1110,7 @@ ra_input(int len, struct nd_router_advert *ra, if (inconsistent) rai->rainconsistent++; - + done: free_ndopts(&ndopts); return; @@ -1137,7 +1129,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo, #if 0 /* impossible */ if (pinfo->nd_opt_pi_type != ND_OPT_PREFIX_INFORMATION) - return(0); + return (0); #endif /* @@ -1167,7 +1159,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo, inet_ntop(AF_INET6, &from->sin6_addr, ntopbuf, INET6_ADDRSTRLEN), rai->ifname); - return(0); + return (0); } preferred_time = ntohl(pinfo->nd_opt_pi_preferred_time); @@ -1250,7 +1242,7 @@ prefix_check(struct nd_opt_prefix_info *pinfo, inconsistent++; } - return(inconsistent); + return (inconsistent); } struct prefix * @@ -1269,13 +1261,13 @@ find_prefix(struct rainfo *rai, struct in6_addr *prefix, int plen) if (memcmp((void *)prefix, (void *)&pp->prefix, bytelen)) continue; if (bitlen == 0 || - ((prefix->s6_addr[bytelen] & bitmask) == + ((prefix->s6_addr[bytelen] & bitmask) == (pp->prefix.s6_addr[bytelen] & bitmask))) { - return(pp); + return (pp); } } - return(NULL); + return (NULL); } /* check if p0/plen0 matches p1/plen1; return 1 if matches, otherwise 0. */ @@ -1287,19 +1279,19 @@ prefix_match(struct in6_addr *p0, int plen0, u_char bitmask; if (plen0 < plen1) - return(0); + return (0); bytelen = plen1 / 8; bitlen = plen1 % 8; bitmask = 0xff << (8 - bitlen); if (memcmp((void *)p0, (void *)p1, bytelen)) - return(0); + return (0); if (bitlen == 0 || ((p0->s6_addr[bytelen] & bitmask) == (p1->s6_addr[bytelen] & bitmask))) { - return(1); + return (1); } - return(0); + return (0); } static int @@ -1327,12 +1319,9 @@ nd6_options(struct nd_opt_hdr *hdr, int limit, goto bad; } - if (hdr->nd_opt_type > ND_OPT_MTU -#ifdef RDNSS - && hdr->nd_opt_type != ND_OPT_RDNSS && - hdr->nd_opt_type != ND_OPT_DNSSL -#endif - ) { + if (hdr->nd_opt_type > ND_OPT_MTU && + hdr->nd_opt_type != ND_OPT_RDNSS && + hdr->nd_opt_type != ND_OPT_DNSSL) { syslog(LOG_INFO, "<%s> unknown ND option(type %d)", __func__, hdr->nd_opt_type); continue; @@ -1350,14 +1339,12 @@ nd6_options(struct nd_opt_hdr *hdr, int limit, */ if ((hdr->nd_opt_type == ND_OPT_MTU && optlen != sizeof(struct nd_opt_mtu)) || -#ifdef RDNSS (hdr->nd_opt_type == ND_OPT_RDNSS && (optlen < 24 || (optlen - sizeof(struct nd_opt_rdnss)) % 16 != 0)) || (hdr->nd_opt_type == ND_OPT_DNSSL && (optlen < 16 || (optlen - sizeof(struct nd_opt_dnssl)) % 8 != 0)) || -#endif (hdr->nd_opt_type == ND_OPT_PREFIX_INFORMATION && optlen != sizeof(struct nd_opt_prefix_info)) ) { @@ -1369,10 +1356,8 @@ nd6_options(struct nd_opt_hdr *hdr, int limit, switch (hdr->nd_opt_type) { case ND_OPT_TARGET_LINKADDR: case ND_OPT_REDIRECTED_HEADER: -#ifdef RDNSS case ND_OPT_RDNSS: case ND_OPT_DNSSL: -#endif break; /* we don't care about these options */ case ND_OPT_SOURCE_LINKADDR: case ND_OPT_MTU: @@ -1408,12 +1393,12 @@ nd6_options(struct nd_opt_hdr *hdr, int limit, } } - return(0); + return (0); bad: free_ndopts(ndopts); - return(-1); + return (-1); } static void @@ -1429,7 +1414,7 @@ free_ndopts(union nd_opts *ndopts) } void -sock_open() +sock_open(void) { struct icmp6_filter filt; struct ipv6_mreq mreq; @@ -1446,7 +1431,7 @@ sock_open() exit(1); } - sndcmsgbuflen = CMSG_SPACE(sizeof(struct in6_pktinfo)) + + sndcmsgbuflen = CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int)); sndcmsgbuf = (u_char *)malloc(sndcmsgbuflen); if (sndcmsgbuf == NULL) { @@ -1459,43 +1444,22 @@ sock_open() strerror(errno)); exit(1); } - /* specify to tell receiving interface */ on = 1; -#ifdef IPV6_RECVPKTINFO if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0) { syslog(LOG_ERR, "<%s> IPV6_RECVPKTINFO: %s", __func__, strerror(errno)); exit(1); } -#else /* old adv. API */ - if (setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &on, - sizeof(on)) < 0) { - syslog(LOG_ERR, "<%s> IPV6_PKTINFO: %s", - __func__, strerror(errno)); - exit(1); - } -#endif - on = 1; /* specify to tell value of hoplimit field of received IP6 hdr */ -#ifdef IPV6_RECVHOPLIMIT if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on, sizeof(on)) < 0) { syslog(LOG_ERR, "<%s> IPV6_RECVHOPLIMIT: %s", __func__, strerror(errno)); exit(1); } -#else /* old adv. API */ - if (setsockopt(sock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on, - sizeof(on)) < 0) { - syslog(LOG_ERR, "<%s> IPV6_HOPLIMIT: %s", - __func__, strerror(errno)); - exit(1); - } -#endif - ICMP6_FILTER_SETBLOCKALL(&filt); ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filt); ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filt); @@ -1511,13 +1475,9 @@ sock_open() /* * join all routers multicast address on each advertising interface. */ - if (inet_pton(AF_INET6, ALLROUTERS_LINK, - &mreq.ipv6mr_multiaddr.s6_addr) - != 1) { - syslog(LOG_ERR, "<%s> inet_pton failed(library bug?)", - __func__); - exit(1); - } + memcpy(&mreq.ipv6mr_multiaddr.s6_addr, + &sin6_linklocal_allrouters.sin6_addr, + sizeof(mreq.ipv6mr_multiaddr.s6_addr)); while (ra) { mreq.ipv6mr_interface = ra->ifindex; if (setsockopt(sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, @@ -1531,16 +1491,12 @@ sock_open() /* * When attending router renumbering, join all-routers site-local - * multicast group. + * multicast group. */ if (accept_rr) { - if (inet_pton(AF_INET6, ALLROUTERS_SITE, - &in6a_site_allrouters) != 1) { - syslog(LOG_ERR, "<%s> inet_pton failed(library bug?)", - __func__); - exit(1); - } - mreq.ipv6mr_multiaddr = in6a_site_allrouters; + memcpy(&mreq.ipv6mr_multiaddr.s6_addr, + &sin6_sitelocal_allrouters.sin6_addr, + sizeof(mreq.ipv6mr_multiaddr.s6_addr)); if (mcastif) { if ((mreq.ipv6mr_interface = if_nametoindex(mcastif)) == 0) { @@ -1561,7 +1517,7 @@ sock_open() exit(1); } } - + /* initialize msghdr for receiving packets */ rcviov[0].iov_base = (caddr_t)answer; rcviov[0].iov_len = sizeof(answer); @@ -1578,13 +1534,13 @@ sock_open() sndmhdr.msg_iovlen = 1; sndmhdr.msg_control = (caddr_t)sndcmsgbuf; sndmhdr.msg_controllen = sndcmsgbuflen; - + return; } /* open a routing socket to watch the routing table */ static void -rtsock_open() +rtsock_open(void) { if ((rtsock = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) { syslog(LOG_ERR, @@ -1600,15 +1556,14 @@ if_indextorainfo(int idx) for (rai = ralist; rai; rai = rai->next) { if (rai->ifindex == idx) - return(rai); + return (rai); } - return(NULL); /* search failed */ + return (NULL); /* search failed */ } static void -ra_output(rainfo) -struct rainfo *rainfo; +ra_output(struct rainfo *rainfo) { int i; struct cmsghdr *cm; @@ -1623,7 +1578,7 @@ struct rainfo *rainfo; make_packet(rainfo); /* XXX: inefficient */ - sndmhdr.msg_name = (caddr_t)&sin6_allnodes; + sndmhdr.msg_name = (caddr_t)&sin6_linklocal_allnodes; sndmhdr.msg_iov[0].iov_base = (caddr_t)rainfo->ra_data; sndmhdr.msg_iov[0].iov_len = rainfo->ra_datalen; @@ -1649,7 +1604,7 @@ struct rainfo *rainfo; syslog(LOG_DEBUG, "<%s> send RA on %s, # of waitings = %d", - __func__, rainfo->ifname, rainfo->waiting); + __func__, rainfo->ifname, rainfo->waiting); i = sendmsg(sock, &sndmhdr, 0); @@ -1701,7 +1656,7 @@ ra_timeout(void *data) ra_output(rai); - return(rai->timer); + return (rai->timer); } /* update RA timer */ @@ -1717,7 +1672,7 @@ ra_timer_update(void *data, struct timeval *tm) * between the interface's configured MinRtrAdvInterval and * MaxRtrAdvInterval (RFC2461 6.2.4). */ - interval = rai->mininterval; + interval = rai->mininterval; #ifdef HAVE_ARC4RANDOM interval += arc4random_uniform(rai->maxinterval - rai->mininterval); #else diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h index e346a1a..ee163ed 100644 --- a/usr.sbin/rtadvd/rtadvd.h +++ b/usr.sbin/rtadvd/rtadvd.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,12 +29,36 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - -#define ALLNODES "ff02::1" -#define ALLROUTERS_LINK "ff02::2" -#define ALLROUTERS_SITE "ff05::2" -#define ANY "::" -#define RTSOLLEN 8 +#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}} +#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ + {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} +#define IN6ADDR_SITELOCAL_ALLROUTERS_INIT \ + {{{ 0xff, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}} +extern const struct sockaddr_in6 sin6_linklocal_allnodes; +extern const struct sockaddr_in6 sin6_linklocal_allrouters; +extern const struct sockaddr_in6 sin6_sitelocal_allrouters; +/* + * RFC 3542 API deprecates IPV6_PKTINFO in favor of + * IPV6_RECVPKTINFO + */ +#ifndef IPV6_RECVPKTINFO +#ifdef IPV6_PKTINFO +#define IPV6_RECVPKTINFO IPV6_PKTINFO +#endif +#endif +/* + * RFC 3542 API deprecates IPV6_HOPLIMIT in favor of + * IPV6_RECVHOPLIMIT + */ +#ifndef IPV6_RECVHOPLIMIT +#ifdef IPV6_HOPLIMIT +#define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT +#endif +#endif /* protocol constants and default values */ #define DEF_MAXRTRADVINTERVAL 600 @@ -94,7 +118,6 @@ struct rtinfo { }; #endif -#ifdef RDNSS struct rdnss_addr { TAILQ_ENTRY(rdnss_addr) ra_next; @@ -130,7 +153,6 @@ struct dnssl { TAILQ_HEAD(, dnssl_addr) dn_list; /* list of search domains */ u_int32_t dn_ltime; /* number of seconds valid */ }; -#endif struct soliciter { struct soliciter *next; @@ -168,10 +190,8 @@ struct rainfo { u_int hoplimit; /* AdvCurHopLimit */ struct prefix prefix; /* AdvPrefixList(link head) */ int pfxs; /* number of prefixes */ -#ifdef RDNSS TAILQ_HEAD(, rdnss) rdnss; /* DNS server list */ TAILQ_HEAD(, dnssl) dnssl; /* search domain list */ -#endif long clockskew; /* used for consisitency check of lifetimes */ #ifdef ROUTEINFO diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c index 7fb0902..fcad4ab 100644 --- a/usr.sbin/rtadvd/timer.c +++ b/usr.sbin/rtadvd/timer.c @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -85,7 +85,7 @@ rtadvd_add_timer(struct rtadvd_timer *(*timeout)(void *), /* link into chain */ insque(newtimer, &timer_head); - return(newtimer); + return (newtimer); } void @@ -146,13 +146,13 @@ rtadvd_check_timer() if (TIMEVAL_EQUAL(&tm_max, &timer_head.tm)) { /* no need to timeout */ - return(NULL); + return (NULL); } 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 TIMEVAL_SUB(&timer_head.tm, &now, &returnval); - return(&returnval); + return (&returnval); } struct timeval * @@ -170,7 +170,7 @@ rtadvd_timer_rest(struct rtadvd_timer *timer) else TIMEVAL_SUB(&timer->tm, &now, &returnval); - return(&returnval); + return (&returnval); } /* result = a + b */ diff --git a/usr.sbin/rtadvd/timer.h b/usr.sbin/rtadvd/timer.h index 4526103..6603743 100644 --- a/usr.sbin/rtadvd/timer.h +++ b/usr.sbin/rtadvd/timer.h @@ -4,7 +4,7 @@ /* * Copyright (C) 1998 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,7 +16,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |