[OpenWrt-Devel] [PATCH v2] fw3: robustify flow table detection.
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 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 FLOWOFFLOAD target in /proc/net/ip_tables_targets. Signed-off-by: Rui Salvaterra --- defaults.c | 25 +++-- utils.c| 27 +++ utils.h| 6 ++ 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/defaults.c b/defaults.c index f03765c..c78ab51 100644 --- a/defaults.c +++ b/defaults.c @@ -85,26 +85,14 @@ check_policy(struct uci_element *e, enum fw3_flag *pol, const char *name) } static void -check_kmod(struct uci_element *e, bool *module, const char *name) +check_target(struct uci_element *e, bool *available, const char *target, const bool ipv6) { - FILE *f; - char buf[128]; - - if (!*module) - return; - - snprintf(buf, sizeof(buf), "/sys/module/%s/refcnt", name); - - f = fopen(buf, "r"); - - if (f) + const bool b = fw3_has_target(ipv6, target); + if (!b) { - fclose(f); - return; + warn_elem(e, "requires unavailable target extension %s, disabling", target); } - - warn_elem(e, "requires not available kernel module %s, disabling", name); - *module = false; + *available = b; } static void @@ -171,7 +159,8 @@ fw3_load_defaults(struct fw3_state *state, struct uci_package *p) check_any_reject_code(e, &defs->any_reject_code); - check_kmod(e, &defs->flow_offloading, "xt_FLOWOFFLOAD"); + /* exists in both ipv4 and ipv6, if at all, so only check ipv4 */ + check_target(e, &defs->flow_offloading, "FLOWOFFLOAD", false); } } diff --git a/utils.c b/utils.c index 441dbd2..f68a60a 100644 --- a/utils.c +++ b/utils.c @@ -344,6 +344,33 @@ fw3_has_table(bool ipv6, const char *table) return seen; } +bool +fw3_has_target(const bool ipv6, const char *target) +{ + FILE *f; + + char line[12]; + bool seen = false; + + const char *path = ipv6 + ? "/proc/net/ip6_tables_targets" : "/proc/net/ip_tables_targets"; + + if (!(f = fopen(path, "r"))) + return false; + + while (fgets(line, sizeof(line), f)) + { + if (!strncmp(line, target, MIN(sizeof(line), strlen(target + { + seen = true; + break; + } + } + + fclose(f); + + return seen; +} bool fw3_lock_path(int *fd, const char *path) diff --git a/utils.h b/utils.h index c8cf69a..558bb4f 100644 --- a/utils.h +++ b/utils.h @@ -89,6 +89,10 @@ void info(const char *format, ...) (!(flags & ((1
Re: [OpenWrt-Devel] [PATCH v4] ath79: add support for COMFAST CF-E130N v2
Hi, > -Original Message- > From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org] > On Behalf Of ad...@kryma.net > Sent: Donnerstag, 16. Januar 2020 22:35 > To: openwrt-devel@lists.openwrt.org > Cc: Pavel Balan > Subject: [OpenWrt-Devel] [PATCH v4] ath79: add support for COMFAST CF- > E130N v2 > > From: Pavel Balan > [...] > -Re unused led: the led is blocked by a mostly > opaque plate in the shell. It can still be > controlled, though. So now we know where it is. But what is it for? Any idea? > -Re verifying addresses: I don't think I did. > How would I do that? https://openwrt.org/docs/guide-developer/mac.address Install vendor firmware and check what MAC addresses are used there for eth0/WiFi. Add a table of MAC address assignment (and label MAC address) to the commit message after that, so your research results are conserved. > + partition@2 { > + compatible = "denx,uimage"; > + label = "firmware"; > + reg = <0x02 0x7d>; > + }; Some Comfast devices have a config partition <0x7e 0x01>. Is that missing for your device or should we add it? > + > + partition@7f { > + label = "nvram"; > + reg = <0x7f 0x01>; > + read-only; > + }; > + }; > + }; > +}; > + > +&uart { > + status = "okay"; > + > +}; > + > +ð1 { > + status = "okay"; > + > + phy-handle = <&swphy0>; > + > + mtd-mac-address = <&art 0x0>; > + > + gmac-config { > + device = <&gmac>; > + switch-phy-swap = <1>; > + }; > +}; > + > +ð0 { > + compatible = "syscon", "simple-mfd"; > +}; The network setup looks wrong to me. I think you just need to make eth1->eth0 and eth0->eth1. If that's not helping, play with switch-phy-swap and setting phy-handle to swphy0 or swphy4. Have a look at the other qca9531 comfast devices. > + > +&wmac { > + status = "okay"; > + > + mtd-cal-data = <&art 0x1000>; > +}; > diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds > b/target/linux/ath79/generic/base-files/etc/board.d/01_leds > index fbb0d0ea03..7521e435a1 100755 > --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds > +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds > @@ -47,6 +47,15 @@ comfast,cf-e120a-v3) > ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" > "$boardname:green:rssimediumhigh" "wlan0" "51" "100" > ucidef_set_led_rssi "rssihigh" "RSSIHIGH" > "$boardname:green:rssihigh" "wlan0" "76" "100" > ;; > +comfast,cf-e130n-v2) > + ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0" > + ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" You do not need this line since you have a trigger in DTS. > + ucidef_set_rssimon "wlan0" "20" "1" > + ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" > "wlan0" "1" "100" > + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" > "$boardname:red:rssimediumlow" "wlan0" "26" "100" > + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" > "$boardname:green:rssimediumhigh" "wlan0" "51" "100" > + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" > "$boardname:green:rssihigh" "wlan0" "76" "100" > + ;; > comfast,cf-e313ac) > ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" > "switch0" "0x02" > ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" > "eth1" > diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network > b/target/linux/ath79/generic/base-files/etc/board.d/02_network > index 10ca213e70..5840b90bf6 100755 > --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network > +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network > @@ -86,6 +86,8 @@ ath79_setup_interfaces() > ;; > comfast,cf-e110n-v2|\ > comfast,cf-e120a-v3|\ > + comfast,cf-e130n-v2|\ > + ucidef_set_interface_lan "eth1" This is not only very unlikely to be correct, it will also change the devices above to a wrong setup. You will need to add your device to the case where ' ucidef_set_interface_lan "eth0"' is set. Then you will need to adjust DTS to make that work. Best Adrian openpgp-digital-signature.asc Description: PGP signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] GSoC 2020 - reminder for ideas
Hi there, as I mentioned we plan to apply again as organization for Google Summer of Code. The application period for organization opened 2 days ago. To apply successful as organization, we also need to provide an updated list of project ideas. These ideas are a base for students to develop their proposal. Please update or add your new ideas as soon as possible to our project's website at https://projects.freifunk.net You can do that via github, just add or update your files at https://github.com/freifunk/projects.freifunk.net-contents/tree/master/collections/_projects Thank you! Best regards, Andi ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 6/7] base-files/functions.sh: do not iterate over ls
Hi, > -Original Message- > From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org] > On Behalf Of Rosen Penev > Sent: Freitag, 17. Januar 2020 05:44 > To: openwrt-devel@lists.openwrt.org > Subject: [OpenWrt-Devel] [PATCH 6/7] base-files/functions.sh: do not > iterate over ls > > It does word splitting and glob expansion, which is undesirable. > > https://github.com/koalaman/shellcheck/wiki/SC2045 > > Signed-off-by: Rosen Penev > --- > package/base-files/files/lib/functions.sh | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/package/base-files/files/lib/functions.sh b/package/base- > files/files/lib/functions.sh > index 82a2169260..048bfd2b2a 100755 > --- a/package/base-files/files/lib/functions.sh > +++ b/package/base-files/files/lib/functions.sh > @@ -283,7 +283,8 @@ default_postinst() { > include() { > local file > > - for file in $(ls $1/*.sh 2>/dev/null); do > + for file in "$1"/*.sh; do > + [ -e "$file" ] || break I personally think this command flow is counter-intuitive (having to filter the pattern if no file is found). I prefer the ls version and would reject that one unless somebody else likes it (and says so until Monday). Nevertheless, thanks for caring. Best Adrian openpgp-digital-signature.asc Description: PGP signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.
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; > + > + while (fgets(line, sizeof(line), f)) > + { > + if (!strncmp(line, target, strlen(target))) This doesn't seem right to me in case target > 12, MIN(sizeof(line), strlen(target)) perhaps? -- ynezz ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v2 1/5] linux-firmware: add wil6210 firmware
I have several issues on a x86_64 testbed. > https://github.com/openwrt/openwrt/pull/2417#issuecomment-575878911 I think, they are not directly related to the patches, but something is strange, and make 60 ghz out-of-the-box not working on OpenWrt. Espeically, the segmentation fault in the ubus library, is strange and further the netfid stuff will crash... :/ On 16.01.20 12:50, Adrian Schmutzler wrote: > From: Robert Marko > > This patch adds wil6210 firmware and board files. > Firmware version is not up to date but is only freely > redistributable one I found. > Board file is a generic one so most devices and especially those > for long distance PtP links will require so in a ipq-wifi like way. > > Signed-off-by: Robert Marko > --- > package/firmware/linux-firmware/qca.mk | 8 > 1 file changed, 8 insertions(+) > > diff --git a/package/firmware/linux-firmware/qca.mk > b/package/firmware/linux-firmware/qca.mk > index 23fcc0905a..71b484d5c7 100644 > --- a/package/firmware/linux-firmware/qca.mk > +++ b/package/firmware/linux-firmware/qca.mk > @@ -37,3 +37,11 @@ define Package/carl9170-firmware/install > $(INSTALL_DATA) $(PKG_BUILD_DIR)/carl9170-1.fw $(1)/lib/firmware > endef > $(eval $(call BuildPackage,carl9170-firmware)) > + > +Package/wil6210-firmware = $(call Package/firmware-default,wil6210 firmware) > +define Package/wil6210-firmware/install > + $(INSTALL_DIR) $(1)/lib/firmware > + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wil6210.fw $(1)/lib/firmware > + $(INSTALL_DATA) $(PKG_BUILD_DIR)/wil6210.brd $(1)/lib/firmware > +endef > +$(eval $(call BuildPackage,wil6210-firmware)) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel