On Tue, Feb 09, 2016 at 12:23:51AM +0100, J??r??mie Courr??ges-Anglas wrote:
>
> > rtadvd contains code to send unicast replies, RFC4861 mentions this
> > possibility (section 6.2.6) but I'm having a hard time thinking how it
> > could be useful.
> >
> > Since the sending part is commented out since it was introduced, I doubt
> > that anyone will miss it. This removes pointless memory allocations.
> >
> > ok?
OK bluhm@
>
> Updated patch:
>
> Index: config.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/config.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 config.c
> --- config.c 8 Feb 2016 23:19:00 -0000 1.49
> +++ config.c 8 Feb 2016 23:22:13 -0000
> @@ -111,7 +111,6 @@ getconfig(char *intface)
> TAILQ_INIT(&tmp->rtinfos);
> TAILQ_INIT(&tmp->rdnsss);
> TAILQ_INIT(&tmp->dnssls);
> - SLIST_INIT(&tmp->soliciters);
>
> /* check if we are allowed to forward packets (if not determined) */
> if (forwarding < 0) {
> Index: rtadvd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.c,v
> retrieving revision 1.66
> diff -u -p -r1.66 rtadvd.c
> --- rtadvd.c 8 Feb 2016 23:19:00 -0000 1.66
> +++ rtadvd.c 8 Feb 2016 23:22:14 -0000
> @@ -690,18 +690,6 @@ rs_input(int len, struct nd_router_solic
> {
> long delay; /* must not be greater than 1000000 */
> struct timeval interval, now, min_delay, tm_tmp, *rest;
> - struct soliciter *sol;
> -
> - /*
> - * record sockaddr waiting for RA, if possible
> - */
> - sol = malloc(sizeof(*sol));
> - if (sol) {
> - sol->addr = *from;
> - /*XXX RFC2553 need clarification on flowinfo */
> - sol->addr.sin6_flowinfo = 0;
> - SLIST_INSERT_HEAD(&ra->soliciters, sol, entry);
> - }
>
> /*
> * If there is already a waiting RS packet, don't
> @@ -1280,7 +1268,6 @@ ra_output(struct rainfo *rainfo)
> int i;
> struct cmsghdr *cm;
> struct in6_pktinfo *pi;
> - struct soliciter *sol;
>
> if ((iflist[rainfo->ifindex]->ifm_flags & IFF_UP) == 0) {
> log_debug("%s is not up, skip sending RA", rainfo->ifname);
> @@ -1321,25 +1308,6 @@ ra_output(struct rainfo *rainfo)
> if (i < 0 || i != rainfo->ra_datalen)
> if (i < 0)
> log_warn("sendmsg on %s", rainfo->ifname);
> -
> - /*
> - * unicast advertisements
> - * XXX commented out. reason: though spec does not forbit it, unicast
> - * advert does not really help
> - */
> - while (!SLIST_EMPTY(&rainfo->soliciters)) {
> - sol = SLIST_FIRST(&rainfo->soliciters);
> - SLIST_REMOVE_HEAD(&rainfo->soliciters, entry);
> -#if 0
> - sndmhdr.msg_name = (caddr_t)&sol->addr;
> - i = sendmsg(sock, &sndmhdr, 0);
> - if (i < 0 || i != rainfo->ra_datalen)
> - if (i < 0)
> - log_warn("unicast sendmsg on %s",
> - rainfo->ifname);
> -#endif
> - free(sol);
> - }
>
> /* update counter */
> if (rainfo->initcounter < MAX_INITIAL_RTR_ADVERTISEMENTS)
> Index: rtadvd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.h,v
> retrieving revision 1.20
> diff -u -p -r1.20 rtadvd.h
> --- rtadvd.h 8 Feb 2016 23:19:00 -0000 1.20
> +++ rtadvd.h 8 Feb 2016 23:22:14 -0000
> @@ -117,11 +117,6 @@ struct dnssl {
> TAILQ_HEAD(dnssldomlist, dnssldom) dnssldoms;
> };
>
> -struct soliciter {
> - SLIST_ENTRY(soliciter) entry;
> - struct sockaddr_in6 addr;
> -};
> -
> struct rainfo {
> /* pointer for list */
> SLIST_ENTRY(rainfo) entry;
> @@ -170,9 +165,6 @@ struct rainfo {
> u_quad_t rainput; /* number of RAs received */
> u_quad_t rainconsistent; /* number of RAs inconsistent with ours */
> u_quad_t rsinput; /* number of RSs received */
> -
> - /* info about soliciter */
> - SLIST_HEAD(, soliciter) soliciters; /* recent solicitation source */
> };
> SLIST_HEAD(ralist, rainfo);
>
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE