Re: [OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

2020-01-24 Thread Rui Salvaterra
Gah, I messed up the subject line. Will resend shortly, sorry for the noise. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel

[OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

2020-01-24 Thread Rui Salvaterra
v3: changed strncmp to strcmp, since both strings are null-terminated. v2: addressed Petr Štetiar's concerns and also changed the generic helper to check for the availability of IPv4 or IPv6 targets, as needed. The flow table detection fails if the respective target module is built-in, since

Re: [OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

2020-01-23 Thread Jo-Philipp Wich
Hi, > This doesn't seem right to me in case target > 12, > MIN(sizeof(line), strlen(target)) perhaps? a simple strcmp() without len will be the most appropriate since both line (produced by fgets()) and target (a constant string literal) will be \0 terminated. ~ Jo signature.asc Description:

Re: [OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

2020-01-18 Thread Petr Štetiar
Rui Salvaterra [2020-01-16 21:16:43]: Hi, > +fw3_has_target(const char *target) > +{ > + FILE *f; > + > + char line[12]; > + bool seen = false; > + > + const char *path = "/proc/net/ip_tables_targets"; > + > + if (!(f = fopen(path, "r"))) > + return false; > + >

[OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

2020-01-16 Thread Rui Salvaterra
The flowtable detection fails if the respective target module is built-in, since it's looking for the module itself. Create a generic helper and instead check for existence of the FLOWTABLE target in /proc/net/ip_tables_targets. Signed-off-by: Rui Salvaterra --- defaults.c | 24