[LEDE-DEV] [PATCH 1/2] utils: rename function fw3_hotplug to fw3_hotplug_zone
Rename fw3_hotplug function to fw3_hotplug_zone to use fw3_hotlpug for common hotplug events like start|stop|flush|reload|restart Signed-off-by: Florian Eckert --- utils.c | 2 +- utils.h | 2 +- zones.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils.c b/utils.c index 024f95e..f855840 100644 --- a/utils.c +++ b/utils.c @@ -711,7 +711,7 @@ fw3_free_list(struct list_head *head) } bool -fw3_hotplug(bool add, void *zone, void *device) +fw3_hotplug_zone(bool add, void *zone, void *device) { struct fw3_zone *z = zone; struct fw3_device *d = device; diff --git a/utils.h b/utils.h index 9a716ae..9ad7b91 100644 --- a/utils.h +++ b/utils.h @@ -106,7 +106,7 @@ void fw3_free_object(void *obj, const void *opts); void fw3_free_list(struct list_head *head); -bool fw3_hotplug(bool add, void *zone, void *device); +bool fw3_hotplug_zone(bool add, void *zone, void *device); int fw3_netmask2bitlen(int family, void *mask); diff --git a/zones.c b/zones.c index 2aa7473..0d663be 100644 --- a/zones.c +++ b/zones.c @@ -703,7 +703,7 @@ fw3_hotplug_zones(struct fw3_state *state, bool add) if (add != fw3_hasbit(z->flags[0], FW3_FLAG_HOTPLUG)) { list_for_each_entry(d, &z->devices, list) - fw3_hotplug(add, z, d); + fw3_hotplug_zone(add, z, d); if (add) fw3_setbit(z->flags[0], FW3_FLAG_HOTPLUG); -- 2.11.0 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 2/2] main: add start|stop|flush|reload|restart event handling
Add -e option for fw3 start|stop|flush|reload|restart events. If option is set, then common hotplug events are executed in dir '/etc/hotplug.d/firewall' Signed-off-by: Florian Eckert --- main.c | 13 +++-- utils.c | 33 + utils.h | 5 - 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index c4b8228..9a7b6dd 100644 --- a/main.c +++ b/main.c @@ -504,7 +504,7 @@ static int usage(void) { fprintf(stderr, "fw3 [-4] [-6] [-q] print\n"); - fprintf(stderr, "fw3 [-q] {start|stop|flush|reload|restart}\n"); + fprintf(stderr, "fw3 [-q] [-e] {start|stop|flush|reload|restart}\n"); fprintf(stderr, "fw3 [-q] network {net}\n"); fprintf(stderr, "fw3 [-q] device {dev}\n"); fprintf(stderr, "fw3 [-q] zone {zone} [dev]\n"); @@ -519,7 +519,7 @@ int main(int argc, char **argv) enum fw3_family family = FW3_FAMILY_ANY; struct fw3_defaults *defs = NULL; - while ((ch = getopt(argc, argv, "46dqh")) != -1) + while ((ch = getopt(argc, argv, "46dqhe")) != -1) { switch (ch) { @@ -539,6 +539,10 @@ int main(int argc, char **argv) if (freopen("/dev/null", "w", stderr)) {} break; + case 'e': + fw3_do_hotplug = true; + break; + case 'h': rv = usage(); goto out; @@ -589,6 +593,7 @@ int main(int argc, char **argv) { build_state(true); rv = start(); + fw3_hotplug("start"); fw3_unlock(); } } @@ -598,6 +603,7 @@ int main(int argc, char **argv) { build_state(true); rv = stop(false); + fw3_hotplug("stop"); fw3_unlock(); } } @@ -607,6 +613,7 @@ int main(int argc, char **argv) { build_state(true); rv = stop(true); + fw3_hotplug("flush"); fw3_unlock(); } } @@ -617,6 +624,7 @@ int main(int argc, char **argv) build_state(true); stop(true); rv = start(); + fw3_hotplug("restart"); fw3_unlock(); } } @@ -626,6 +634,7 @@ int main(int argc, char **argv) { build_state(true); rv = reload(); + fw3_hotplug("reload"); fw3_unlock(); } } diff --git a/utils.c b/utils.c index f855840..29c3e46 100644 --- a/utils.c +++ b/utils.c @@ -29,6 +29,7 @@ static pid_t pipe_pid = -1; static FILE *pipe_fd = NULL; bool fw3_pr_debug = false; +bool fw3_do_hotplug = false; static void @@ -749,6 +750,38 @@ fw3_hotplug_zone(bool add, void *zone, void *device) return false; } +bool +fw3_hotplug(const char *event) +{ + if(!fw3_do_hotplug) + return false; + + switch (fork()) + { + case -1: + warn("Unable to fork(): %s\n", strerror(errno)); + return false; + + case 0: + break; + + default: + return true; + } + + close(0); + close(1); + close(2); + if (chdir("/")) {}; + + clearenv(); + setenv("ACTION", event, 1); + execl(FW3_HOTPLUG, FW3_HOTPLUG, "firewall", NULL); + + /* unreached */ + return false; +} + int fw3_netmask2bitlen(int family, void *mask) { diff --git a/utils.h b/utils.h index 9ad7b91..08453c1 100644 --- a/utils.h +++ b/utils.h @@ -38,9 +38,10 @@ #define FW3_STATEFILE "/var/run/fw3.state" #define FW3_LOCKFILE "/var/run/fw3.lock" -#define FW3_HOTPLUG "/sbin/hotplug-call" +#define FW3_HOTPLUG"/sbin/hotplug-call" extern bool fw3_pr_debug; +extern bool fw3_do_hotplug; void warn_elem(struct uci_element *e, const char *format, ...); void warn(const char *format, ...); @@ -108,6 +109,8 @@ void fw3_free_list(struct list_head *head); bool fw3_hotplug_zone(bool add, void *zone, void *device); +bool fw3_hotplug(const char *event); + int fw3_netmask2bitlen(int family, void *mask); bool fw3_bitlen2netmask(int family, int bits, void *mask); -- 2.11.0 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] mwan3 status: missing graphic status boxes
Hello Mauro Mozzarelli I noticed that in the latest builds (from r6375 and onwards) mwan3 status cgi-bin/luci/admin/status/mwan is missing the graphic traffic light boxes. Is this an error or have they been removed? I have removed this, because it will not fit into the look and feel and I want to get rid of the css in this module. See: https://github.com/openwrt/luci/pull/1652 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] mwan3 status: missing graphic status boxes
I have update the luci-app-mwan3 status pages as requested from users to show the boxes again. See PR: https://github.com/openwrt/luci/pull/1696 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] libubox: allow reading out the pid of uloop process in lua
Add Lua methode to get the forked pid of a uloop process Signed-off-by: Florian Eckert --- lua/uloop.c | 13 + 1 file changed, 13 insertions(+) diff --git a/lua/uloop.c b/lua/uloop.c index a78c2dc..1b0389f 100644 --- a/lua/uloop.c +++ b/lua/uloop.c @@ -288,8 +288,21 @@ static int ul_process_free(lua_State *L) return 1; } +static int ul_process_pid(lua_State *L) +{ + struct lua_uloop_process *proc = lua_touserdata(L, 1); + + if (proc->p.pid) { + lua_pushnumber(L, proc->p.pid); + return 1; + } + + return 0; +} + static const luaL_Reg process_m[] = { { "delete", ul_process_free }, + { "pid", ul_process_pid }, { NULL, NULL } }; -- 2.1.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] sysupgrade on lantiq xrx200 form openwrt to lede
Hello LEDE-Team I am using a openwrt 15.05 on an lantiq xrx200 device. Upgrade works always as expectet for 15.05. I am using the squashfs tar file. I wantet to test lede and i have seen that the image generation has completly changed there is no tar file anymore only bin. If i use this to make a sysupgrade command i always get the output Could not open mtd device: firmware Can't open device for writing! Upgrade completed Rebooting system... In openwrt i always could untar the tar file. To see the structur CONTROL ... In lede this does not work anymore. What to i make wrong? Could you explain your changes? Regards Flo ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] ubi images with lantiq
Hello Lede-Team We have developed an own layout with the lantiq xrx200 soc. For now we are useing the openwrt 15.05 Branch. I have evaluated the lede tree on our board. After some try an error the system is now booting with lede but only with jffs2 support mtd layout openwrt with ubifs - uboot - uboot_env - kernel - ubi mtd lyout lede with jffs2 - uboot - uboot_env - fimware I have enabled to build an ubi based firmware, but the firmware is always an jffs2? Does lede decieded to standardize only have jffs2 support for alle arch targets? Who can i get ubifs support back on image generation?. Regards Flo ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] prosody package missing on i386 for lede-17.01
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- Are there any reason why does the package prosody is missing for the following x86 targets? packages-17.01/i386_geode packages-17.01/i386_i486/ packages-17.01/i386_pentium packages-17.01/i386_pentium4 --- End Message --- ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] New nagging message in Flash Operations page
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- > Well, my answer is: "of course I have customs files and certificates, > otherwise why would I use OpenWrt in the first place and NO, THANK YOU! I > will not perform a factory reset otherwise I will loose all of my nice > customizations". > > Is there any particular reason for this new message appearing? Is there a > new substantial change in the configuration files? If you import a backup then there will only be a reboot and not a implicit factory reset before configuration import. So if you have more then one router with different setups (configuration) and you import a configuration from one router to the other router, then the two configuration are merged! That means files that are not changed by the import will remain on the system. https://github.com/openwrt/luci/commit/10fbf9b2e45c8b723c4c5d58a9183a55715f3d04#diff-2001317459acbc977a3d9c4b6e6b25f1 I think this is not what you want! --- End Message --- ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev