summaryrefslogtreecommitdiffhomepage
path: root/contrib/fwd/src/fwd.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-12-15 11:22:56 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-12-15 11:22:56 +0000
commitb957d3f56ddc8bcebed21e3c334f6b9b973627c0 (patch)
tree7d972254a7dbdab80a7527276c25b25dfa7b00d4 /contrib/fwd/src/fwd.c
parent7001c02a38ce75eac28efea6ac0a415133dba535 (diff)
contrib/fwd: update main, not really useful yet
Diffstat (limited to 'contrib/fwd/src/fwd.c')
-rw-r--r--contrib/fwd/src/fwd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/fwd/src/fwd.c b/contrib/fwd/src/fwd.c
index 44b7f5a12..9d925bc00 100644
--- a/contrib/fwd/src/fwd.c
+++ b/contrib/fwd/src/fwd.c
@@ -21,13 +21,16 @@
#include "fwd_addr.h"
#include "fwd_rules.h"
#include "fwd_config.h"
-
-#define IPT "iptables"
+#include "fwd_xtables.h"
int main(int argc, const char *argv[])
{
struct fwd_handle *h;
+ struct iptc_handle *ipt;
+
+ if( getuid() > 0 )
+ fwd_fatal("Need root permissions!");
if( !(h = fwd_alloc_ptr(struct fwd_handle)) )
fwd_fatal("Out of memory");
@@ -41,13 +44,11 @@ int main(int argc, const char *argv[])
if( !(h->addrs = fwd_get_addrs(h->rtnl_socket, AF_INET)) )
fwd_fatal("Failed to issue RTM_GETADDR (%m)");
-
fwd_ipt_build_ruleset(h);
fwd_ipt_addif(h, "lan");
fwd_ipt_addif(h, "wan");
-
close(h->rtnl_socket);
fwd_free_config(h->conf);
fwd_free_addrs(h->addrs);