X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=main.c;h=5888ab50285a6e416d3434ea28f9e16901d7106a;hp=b95302050286d1d840caea0cc74313da0c46599d;hb=0a7d36d8cf56f160b531f3db9f045e3f9315dd15;hpb=410cff5e62db45e8415bf25bf50395b4e7e22482 diff --git a/main.c b/main.c index b953020..5888ab5 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ /* * firewall3 - 3rd OpenWrt UCI firewall implementation * - * Copyright (C) 2013-2014 Jo-Philipp Wich + * Copyright (C) 2013-2014 Jo-Philipp Wich * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -79,7 +79,7 @@ build_state(bool runtime) else { if (!fw3_ubus_connect()) - error("Failed to connect to ubus"); + warn("Failed to connect to ubus"); if (uci_load(state->uci, "firewall", &p)) { @@ -104,7 +104,7 @@ build_state(bool runtime) fw3_load_ipsets(state, p); fw3_load_zones(state, p); fw3_load_rules(state, p, b.head); - fw3_load_redirects(state, p); + fw3_load_redirects(state, p, b.head); fw3_load_snats(state, p, b.head); fw3_load_forwards(state, p); fw3_load_includes(state, p); @@ -546,7 +546,6 @@ int main(int argc, char **argv) } build_state(false); - build_state(true); defs = &cfg_state->defaults; if (optind >= argc) @@ -577,12 +576,18 @@ int main(int argc, char **argv) print_family = family; fw3_pr_debug = true; - rv = start(); + if (fw3_lock()) + { + build_state(true); + rv = start(); + fw3_unlock(); + } } else if (!strcmp(argv[optind], "start")) { if (fw3_lock()) { + build_state(true); rv = start(); fw3_unlock(); } @@ -591,6 +596,7 @@ int main(int argc, char **argv) { if (fw3_lock()) { + build_state(true); rv = stop(false); fw3_unlock(); } @@ -599,6 +605,7 @@ int main(int argc, char **argv) { if (fw3_lock()) { + build_state(true); rv = stop(true); fw3_unlock(); } @@ -607,6 +614,7 @@ int main(int argc, char **argv) { if (fw3_lock()) { + build_state(true); stop(true); rv = start(); fw3_unlock(); @@ -616,6 +624,7 @@ int main(int argc, char **argv) { if (fw3_lock()) { + build_state(true); rv = reload(); fw3_unlock(); }