diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2006-03-25 09:34:14 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2006-03-25 09:34:14 +0000 |
commit | 943608fec578708a0dd6fd57216e77ccf80829a3 (patch) | |
tree | 7fda45641e41220d421103398fab6add30585be8 /usr.sbin/ospfd | |
parent | 8fc5db82c8f8f78a2736e6d0cb75903bd0423552 (diff) |
Highlight that running an OSPF router without forwarding enabled is
very damaging to the network.
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index 401153a6122..5c7e97fef78 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.29 2006/03/14 16:14:30 claudio Exp $ */ +/* $OpenBSD: ospfd.c,v 1.30 2006/03/25 09:34:13 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -24,6 +24,8 @@ #include <sys/time.h> #include <sys/stat.h> #include <sys/wait.h> +#include <sys/param.h> +#include <sys/sysctl.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -120,6 +122,9 @@ main(int argc, char *argv[]) char *conffile; int ch, opts = 0; int debug = 0; + int ipforwarding; + int mib[4]; + size_t len; conffile = CONF_FILE; ospfd_process = PROC_MAIN; @@ -152,6 +157,17 @@ main(int argc, char *argv[]) log_init(debug); + mib[0] = CTL_NET; + mib[1] = PF_INET; + mib[2] = IPPROTO_IP; + mib[3] = IPCTL_FORWARDING; + len = sizeof(ipforwarding); + if (sysctl(mib, 4, &ipforwarding, &len, NULL, 0) == -1) + err(1, "sysctl"); + + if (!ipforwarding) + log_warnx("WARNING: forwarding NOT enabled"); + /* fetch interfaces early */ kif_init(); |