[email protected] (Jérémie Courrèges-Anglas) writes:
> - a few *cnt members of struct rainfo aren't used for anything
> - the SIOCGIFPREFIX_IN6 ioctl has been deprecated since June 2002
> - prefix_match() and in6a_site_allrouters are remnants from the
> Renumbering code (now in the Attic)
>
> ok?
ping
> Index: config.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/config.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 config.c
> --- config.c 9 Feb 2016 00:39:13 -0000 1.50
> +++ config.c 9 Feb 2016 00:54:13 -0000
> @@ -323,7 +323,6 @@ getconfig(char *intface)
> if (tmp->pfxs == 0 && !agetflag("noifprefix"))
> get_prefix(tmp);
>
> - tmp->rtinfocnt = 0;
> for (i = -1; i < MAXRTINFO; i++) {
> struct rtinfo *rti;
> char entbuf[256];
> @@ -391,10 +390,8 @@ getconfig(char *intface)
> rti->lifetime = (uint32_t)val64;
>
> TAILQ_INSERT_TAIL(&tmp->rtinfos, rti, entry);
> - tmp->rtinfocnt++;
> }
>
> - tmp->rdnsscnt = 0;
> for (i = -1; i < MAXRDNSS; ++i) {
> struct rdnss *rds;
> char entbuf[256];
> @@ -417,7 +414,6 @@ getconfig(char *intface)
> fatal("malloc");
>
> TAILQ_INSERT_TAIL(&tmp->rdnsss, rds, entry);
> - tmp->rdnsscnt++;
>
> rds->servercnt = val;
>
> @@ -441,7 +437,6 @@ getconfig(char *intface)
> }
> }
>
> - tmp->dnsslcnt = 0;
> for (i = -1; i < MAXDNSSL; ++i) {
> struct dnssl *dsl;
> char entbuf[256];
> @@ -481,7 +476,6 @@ getconfig(char *intface)
> }
>
> TAILQ_INSERT_TAIL(&tmp->dnssls, dsl, entry);
> - tmp->dnsslcnt++;
>
> makeentry(entbuf, sizeof(entbuf), i, "dnsslltime");
> MAYHAVE(val, entbuf, (tmp->maxinterval * 3) / 2);
> @@ -692,44 +686,11 @@ delete_prefix(struct rainfo *rai, struct
> static int
> init_prefix(struct in6_prefixreq *ipr)
> {
> -#if 0
> - int s;
> -
> - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
> - log_warn("socket");
> - exit(1);
> - }
> -
> - if (ioctl(s, SIOCGIFPREFIX_IN6, (caddr_t)ipr) < 0) {
> - log_warn("ioctl:SIOCGIFFLAGS: failed for %s", ifr.ifr_name);
> -
> - ipr->ipr_vltime = DEF_ADVVALIDLIFETIME;
> - ipr->ipr_pltime = DEF_ADVPREFERREDLIFETIME;
> - ipr->ipr_raf_onlink = 1;
> - ipr->ipr_raf_auto = 1;
> - /* omit other field initialization */
> - }
> - else if (ipr->ipr_origin < PR_ORIG_RR) {
> - u_char ntopbuf[INET6_ADDRSTRLEN];
> -
> - log_warn("Added prefix(%s)'s origin %d is"
> - " lower than PR_ORIG_RR(router renumbering)."
> - " This should not happen if I am router",
> - inet_ntop(AF_INET6, &ipr->ipr_prefix.sin6_addr, ntopbuf,
> - sizeof(ntopbuf)), ipr->ipr_origin);
> - close(s);
> - return 1;
> - }
> -
> - close(s);
> - return 0;
> -#else
> ipr->ipr_vltime = DEF_ADVVALIDLIFETIME;
> ipr->ipr_pltime = DEF_ADVPREFERREDLIFETIME;
> ipr->ipr_raf_onlink = 1;
> ipr->ipr_raf_auto = 1;
> return 0;
> -#endif
> }
>
> void
> Index: rtadvd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.c,v
> retrieving revision 1.68
> diff -u -p -r1.68 rtadvd.c
> --- rtadvd.c 9 Feb 2016 00:40:00 -0000 1.68
> +++ rtadvd.c 9 Feb 2016 00:54:13 -0000
> @@ -1009,30 +1009,6 @@ find_prefix(struct rainfo *rai, struct i
> return(NULL);
> }
>
> -/* check if p0/plen0 matches p1/plen1; return 1 if matches, otherwise 0. */
> -int
> -prefix_match(struct in6_addr *p0, int plen0,
> - struct in6_addr *p1, int plen1)
> -{
> - int bytelen, bitlen;
> - u_char bitmask;
> -
> - if (plen0 < plen1)
> - return(0);
> - bytelen = plen1 / 8;
> - bitlen = plen1 % 8;
> - bitmask = 0xff << (8 - bitlen);
> - if (memcmp((void *)p0, (void *)p1, bytelen))
> - return(0);
> - if (bitlen == 0 ||
> - ((p0->s6_addr[bytelen] & bitmask) ==
> - (p1->s6_addr[bytelen] & bitmask))) {
> - return(1);
> - }
> -
> - return(0);
> -}
> -
> static int
> nd6_options(struct nd_opt_hdr *hdr, int limit,
> union nd_opts *ndopts, u_int32_t optflags)
> Index: rtadvd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.h,v
> retrieving revision 1.21
> diff -u -p -r1.21 rtadvd.h
> --- rtadvd.h 9 Feb 2016 00:39:13 -0000 1.21
> +++ rtadvd.h 9 Feb 2016 00:54:13 -0000
> @@ -148,11 +148,8 @@ struct rainfo {
> TAILQ_HEAD(prefixlist, prefix) prefixes; /* AdvPrefixList(link head) */
> int pfxs; /* number of prefixes */
> TAILQ_HEAD(rtinfolist, rtinfo) rtinfos;
> - int rtinfocnt;
> TAILQ_HEAD(rdnsslist, rdnss) rdnsss; /* advertised recursive dns
> servers */
> - int rdnsscnt; /* number of rdnss entries */
> TAILQ_HEAD(dnssllist, dnssl) dnssls;
> - int dnsslcnt;
> long clockskew; /* used for consistency check of lifetimes */
>
>
> @@ -171,8 +168,5 @@ SLIST_HEAD(ralist, rainfo);
> void ra_timeout(void *);
> void ra_timer_update(void *, struct timeval *);
>
> -int prefix_match(struct in6_addr *, int, struct in6_addr *, int);
> struct rainfo *if_indextorainfo(int);
> struct prefix *find_prefix(struct rainfo *, struct in6_addr *, int);
> -
> -extern struct in6_addr in6a_site_allrouters;
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE