diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2021-08-30 18:49:20 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2021-08-30 18:49:20 +0000 |
commit | 5ddc09b238bccc50d09f470e0fb0282bf7c8653e (patch) | |
tree | a64c33e93a64a939c888cc046d0351addbd5ae15 /sbin/route | |
parent | 31e15b8fee93ecde246e043effa1036fe0e055bc (diff) |
Fix max nameserver proposals limit
Count the total number of proposals and not five per address family each.
Don't print ignored addresses by default anymore and leave that to `-v'.
OK benno
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/route.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 81b77edf5fe..1b82260c05f 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.257 2021/08/05 07:30:04 tb Exp $ */ +/* $OpenBSD: route.c,v 1.258 2021/08/30 18:49:19 kn Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -1171,7 +1171,7 @@ nameserver(int argc, char *argv[]) #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif - for (; argc > 0; argc--, argv++) { + for (; argc > 0 && ns4_count + ns6_count < 5; argc--, argv++) { error = getaddrinfo(*argv, NULL, &hints, &res); if (error) { errx(1, "%s", gai_strerror(error)); @@ -1182,21 +1182,11 @@ nameserver(int argc, char *argv[]) switch (res->ai_addr->sa_family) { case AF_INET: - if (ns4_count >= nitems(ns4)) { - warnx("ignoring superfluous nameserver: %s", - *argv); - break; - } memcpy(&ns4[ns4_count++], &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof(struct in_addr)); break; case AF_INET6: - if (ns6_count >= nitems(ns6)) { - warnx("ignoring superfluous nameserver: %s", - *argv); - break; - } memcpy(&ns6[ns6_count++], &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof(struct in6_addr)); |