summaryrefslogtreecommitdiffstats
path: root/tools/regression/sockets/so_setfib/so_setfib.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/regression/sockets/so_setfib/so_setfib.c')
-rw-r--r--tools/regression/sockets/so_setfib/so_setfib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/regression/sockets/so_setfib/so_setfib.c b/tools/regression/sockets/so_setfib/so_setfib.c
index 3c07852..50cb020 100644
--- a/tools/regression/sockets/so_setfib/so_setfib.c
+++ b/tools/regression/sockets/so_setfib/so_setfib.c
@@ -45,6 +45,7 @@
* 5. Repeat for next domain family and type from (2) on.
*/
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
@@ -143,6 +144,7 @@ t(u_int dom, u_int type)
if (s == -1) {
printf("not ok %d %s_%s # socket(): %s\n", testno,
t_dom[dom].name, t_type[type].name, strerror(errno));
+ testno++;
return;
}
@@ -168,6 +170,11 @@ main(int argc __unused, char *argv[] __unused)
u_int i, j;
size_t s;
+ if (geteuid() != 0) {
+ printf("1..0 # SKIP: must be root");
+ return (0);
+ }
+
/* Initalize randomness. */
srandomdev();
@@ -175,6 +182,10 @@ main(int argc __unused, char *argv[] __unused)
s = sizeof(rt_numfibs);
if (sysctlbyname("net.fibs", &rt_numfibs, &s, NULL, 0) == -1)
err(1, "sysctlbyname(net.fibs, ..)");
+
+ printf("1..%lu\n",
+ (nitems(t_dom) - 1) * nitems(t_type) * (2 + rt_numfibs + 2 + 3));
+
/* Adjust from number to index. */
rt_numfibs -= 1;
OpenPOWER on IntegriCloud