X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=main.c;h=e38963d25268abdf6aa6eb8de0edde5bf1d0fa6c;hp=b95302050286d1d840caea0cc74313da0c46599d;hb=6039c7f4b0052c4da21520cdd604f04a5a67f50d;hpb=410cff5e62db45e8415bf25bf50395b4e7e22482 diff --git a/main.c b/main.c index b953020..e38963d 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)) { @@ -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(); }