summaryrefslogtreecommitdiff
path: root/usr.sbin/rtadvd
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2013-05-08 06:24:45 +0000
committerBrad Smith <brad@cvs.openbsd.org>2013-05-08 06:24:45 +0000
commitd5d9e5458e47f9644c0e6871262d60d3635456fb (patch)
tree7e489f927a102b571bc41e1391fe93283ecaf5ac /usr.sbin/rtadvd
parent9fb835682739e13e1d4279967ff4702c0ed6a4c8 (diff)
Correctly compute packet size when including DNS search lists.
From Stephane A. Sezer ok bluhm@
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r--usr.sbin/rtadvd/config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index f6e22849280..c2a378d0012 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.33 2013/04/30 12:30:40 florian Exp $ */
+/* $OpenBSD: config.c,v 1.34 2013/05/08 06:24:44 brad Exp $ */
/* $KAME: config.c,v 1.62 2002/05/29 10:13:10 itojun Exp $ */
/*
@@ -723,8 +723,12 @@ make_packet(struct rainfo *rainfo)
packlen += sizeof(struct nd_opt_dnssl);
+ /*
+ * Each domain in the packet ends with a null byte. Account for
+ * that here.
+ */
TAILQ_FOREACH(dnsd, &dsl->dnssldoms, entry)
- domains_size += dnsd->length;
+ domains_size += dnsd->length + 1;
domains_size = (domains_size + 7) & ~7;
@@ -849,7 +853,7 @@ make_packet(struct rainfo *rainfo)
size = 0;
TAILQ_FOREACH(dnsd, &dsl->dnssldoms, entry)
- size += dnsd->length;
+ size += dnsd->length + 1;
/* align size on the next 8 byte boundary */
size = (size + 7) & ~7;
ndopt_dnssl->nd_opt_dnssl_len = 1 + size / 8;