diff options
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r-- | usr.sbin/rtadvd/advcap.c | 3 | ||||
-rw-r--r-- | usr.sbin/rtadvd/config.c | 18 | ||||
-rw-r--r-- | usr.sbin/rtadvd/dump.c | 2 | ||||
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 6 |
4 files changed, 11 insertions, 18 deletions
diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c index b0f5ee0..7280f40 100644 --- a/usr.sbin/rtadvd/advcap.c +++ b/usr.sbin/rtadvd/advcap.c @@ -81,7 +81,6 @@ static char *tbuf; static int hopcount; /* detect infinite loops in termcap, init 0 */ -static const char *remotefile; extern const char *conffile; int tgetent(char *, char *); @@ -204,7 +203,7 @@ tnchktc(void) write(STDERR_FILENO, "Infinite tc= loop\n", 18); return (0); } - if (getent(tcbuf, tcname, remotefile) != 1) { + if (getent(tcbuf, tcname, conffile) != 1) { return (0); } for (q = tcbuf; *q++ != ':'; ) diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index 4c870b9..1b48868 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -109,7 +109,7 @@ dname_labelenc(char *dst, const char *src) /* Always need a 0-length label at the tail. */ *dst++ = '\0'; - syslog(LOG_DEBUG, "<%s> labellen = %d", __func__, dst - dst_origin); + syslog(LOG_DEBUG, "<%s> labellen = %td", __func__, dst - dst_origin); return (dst - dst_origin); } @@ -229,13 +229,7 @@ getconfig(int idx) __func__, intface); } - rai = malloc(sizeof(*rai)); - if (rai == NULL) { - syslog(LOG_INFO, "<%s> %s: can't allocate enough memory", - __func__, intface); - exit(1); - } - memset(rai, 0, sizeof(*rai)); + ELM_MALLOC(rai, exit(1)); TAILQ_INIT(&rai->rai_prefix); #ifdef ROUTEINFO TAILQ_INIT(&rai->rai_route); @@ -394,10 +388,7 @@ getconfig(int idx) /* allocate memory to store prefix information */ ELM_MALLOC(pfx, exit(1)); - - /* link into chain */ - TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); - rai->rai_pfxs++; + pfx->pfx_rainfo = rai; pfx->pfx_origin = PREFIX_FROM_CONFIG; if (inet_pton(AF_INET6, addr, &pfx->pfx_prefix) != 1) { @@ -481,6 +472,9 @@ getconfig(int idx) pfx->pfx_pltimeexpire = now.tv_sec + pfx->pfx_preflifetime; } + /* link into chain */ + TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); + rai->rai_pfxs++; } if (rai->rai_advifprefix && rai->rai_pfxs == 0) get_prefix(rai); diff --git a/usr.sbin/rtadvd/dump.c b/usr.sbin/rtadvd/dump.c index f79319b..fac3fb2 100644 --- a/usr.sbin/rtadvd/dump.c +++ b/usr.sbin/rtadvd/dump.c @@ -310,7 +310,7 @@ dname_labeldec(char *dst, size_t dlen, const char *src) (src + len) <= src_last) { if (dst != dst_origin) *dst++ = '.'; - syslog(LOG_DEBUG, "<%s> labellen = %d", __func__, len); + syslog(LOG_DEBUG, "<%s> labellen = %zd", __func__, len); memcpy(dst, src, len); src += len; dst += len; diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 614d109..6423e7b 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -789,7 +789,7 @@ rtadvd_input(void) #else if ((size_t)i < sizeof(struct icmp6_hdr)) { syslog(LOG_ERR, - "<%s> packet size(%d) is too short", + "<%s> packet size(%zd) is too short", __func__, i); return; } @@ -827,7 +827,7 @@ rtadvd_input(void) if ((size_t)i < sizeof(struct nd_router_solicit)) { syslog(LOG_NOTICE, "<%s> RS from %s on %s does not have enough " - "length (len = %d)", + "length (len = %zd)", __func__, inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, sizeof(ntopbuf)), @@ -873,7 +873,7 @@ rtadvd_input(void) if ((size_t)i < sizeof(struct nd_router_advert)) { syslog(LOG_NOTICE, "<%s> RA from %s on %s does not have enough " - "length (len = %d)", + "length (len = %zd)", __func__, inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, sizeof(ntopbuf)), |