aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/route6d/route6d.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-01-09 00:38:19 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-01-09 00:38:19 +0000
commit074a0dcceb65a040bec54282851ea1f84fce2a69 (patch)
treecc4f70a76a1cc233b959420496779a9c07b58754 /usr.sbin/route6d/route6d.c
parent240ecb400fd4aaf7557ae891f193d8e4d100f54f (diff)
downloadsrc-074a0dcceb65a040bec54282851ea1f84fce2a69.tar.gz
src-074a0dcceb65a040bec54282851ea1f84fce2a69.zip
Use nitems(mib) instead of hardcoding mib's length
MFC after: 3 days
Notes
Notes: svn path=/head/; revision=311713
Diffstat (limited to 'usr.sbin/route6d/route6d.c')
-rw-r--r--usr.sbin/route6d/route6d.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 814137e82441..90a492f7fe8a 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -2418,7 +2418,7 @@ getifmtu(int ifindex)
mib[3] = AF_INET6;
mib[4] = NET_RT_IFLIST;
mib[5] = ifindex;
- if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, nitems(mib), NULL, &msize, NULL, 0) < 0) {
fatal("sysctl estimate NET_RT_IFLIST");
/*NOTREACHED*/
}
@@ -2426,7 +2426,7 @@ getifmtu(int ifindex)
fatal("malloc");
/*NOTREACHED*/
}
- if (sysctl(mib, 6, buf, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, nitems(mib), buf, &msize, NULL, 0) < 0) {
fatal("sysctl NET_RT_IFLIST");
/*NOTREACHED*/
}
@@ -2598,7 +2598,7 @@ krtread(int again)
free(buf);
buf = NULL;
}
- if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, nitems(mib), NULL, &msize, NULL, 0) < 0) {
errmsg = "sysctl estimate";
continue;
}
@@ -2606,7 +2606,7 @@ krtread(int again)
errmsg = "malloc";
continue;
}
- if (sysctl(mib, 6, buf, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, nitems(mib), buf, &msize, NULL, 0) < 0) {
errmsg = "sysctl NET_RT_DUMP";
continue;
}