Tag Archives: Openwrt

Error in running script in openwrt

Details of error reporting are as follows
root@OpenWrt :~# /root/connect_ net.sh
-ash: /root/connect_ net.sh: not found

When running a script, the above error occurs. The variables in the script are defined as
code = curl - O/dev/null - SW% {http_code} www.baidu. Com

After querying, it is found that the shell only supports ash in openwrt, while Bash is used by default in Linux and Ubuntu

The solution here is when defining variables, the left and right sides of the equal sign '=' are not left blank, as shown in the example
code = curl - O/dev/null - SW% {http_code} www.baidu. Com

The operation of variables in openwrt still needs attention

    variable operation only supports expr, not $[], $(()), let. These three formats must leave a space around the plus sign “+”

[Solved] Failed to set attribute: Invalid input data or parameter

Arm64 swconfig failed to configure VLAN

Failed to set attribute: invalid input data or parameter

Kernel version: linux-5.20.26
phenomenon:

root@OpenWrt:/usr/lib# swconfig dev switch0 vlan 2 set ports "1 2 3"
Failed to set attribute: Invalid input data or parameter

Ref:
https://forum.openwrt.org/t/ath79-kernel-5-4-swconfig-libnl-tiny-issue/50689
https://github.com/MartB/openwrt/commit/df051318503ff41c6214fa845e447dcfc5d1a1d8
Reason: The problem with libnl-tiny can be solved by using libnl-3 instead

--- a/package/network/config/swconfig/Makefile
+++ b/package/network/config/swconfig/Makefile
@@ -14,27 +14,26 @@ PKG_MAINTAINER:=Felix Fietkau <[email protected]>
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/kernel.mk
 
 define Package/swconfig
   SECTION:=base
   CATEGORY:=Base system
-  DEPENDS:=+libuci +libnl-tiny
+  DEPENDS:=+libuci +libnl
   TITLE:=Switch configuration utility
 endef
 
 TARGET_CPPFLAGS := \
        -D_GNU_SOURCE \
-       -I$(STAGING_DIR)/usr/include/libnl-tiny \
+       -I$(STAGING_DIR)/usr/include/libnl3\
+       -I$(LINUX_DIR)/include \
        -I$(PKG_BUILD_DIR) \
-       $(TARGET_CPPFLAGS) \
-       -I$(LINUX_DIR)/user_headers/include
+       $(TARGET_CPPFLAGS)
 
 define Build/Compile
        CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
        $(MAKE) -C $(PKG_BUILD_DIR) \
                $(TARGET_CONFIGURE_OPTS) \
-               LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci -lubox"
+               LIBS="-L$(STAGING_DIR)/usr/lib -lnl-genl-3 -lnl-3 -lm -luci -lubox"
 endef

[Solved] Openwrt Pptpd Start Error: validation filed

It’s probably that the configuration file is directly copied and pasted, resulting in invisible strange strings. If you honestly modify the configuration file without leaving strange spaces, you will not report this error. The configuration file is parsed by UCI. The configuration file of pptpd is in the/etc/config/pptpd file. The content is as follows,

config service 'pptpd'
option enabled '1'
option localip '192.168.0.1'
option remoteip '192.168.0.2-30'
option nat '1'
option internet '1'
#list dns '192.168.1.1'
#list dns '10.10.0.21'
option mppe '1'


config login
option enabled '1'
option username 'user2'
option password 'dfsaf'
option ipaddress '192.168.0.2'

/etc/init.d/pptpd restart
/etc/init.d/pptpd start
Both can open pptpd server now
netstat -antp
Check if port 1723 is open, if it is open, it is running.
For sh out of range, see:

https://forum.openwrt.org/t/default-config-file-for-pptpd-lacks-logwtmp-option/4795

######/etc/firewall.user###########

iptables -A forwarding_rule -i ppp+ -j ACCEPT ## luci-app-pptpd
iptables -A forwarding_rule -o ppp+ -j ACCEPT ## luci-app-pptpd
iptables -A output_rule -o ppp+ -j ACCEPT ## luci-app-pptpd
iptables -A input_wan_rule -p tcp --dport 1723 -j ACCEPT ## luci-app-pptpd
iptables -A input_wan_rule -p tcp --dport 47 -j ACCEPT ## luci-app-pptpd
iptables -A input_wan_rule -p gre -j ACCEPT ## luci-app-pptpd
iptables -A input_rule -i ppp+ -j ACCEPT ## luci-app-pptpd