Discussion:
rtadvd unicast
Jérémie Courrèges-Anglas
2016-02-05 12:50:46 UTC
Permalink
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?

Index: config.c
===================================================================
RCS file: /cvs/src/usr.sbin/rtadvd/config.c,v
retrieving revision 1.46
diff -u -p -r1.46 config.c
--- config.c 25 Jan 2016 05:00:12 -0000 1.46
+++ config.c 5 Feb 2016 12:49:19 -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.61
diff -u -p -r1.61 rtadvd.c
--- rtadvd.c 1 Dec 2015 12:11:31 -0000 1.61
+++ rtadvd.c 5 Feb 2016 12:49:19 -0000
@@ -686,18 +686,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
@@ -1276,7 +1264,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);
@@ -1317,25 +1304,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.18
diff -u -p -r1.18 rtadvd.h
--- rtadvd.h 30 Nov 2015 21:04:15 -0000 1.18
+++ rtadvd.h 5 Feb 2016 12:49:20 -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 solication source */
};
SLIST_HEAD(ralist, rainfo);
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Jérémie Courrèges-Anglas
2016-02-08 23:23:51 UTC
Permalink
Post by Jérémie Courrèges-Anglas
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?
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
Alexander Bluhm
2016-02-09 00:03:56 UTC
Permalink
Post by Jérémie Courrèges-Anglas
Post by Jérémie Courrèges-Anglas
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?
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
Loading...