Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
26
package/network/utils/adb-enablemodem/Makefile
Normal file
26
package/network/utils/adb-enablemodem/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adb-enablemodem
|
||||
PKG_VERSION:=2017-03-05
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/adb-enablemodem
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=WWAN
|
||||
TITLE:=Enable modem via adb
|
||||
DEPENDS:=+adb
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/adb-enablemodem/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/adb-enablemodem $(1)/etc/init.d/adb-enablemodem
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,adb-enablemodem))
|
||||
64
package/network/utils/adb-enablemodem/files/adb-enablemodem
Normal file
64
package/network/utils/adb-enablemodem/files/adb-enablemodem
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
adb_exec() {
|
||||
adb -s "$serial" shell "( $1 ) >/dev/null 2>&1"'; printf "\nEXIT_CODE: %i\n" $?' | head -c 64 | grep -qx 'EXIT_CODE: 0\r\?'
|
||||
}
|
||||
|
||||
enablemodem_do() {
|
||||
logger -t adb-enablemodem 'INFO: waiting for device'
|
||||
adb wait-for-device
|
||||
serial="$(adb get-serialno)"
|
||||
|
||||
vendor_id="$(adb -s "$serial" shell 'uci get product.usb.vid' | head -c 16 | tr -d '\r\n')"
|
||||
product_id="$(adb -s "$serial" shell 'uci get product.usb.pid' | head -c 16 | tr -d '\r\n')"
|
||||
|
||||
case "$vendor_id:$product_id" in
|
||||
"0x2357:0x000D") # TP-LINK LTE MODULE
|
||||
case "$1" in
|
||||
start)
|
||||
if adb_exec '
|
||||
chmod +x /WEBSERVER/www/cgi-bin/*
|
||||
fds="$(ls /proc/$$/fd | grep -v "^[012]$")"
|
||||
for fd in $fds; do
|
||||
eval "exec $fd>&-"
|
||||
done
|
||||
start-stop-daemon -x httpd -S -- -h /WEBSERVER/www/
|
||||
'; then
|
||||
logger -t adb-enablemodem 'INFO: httpd on modem started'
|
||||
else
|
||||
logger -t adb-enablemodem 'ERROR: failed to start httpd on modem'
|
||||
fi
|
||||
option_newid='/sys/bus/usb-serial/drivers/option1/new_id'
|
||||
if [ -e "$option_newid" ]; then
|
||||
printf '%s %s' "$vendor_id" "$product_id" > "$option_newid"
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if adb_exec 'start-stop-daemon -x httpd -K'; then
|
||||
logger -t adb-enablemodem 'INFO: httpd on modem stopped'
|
||||
else
|
||||
logger -t adb-enablemodem 'ERROR: failed to stop httpd on modem'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
logger -t adb-enablemodem "ERROR: unknown device $vendor_id:$product_id"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start() {
|
||||
( enablemodem_do start ) &
|
||||
}
|
||||
|
||||
stop() {
|
||||
( enablemodem_do stop ) &
|
||||
}
|
||||
|
||||
restart() {
|
||||
( enablemodem_do stop; enablemodem_do start ) &
|
||||
}
|
||||
|
||||
42
package/network/utils/arptables/Makefile
Normal file
42
package/network/utils/arptables/Makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=arptables
|
||||
PKG_VERSION:=0.0.5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://ftp.netfilter.org/pub/arptables
|
||||
PKG_HASH:=4f9a0656ce5c90868f551cd4deeb2d04f33899667e1fb2818b64e432fe8f629c
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/arptables-legacy
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
TITLE:=ARP firewalling software
|
||||
DEPENDS:=+kmod-arptables
|
||||
URL:=https://git.netfilter.org/arptables/
|
||||
PROVIDES:=arptables
|
||||
ALTERNATIVES:=\
|
||||
200:/usr/sbin/arptables:/usr/sbin/arptables-legacy
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
COPT_FLAGS="$(TARGET_CFLAGS) -D__OPTIMIZE__=1" \
|
||||
KERNEL_DIR="$(LINUX_DIR)"
|
||||
|
||||
define Package/arptables-legacy/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/arptables-legacy $(1)/usr/sbin/arptables-legacy
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arptables-legacy))
|
||||
92
package/network/utils/bpftool/Makefile
Normal file
92
package/network/utils/bpftool/Makefile
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# Copyright (C) 2020-2024 Tony Ambardar <itugrok@yahoo.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bpftool
|
||||
PKG_VERSION:=7.4.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/libbpf/bpftool
|
||||
PKG_MIRROR_HASH:=18e22f72e67ff402b5ecaf314445f25c40bfe23299cb783b5834a496297c51ed
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=v7.4.0
|
||||
|
||||
PKG_MAINTAINER:=Tony Ambardar <itugrok@yahoo.com>
|
||||
|
||||
PKG_BUILD_FLAGS:=no-mips16 gc-sections lto
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/bpftool/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=bpftool - eBPF subsystem utility
|
||||
LICENSE:=GPL-2.0-only OR BSD-2-Clause
|
||||
URL:=http://www.kernel.org
|
||||
DEPENDS:=+libelf
|
||||
endef
|
||||
|
||||
define Package/bpftool-minimal
|
||||
$(call Package/bpftool/Default)
|
||||
TITLE+= (Minimal)
|
||||
VARIANT:=minimal
|
||||
DEFAULT_VARIANT:=1
|
||||
PROVIDES:=bpftool
|
||||
ALTERNATIVES:=200:/usr/sbin/bpftool:/usr/libexec/bpftool-minimal
|
||||
endef
|
||||
|
||||
define Package/bpftool-full
|
||||
$(call Package/bpftool/Default)
|
||||
TITLE+= (Full)
|
||||
VARIANT:=full
|
||||
PROVIDES:=bpftool
|
||||
ALTERNATIVES:=300:/usr/sbin/bpftool:/usr/libexec/bpftool-full
|
||||
DEPENDS+= +libbfd +libopcodes
|
||||
endef
|
||||
|
||||
define Package/bpftool-minimal/description
|
||||
A tool for inspection and simple manipulation of eBPF programs and maps.
|
||||
endef
|
||||
|
||||
define Package/bpftool-full/description
|
||||
A tool for inspection and simple manipulation of eBPF programs and maps.
|
||||
This full version uses libbfd and libopcodes to support disassembly of
|
||||
eBPF programs and jited code.
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
full:=1
|
||||
else
|
||||
full:=0
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
OUTPUT="$(PKG_BUILD_DIR)/" \
|
||||
prefix="/usr" \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
|
||||
check_feat=0 \
|
||||
feature-clang-bpf-co-re=0 \
|
||||
feature-libbfd=$(full) \
|
||||
feature-llvm=0 \
|
||||
feature-libcap=0 \
|
||||
feature-disassembler-four-args=1 \
|
||||
feature-disassembler-init-styled=1
|
||||
|
||||
MAKE_PATH = src
|
||||
|
||||
define Package/bpftool-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bpftool \
|
||||
$(1)/usr/libexec/bpftool-$(BUILD_VARIANT)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bpftool-full))
|
||||
$(eval $(call BuildPackage,bpftool-minimal))
|
||||
15
package/network/utils/bpftool/patches/002-includes.patch
Normal file
15
package/network/utils/bpftool/patches/002-includes.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -73,10 +73,10 @@ CFLAGS += -W -Wall -Wextra -Wno-unused-p
|
||||
CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
|
||||
CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
|
||||
-I$(or $(OUTPUT),.) \
|
||||
- -I$(LIBBPF_INCLUDE) \
|
||||
-I$(srctree)/src/kernel/bpf/ \
|
||||
-I$(srctree)/include \
|
||||
- -I$(srctree)/include/uapi
|
||||
+ -I$(srctree)/include/uapi \
|
||||
+ -I$(LIBBPF_INCLUDE)
|
||||
ifneq ($(BPFTOOL_VERSION),)
|
||||
CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
|
||||
endif
|
||||
106
package/network/utils/comgt/Makefile
Normal file
106
package/network/utils/comgt/Makefile
Normal file
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=comgt
|
||||
PKG_VERSION:=0.32
|
||||
PKG_RELEASE:=35
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=@SF/comgt
|
||||
PKG_HASH:=0cedb2a5aa608510da66a99aab74df3db363df495032e57e791a2ff55f1d7913
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME).$(PKG_VERSION)
|
||||
PKG_CHECK_FORMAT_SECURITY:=0
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/comgt/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=WWAN
|
||||
endef
|
||||
|
||||
define Package/comgt
|
||||
$(call Package/comgt/Default)
|
||||
TITLE:=Option/Vodafone 3G/GPRS control tool
|
||||
DEPENDS:=+chat
|
||||
URL:=http://manpages.ubuntu.com/manpages/trusty/man1/comgt.1.html
|
||||
endef
|
||||
|
||||
define Package/comgt-directip
|
||||
$(call Package/comgt/Default)
|
||||
TITLE:=Sierra Wireless Direct-IP support
|
||||
DEPENDS:=+comgt +kmod-usb-serial +kmod-usb-serial-sierrawireless +kmod-usb-net +kmod-usb-net-sierrawireless
|
||||
endef
|
||||
|
||||
define Package/comgt-ncm
|
||||
$(call Package/comgt/Default)
|
||||
TITLE+=NCM 3G/4G Support
|
||||
DEPENDS:=+comgt +wwan +kmod-usb-serial-option +kmod-usb-net-huawei-cdc-ncm
|
||||
endef
|
||||
|
||||
define Package/comgt/description
|
||||
comgt is a scripting language interpreter useful for establishing
|
||||
communications on serial lines and through PCMCIA modems as well as GPRS
|
||||
and 3G datacards.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="" \
|
||||
comgt
|
||||
endef
|
||||
|
||||
define Package/comgt/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/comgt $(1)/usr/bin/
|
||||
$(LN) comgt $(1)/usr/bin/gcom
|
||||
$(INSTALL_DIR) $(1)/etc/chatscripts
|
||||
$(INSTALL_DATA) ./files/3g.chat $(1)/etc/chatscripts/3g.chat
|
||||
$(INSTALL_DATA) ./files/evdo.chat $(1)/etc/chatscripts/evdo.chat
|
||||
$(INSTALL_DIR) $(1)/etc/gcom
|
||||
$(INSTALL_DATA) ./files/setpin.gcom $(1)/etc/gcom/setpin.gcom
|
||||
$(INSTALL_DATA) ./files/setmode.gcom $(1)/etc/gcom/setmode.gcom
|
||||
$(INSTALL_DATA) ./files/getcardinfo.gcom $(1)/etc/gcom/getcardinfo.gcom
|
||||
$(INSTALL_DATA) ./files/getstrength.gcom $(1)/etc/gcom/getstrength.gcom
|
||||
$(INSTALL_DATA) ./files/getcarrier.gcom $(1)/etc/gcom/getcarrier.gcom
|
||||
$(INSTALL_DATA) ./files/getcnum.gcom $(1)/etc/gcom/getcnum.gcom
|
||||
$(INSTALL_DATA) ./files/getimsi.gcom $(1)/etc/gcom/getimsi.gcom
|
||||
$(INSTALL_DATA) ./files/runcommand.gcom $(1)/etc/gcom/runcommand.gcom
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/tty
|
||||
$(INSTALL_CONF) ./files/3g.usb $(1)/etc/hotplug.d/tty/30-3g
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||
$(INSTALL_BIN) ./files/3g.sh $(1)/lib/netifd/proto/3g.sh
|
||||
endef
|
||||
|
||||
define Package/comgt-directip/install
|
||||
$(INSTALL_DIR) $(1)/etc/gcom
|
||||
$(INSTALL_DATA) ./files/directip.gcom $(1)/etc/gcom/directip.gcom
|
||||
$(INSTALL_DATA) ./files/directip-stop.gcom $(1)/etc/gcom/directip-stop.gcom
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||
$(INSTALL_BIN) ./files/directip.sh $(1)/lib/netifd/proto/directip.sh
|
||||
endef
|
||||
|
||||
define Package/comgt-ncm/install
|
||||
$(INSTALL_DIR) $(1)/etc/gcom
|
||||
$(INSTALL_DATA) ./files/ncm.json $(1)/etc/gcom/ncm.json
|
||||
$(INSTALL_DIR) $(1)/lib/netifd/proto
|
||||
$(INSTALL_BIN) ./files/ncm.sh $(1)/lib/netifd/proto/ncm.sh
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,comgt))
|
||||
$(eval $(call BuildPackage,comgt-directip))
|
||||
$(eval $(call BuildPackage,comgt-ncm))
|
||||
12
package/network/utils/comgt/files/3g.chat
Normal file
12
package/network/utils/comgt/files/3g.chat
Normal file
@@ -0,0 +1,12 @@
|
||||
ABORT BUSY
|
||||
ABORT 'NO CARRIER'
|
||||
ABORT ERROR
|
||||
REPORT CONNECT
|
||||
TIMEOUT 10
|
||||
"" "AT&F"
|
||||
OK "ATE1"
|
||||
OK 'AT+CGDCONT=1,"IP","$USE_APN"'
|
||||
SAY "Calling UMTS/GPRS"
|
||||
TIMEOUT 30
|
||||
OK "ATD$DIALNUMBER"
|
||||
CONNECT ' '
|
||||
118
package/network/utils/comgt/files/3g.sh
Normal file
118
package/network/utils/comgt/files/3g.sh
Normal file
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
NOT_INCLUDED=1
|
||||
INCLUDE_ONLY=1
|
||||
|
||||
. ../netifd-proto.sh
|
||||
. ./ppp.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_3g_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
ppp_generic_init_config
|
||||
proto_config_add_string "device:device"
|
||||
proto_config_add_string "apn"
|
||||
proto_config_add_string "service"
|
||||
proto_config_add_string "pincode"
|
||||
proto_config_add_string "delay"
|
||||
proto_config_add_string "dialnumber"
|
||||
}
|
||||
|
||||
proto_3g_setup() {
|
||||
local interface="$1"
|
||||
local chat
|
||||
|
||||
json_get_var device device
|
||||
json_get_var apn apn
|
||||
json_get_var service service
|
||||
json_get_var pincode pincode
|
||||
json_get_var dialnumber dialnumber
|
||||
json_get_var delay delay
|
||||
|
||||
[ -n "$dat_device" ] && device=$dat_device
|
||||
|
||||
device="$(readlink -f $device)"
|
||||
[ -e "$device" ] || {
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$delay" ] && sleep "$delay"
|
||||
|
||||
case "$service" in
|
||||
cdma|evdo)
|
||||
chat="/etc/chatscripts/evdo.chat"
|
||||
;;
|
||||
*)
|
||||
chat="/etc/chatscripts/3g.chat"
|
||||
cardinfo=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom)
|
||||
if echo "$cardinfo" | grep -q Novatel; then
|
||||
case "$service" in
|
||||
umts_only) CODE=2;;
|
||||
gprs_only) CODE=1;;
|
||||
*) CODE=0;;
|
||||
esac
|
||||
export MODE="AT\$NWRAT=${CODE},2"
|
||||
elif echo "$cardinfo" | grep -q Option; then
|
||||
case "$service" in
|
||||
umts_only) CODE=1;;
|
||||
gprs_only) CODE=0;;
|
||||
*) CODE=3;;
|
||||
esac
|
||||
export MODE="AT_OPSYS=${CODE}"
|
||||
elif echo "$cardinfo" | grep -q "Sierra Wireless"; then
|
||||
SIERRA=1
|
||||
elif echo "$cardinfo" | grep -qi huawei; then
|
||||
case "$service" in
|
||||
umts_only) CODE="14,2";;
|
||||
gprs_only) CODE="13,1";;
|
||||
*) CODE="2,2";;
|
||||
esac
|
||||
export MODE="AT^SYSCFG=${CODE},3FFFFFFF,2,4"
|
||||
elif echo "$cardinfo" | grep -q "MikroTik"; then
|
||||
COMMAND="AT+CFUN=1" gcom -d "$device" -s /etc/gcom/runcommand.gcom || return 1
|
||||
fi
|
||||
|
||||
if [ -n "$pincode" ]; then
|
||||
PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
|
||||
proto_notify_error "$interface" PIN_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
[ -n "$MODE" ] && gcom -d "$device" -s /etc/gcom/setmode.gcom
|
||||
|
||||
# wait for carrier to avoid firmware stability bugs
|
||||
[ -n "$SIERRA" ] && {
|
||||
gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
|
||||
}
|
||||
|
||||
if [ -z "$dialnumber" ]; then
|
||||
dialnumber="*99***1#"
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
connect="${apn:+USE_APN=$apn }DIALNUMBER=$dialnumber /usr/sbin/chat -t5 -v -E -f $chat"
|
||||
ppp_generic_setup "$interface" \
|
||||
noaccomp \
|
||||
nopcomp \
|
||||
novj \
|
||||
nobsdcomp \
|
||||
noauth \
|
||||
set EXTENDPREFIX=1 \
|
||||
lock \
|
||||
crtscts \
|
||||
115200 "$device"
|
||||
return 0
|
||||
}
|
||||
|
||||
proto_3g_teardown() {
|
||||
proto_kill_command "$interface"
|
||||
}
|
||||
|
||||
[ -z "$NOT_INCLUDED" ] || add_protocol 3g
|
||||
35
package/network/utils/comgt/files/3g.usb
Normal file
35
package/network/utils/comgt/files/3g.usb
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
. /lib/netifd/netifd-proto.sh
|
||||
|
||||
find_3g_iface() {
|
||||
local cfg="$1"
|
||||
local tty="$2"
|
||||
|
||||
local proto
|
||||
config_get proto "$cfg" proto
|
||||
[ "$proto" = 3g ] || [ "$proto" = ncm ] || return 0
|
||||
|
||||
# bypass state vars here because 00-netstate could clobber .device
|
||||
local dev=$(uci_get network "$cfg" device)
|
||||
|
||||
if [ "${dev##*/}" = "${tty##*/}" ]; then
|
||||
if [ "$ACTION" = add ]; then
|
||||
proto_set_available "$cfg" 1
|
||||
fi
|
||||
if [ "$ACTION" = remove ]; then
|
||||
proto_set_available "$cfg" 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
[ "$ACTION" = add ] || [ "$ACTION" = remove ] || exit 0
|
||||
|
||||
case "$DEVICENAME" in
|
||||
tty*)
|
||||
[ -e "/dev/$DEVICENAME" ] || [ "$ACTION" = remove ] || exit 0
|
||||
config_load network
|
||||
config_foreach find_3g_iface interface "/dev/$DEVICENAME"
|
||||
;;
|
||||
esac
|
||||
|
||||
16
package/network/utils/comgt/files/directip-stop.gcom
Normal file
16
package/network/utils/comgt/files/directip-stop.gcom
Normal file
@@ -0,0 +1,16 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.05
|
||||
waitquiet 1 0.2
|
||||
|
||||
:start
|
||||
send "AT!SCACT=0,3^m"
|
||||
waitfor 5 "OK"
|
||||
if % = 0 goto hangupok
|
||||
print "WWAN error. Hangup failed.\r\n"
|
||||
exit 1
|
||||
|
||||
:hangupok
|
||||
print "WWAN connection established.\r\n"
|
||||
exit 0
|
||||
55
package/network/utils/comgt/files/directip.gcom
Normal file
55
package/network/utils/comgt/files/directip.gcom
Normal file
@@ -0,0 +1,55 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.05
|
||||
waitquiet 1 0.2
|
||||
|
||||
:start
|
||||
if $env("USE_AUTH") = "0" goto connect
|
||||
send "AT$QCPDPP=3,"
|
||||
send $env("USE_AUTH")
|
||||
send ",\""
|
||||
if $env("USE_USER") <> "" send $env("USE_USER")
|
||||
send "\",\""
|
||||
if $env("USE_PASS") <> "" send $env("USE_PASS")
|
||||
send "\"^m"
|
||||
waitfor 5 "OK"
|
||||
if % = 0 goto connect
|
||||
print "WWAN error. Auth failed.\r\n"
|
||||
exit 1
|
||||
|
||||
:connect
|
||||
send "AT+CFUN=1^m"
|
||||
send "AT+CGDCONT=3,\"IP\",\""
|
||||
send $env("USE_APN")
|
||||
send "\"^m"
|
||||
waitfor 5 "OK"
|
||||
if % = 0 goto connok
|
||||
print "WWAN error. Connection failed.\r\n"
|
||||
exit 1
|
||||
|
||||
:connok
|
||||
let c=1
|
||||
:loop
|
||||
sleep 2
|
||||
send "AT+CGATT?^m"
|
||||
waitfor 5 "+CGATT: 1"
|
||||
if % = 0 goto carrierok
|
||||
if c > 10 goto carriererr
|
||||
inc c
|
||||
goto loop
|
||||
|
||||
:carriererr
|
||||
print "WWAN error. No carrier.\r\n"
|
||||
exit 1
|
||||
|
||||
:carrierok
|
||||
send "AT!SCACT=1,3^m"
|
||||
waitfor 5 "OK"
|
||||
if % = 0 goto dialok
|
||||
print "WWAN error. Dialing failed.\r\n"
|
||||
exit 1
|
||||
|
||||
:dialok
|
||||
print "WWAN connection established.\r\n"
|
||||
exit 0
|
||||
114
package/network/utils/comgt/files/directip.sh
Normal file
114
package/network/utils/comgt/files/directip.sh
Normal file
@@ -0,0 +1,114 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_directip_init_config() {
|
||||
available=1
|
||||
no_device=1
|
||||
proto_config_add_string "device:device"
|
||||
proto_config_add_string "apn"
|
||||
proto_config_add_string "pincode"
|
||||
proto_config_add_string "auth"
|
||||
proto_config_add_string "username"
|
||||
proto_config_add_string "password"
|
||||
proto_config_add_defaults
|
||||
}
|
||||
|
||||
proto_directip_setup() {
|
||||
local interface="$1"
|
||||
local chat devpath devname
|
||||
|
||||
local device apn pincode ifname auth username password $PROTO_DEFAULT_OPTIONS
|
||||
json_get_vars device apn pincode auth username password $PROTO_DEFAULT_OPTIONS
|
||||
|
||||
[ -n "$ctl_device" ] && device=$ctl_device
|
||||
|
||||
device="$(readlink -f $device)"
|
||||
[ -e "$device" ] || {
|
||||
proto_notify_error "$interface" NO_DEVICE
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
devname="$(basename "$device")"
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
ifname="$( ls "$devpath"/../../*/net )"
|
||||
|
||||
[ -n "$ifname" ] || {
|
||||
proto_notify_error "$interface" NO_IFNAME
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | grep -q "Sierra Wireless" || {
|
||||
proto_notify_error "$interface" BAD_DEVICE
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ -n "$pincode" ]; then
|
||||
PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
|
||||
proto_notify_error "$interface" PIN_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
# wait for carrier to avoid firmware stability bugs
|
||||
gcom -d "$device" -s /etc/gcom/getcarrier.gcom || return 1
|
||||
|
||||
local auth_type=0
|
||||
case $auth in
|
||||
pap) auth_type=1;;
|
||||
chap) auth_type=2;;
|
||||
esac
|
||||
|
||||
USE_APN="$apn" USE_USER="$username" USE_PASS="$password" USE_AUTH="$auth_type" \
|
||||
gcom -d "$device" -s /etc/gcom/directip.gcom || {
|
||||
proto_notify_error "$interface" CONNECT_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
}
|
||||
|
||||
logger -p daemon.info -t "directip[$$]" "Connected, starting DHCP"
|
||||
proto_init_update "$ifname" 1
|
||||
proto_send_update "$interface"
|
||||
|
||||
json_init
|
||||
json_add_string name "${interface}_4"
|
||||
json_add_string ifname "@$interface"
|
||||
json_add_string proto "dhcp"
|
||||
proto_add_dynamic_defaults
|
||||
ubus call network add_dynamic "$(json_dump)"
|
||||
|
||||
json_init
|
||||
json_add_string name "${interface}_6"
|
||||
json_add_string ifname "@$interface"
|
||||
json_add_string proto "dhcpv6"
|
||||
json_add_string extendprefix 1
|
||||
proto_add_dynamic_defaults
|
||||
ubus call network add_dynamic "$(json_dump)"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
proto_directip_teardown() {
|
||||
local interface="$1"
|
||||
|
||||
local device
|
||||
json_get_vars device
|
||||
|
||||
[ -n "$ctl_device" ] && device=$ctl_device
|
||||
|
||||
gcom -d "$device" -s /etc/gcom/directip-stop.gcom || proto_notify_error "$interface" CONNECT_FAILED
|
||||
|
||||
proto_init_update "*" 0
|
||||
proto_send_update "$interface"
|
||||
}
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
add_protocol directip
|
||||
}
|
||||
17
package/network/utils/comgt/files/evdo.chat
Normal file
17
package/network/utils/comgt/files/evdo.chat
Normal file
@@ -0,0 +1,17 @@
|
||||
# This is a simple chat script based off of the one provided by Sierra Wireless
|
||||
# for CDMA connections. It should work for both Sprint and Verizon networks.
|
||||
|
||||
ABORT BUSY
|
||||
ABORT 'NO CARRIER'
|
||||
ABORT ERROR
|
||||
ABORT 'NO DIAL TONE'
|
||||
ABORT 'NO ANSWER'
|
||||
ABORT DELAYED
|
||||
REPORT CONNECT
|
||||
TIMEOUT 10
|
||||
'' AT
|
||||
OK ATZ
|
||||
SAY 'Calling CDMA/EVDO'
|
||||
TIMEOUT 30
|
||||
OK ATDT#777
|
||||
CONNECT ''
|
||||
14
package/network/utils/comgt/files/getcardinfo.gcom
Normal file
14
package/network/utils/comgt/files/getcardinfo.gcom
Normal file
@@ -0,0 +1,14 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.02
|
||||
waitquiet 0.2 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
send "AT+CGMI^m"
|
||||
get 1 "" $s
|
||||
print $s
|
||||
|
||||
:continue
|
||||
exit 0
|
||||
20
package/network/utils/comgt/files/getcarrier.gcom
Normal file
20
package/network/utils/comgt/files/getcarrier.gcom
Normal file
@@ -0,0 +1,20 @@
|
||||
opengt
|
||||
set senddelay 0.05
|
||||
waitquiet 1 0.2
|
||||
let c=1
|
||||
:loop
|
||||
inc c
|
||||
send "AT+CGATT?^m"
|
||||
waitfor 5 "+CGATT: 1","+CGATT: 0"
|
||||
print "\n."
|
||||
if % = -1 goto error
|
||||
if c > 10 goto toolong
|
||||
if % = 0 goto out
|
||||
sleep 2
|
||||
if % = 1 goto loop
|
||||
:toolong
|
||||
exit 1
|
||||
:error
|
||||
exit 0
|
||||
:out
|
||||
exit 0
|
||||
20
package/network/utils/comgt/files/getcnum.gcom
Normal file
20
package/network/utils/comgt/files/getcnum.gcom
Normal file
@@ -0,0 +1,20 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.02
|
||||
waitquiet 0.2 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
send "AT+CNUM^m"
|
||||
get 1 "^m" $n
|
||||
get 1 ":" $n
|
||||
get 1 "\"" $n
|
||||
get 1 "\"" $n
|
||||
get 1 "\"" $n
|
||||
get 1 "\"" $n
|
||||
let n = len($n)
|
||||
if n<1 goto continue
|
||||
print $n
|
||||
:continue
|
||||
exit 0
|
||||
17
package/network/utils/comgt/files/getimsi.gcom
Normal file
17
package/network/utils/comgt/files/getimsi.gcom
Normal file
@@ -0,0 +1,17 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.02
|
||||
waitquiet 0.2 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
send "AT+CIMI^m"
|
||||
get 1 "^m" $s
|
||||
get 1 "^m" $s
|
||||
let x = len($s)
|
||||
if x<2 goto continue
|
||||
let $s = $right($s, x-1)
|
||||
print $s
|
||||
:continue
|
||||
exit 0
|
||||
14
package/network/utils/comgt/files/getstrength.gcom
Normal file
14
package/network/utils/comgt/files/getstrength.gcom
Normal file
@@ -0,0 +1,14 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.02
|
||||
waitquiet 0.2 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
send "AT+CSQ^m"
|
||||
get 1 "" $s
|
||||
print $s
|
||||
|
||||
:continue
|
||||
exit 0
|
||||
140
package/network/utils/comgt/files/ncm.json
Normal file
140
package/network/utils/comgt/files/ncm.json
Normal file
@@ -0,0 +1,140 @@
|
||||
{
|
||||
"huawei": {
|
||||
"initialize": [
|
||||
"AT",
|
||||
"ATZ",
|
||||
"ATQ0",
|
||||
"ATV1",
|
||||
"ATE1",
|
||||
"ATS0=0",
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
|
||||
],
|
||||
"modes": {
|
||||
"preferlte": "AT^SYSCFGEX=\\\"030201\\\",3fffffff,2,4,7fffffffffffffff,,",
|
||||
"preferumts": "AT^SYSCFGEX=\\\"0201\\\",3fffffff,2,4,7fffffffffffffff,,",
|
||||
"lte": "AT^SYSCFGEX=\\\"03\\\",3fffffff,2,4,7fffffffffffffff,,",
|
||||
"umts": "AT^SYSCFGEX=\\\"02\\\",3fffffff,2,4,7fffffffffffffff,,",
|
||||
"gsm": "AT^SYSCFGEX=\\\"01\\\",3fffffff,2,4,7fffffffffffffff,,",
|
||||
"auto": "AT^SYSCFGEX=\\\"00\\\",3fffffff,2,4,7fffffffffffffff,,"
|
||||
},
|
||||
"connect": "AT^NDISDUP=${profile},1${apn:+,\\\"$apn\\\"}${username:+,\\\"$username\\\"}${password:+,\\\"$password\\\"}${auth:+,$auth}",
|
||||
"disconnect": "AT^NDISDUP=${profile},0"
|
||||
},
|
||||
"samsung": {
|
||||
"initialize": [
|
||||
"AT",
|
||||
"AT+CGREG=2",
|
||||
"AT+CFUN=5",
|
||||
"AT+MODESELECT=3",
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
|
||||
],
|
||||
"modes": {
|
||||
"umts": "AT+CHANGEALLPATH=1"
|
||||
},
|
||||
"connect": "AT+CGATT=1",
|
||||
"disconnect": "AT+CGATT=0"
|
||||
},
|
||||
"sierra": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1",
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}",
|
||||
"AT$QCPDPP=${profile},${auth:-0}${password:+,\\\"$password\\\"}${username:+,\\\"$username\\\"}"
|
||||
],
|
||||
"modes": {
|
||||
"preferlte": "AT!SELRAT=07",
|
||||
"preferumts": "AT!SELRAT=05",
|
||||
"lte": "AT!SELRAT=06",
|
||||
"umts": "AT!SELRAT=01",
|
||||
"gsm": "AT!SELRAT=02",
|
||||
"auto": "AT!SELRAT=00"
|
||||
},
|
||||
"connect": "AT!SCACT=1,${profile}",
|
||||
"disconnect": "AT!SCACT=0,${profile}"
|
||||
},
|
||||
"sony": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1",
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}",
|
||||
"AT*EIAAUW=${profile},1,\\\"${username}\\\",\\\"${password}\\\",${auth:-00111}"
|
||||
],
|
||||
"modes": {
|
||||
"umts": "AT+CFUN=6",
|
||||
"gsm": "AT+CFUN=5"
|
||||
},
|
||||
"connect": "AT*ENAP=1,${profile}",
|
||||
"disconnect": "AT*ENAP=0"
|
||||
},
|
||||
"mtk1": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1"
|
||||
],
|
||||
"configure": [
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",0,0"
|
||||
],
|
||||
"connect": "AT+CGACT=1,${profile}",
|
||||
"finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1",
|
||||
"disconnect": "AT+CGACT=0,${profile}"
|
||||
},
|
||||
"quectel": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1"
|
||||
],
|
||||
"configure": [
|
||||
"at+qicsgp=${profile},${context_type},\\\"${apn}\\\",\\\"${username}\\\",\\\"${password}\\\",0"
|
||||
],
|
||||
"modes": {
|
||||
"lte": "AT+QCFG=\\\"nwscanmode\\\",3",
|
||||
"umts": "AT+QCFG=\\\"nwscanmode\\\",2",
|
||||
"gsm": "AT+QCFG=\\\"nwscanmode\\\",1",
|
||||
"auto": "AT+QCFG=\\\"nwscanmode\\\",0"
|
||||
},
|
||||
"connect": "AT+qnetdevctl=1,${profile},1",
|
||||
"disconnect": "AT+qnetdevctl=0,${profile},0"
|
||||
},
|
||||
"\"zte": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1"
|
||||
],
|
||||
"configure": [
|
||||
"AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",\\\"\\\",0,0",
|
||||
"AT+ZGPCOAUTH=${profile},\\\"${username}\\\",\\\"${password}\\\",0"
|
||||
],
|
||||
"connect": "AT+ZGACT=1,${profile}",
|
||||
"disconnect": "AT+ZGACT=0,${profile}"
|
||||
},
|
||||
"\"marvell\"": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1"
|
||||
],
|
||||
"configure": [
|
||||
"AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",\\\"\\\",0,0",
|
||||
"AT+ZGPCOAUTH=${profile},\\\"${username}\\\",\\\"${password}\\\",0"
|
||||
],
|
||||
"connect": "AT+ZGACT=1,${profile}",
|
||||
"disconnect": "AT+ZGACT=0,${profile}"
|
||||
},
|
||||
"\"mikrotik\"": {
|
||||
"configure": [
|
||||
"AT+CFUN=4",
|
||||
"AT+ZGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",0",
|
||||
"AT+ZDHCPLEASE=10",
|
||||
"AT+CFUN=1"
|
||||
],
|
||||
"waitforconnect": "\\\"+ZCONSTAT: 1,${context_type}\\\",\\\"+ZGIPDNS: ${context_type}\\\"",
|
||||
"connect": "AT+ZGACT=1,${context_type}",
|
||||
"finalize": "AT+ZDHCPLEASE=0",
|
||||
"disconnect": "AT+ZGACT=0,1"
|
||||
},
|
||||
"spreadtrum": {
|
||||
"initialize": [
|
||||
"AT+CFUN=1",
|
||||
"AT+CCED=2,8",
|
||||
"AT+SPTTYROUTER=1"
|
||||
],
|
||||
"configure": [
|
||||
"AT+CGDCONT=${profile},\\\"${pdptype}\\\"${apn:+,\\\"$apn\\\"}"
|
||||
],
|
||||
"connect": "AT+SPTZCMD=\\\"Y29ubm1hbmN0bCBuZGlzZGlhbCBBVF5ORElTRFVOPSJ1c2IwIiwxLDE=\\\"",
|
||||
"disconnect": "AT+SPTZCMD=\\\"Y29ubm1hbmN0bCBuZGlzZGlhbCBBVF5ORElTRFVOPSJ1c2IwIiwwLDE=\\\""
|
||||
}
|
||||
}
|
||||
287
package/network/utils/comgt/files/ncm.sh
Normal file
287
package/network/utils/comgt/files/ncm.sh
Normal file
@@ -0,0 +1,287 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
}
|
||||
|
||||
proto_ncm_init_config() {
|
||||
no_device=1
|
||||
available=1
|
||||
proto_config_add_string "device:device"
|
||||
proto_config_add_string ifname
|
||||
proto_config_add_string apn
|
||||
proto_config_add_string auth
|
||||
proto_config_add_string username
|
||||
proto_config_add_string password
|
||||
proto_config_add_string pincode
|
||||
proto_config_add_string delay
|
||||
proto_config_add_string mode
|
||||
proto_config_add_string pdptype
|
||||
proto_config_add_boolean sourcefilter
|
||||
proto_config_add_int profile
|
||||
proto_config_add_defaults
|
||||
}
|
||||
|
||||
proto_ncm_setup() {
|
||||
local interface="$1"
|
||||
|
||||
local manufacturer initialize setmode connect finalize devname devpath ifpath
|
||||
|
||||
local device ifname apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
|
||||
json_get_vars device ifname apn auth username password pincode delay mode pdptype sourcefilter profile $PROTO_DEFAULT_OPTIONS
|
||||
|
||||
local context_type
|
||||
|
||||
[ "$metric" = "" ] && metric="0"
|
||||
|
||||
[ -n "$profile" ] || profile=1
|
||||
|
||||
pdptype=$(echo "$pdptype" | awk '{print toupper($0)}')
|
||||
[ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP"
|
||||
|
||||
[ "$pdptype" = "IPV4V6" ] && context_type=3
|
||||
[ -z "$context_type" -a "$pdptype" = "IPV6" ] && context_type=2
|
||||
[ -n "$context_type" ] || context_type=1
|
||||
|
||||
[ -n "$ctl_device" ] && device=$ctl_device
|
||||
|
||||
[ -n "$device" ] || {
|
||||
echo "No control device specified"
|
||||
proto_notify_error "$interface" NO_DEVICE
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
device="$(readlink -f $device)"
|
||||
[ -e "$device" ] || {
|
||||
echo "Control device not valid"
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -z "$ifname" ] && {
|
||||
devname="$(basename "$device")"
|
||||
case "$devname" in
|
||||
'ttyACM'*)
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
ifpath="$devpath/../*/net"
|
||||
;;
|
||||
'tty'*)
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
ifpath="$devpath/../../*/net"
|
||||
;;
|
||||
*)
|
||||
devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
|
||||
ifpath="$devpath/net"
|
||||
;;
|
||||
esac
|
||||
ifname="$(ls $(ls -1 -d $ifpath | head -n 1))"
|
||||
}
|
||||
|
||||
[ -n "$ifname" ] || {
|
||||
echo "The interface could not be found."
|
||||
proto_notify_error "$interface" NO_IFACE
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
start=$(date +%s)
|
||||
while true; do
|
||||
manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
|
||||
[ "$manufacturer" = "error" ] && {
|
||||
manufacturer=""
|
||||
}
|
||||
[ -n "$manufacturer" ] && {
|
||||
break
|
||||
}
|
||||
[ -z "$delay" ] && {
|
||||
break
|
||||
}
|
||||
sleep 1
|
||||
elapsed=$(($(date +%s) - start))
|
||||
[ "$elapsed" -gt "$delay" ] && {
|
||||
break
|
||||
}
|
||||
done
|
||||
[ -z "$manufacturer" ] && {
|
||||
echo "Failed to get modem information"
|
||||
proto_notify_error "$interface" GETINFO_FAILED
|
||||
return 1
|
||||
}
|
||||
|
||||
json_load "$(cat /etc/gcom/ncm.json)"
|
||||
json_select "$manufacturer"
|
||||
[ $? -ne 0 ] && {
|
||||
echo "Unsupported modem"
|
||||
proto_notify_error "$interface" UNSUPPORTED_MODEM
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
json_get_values initialize initialize
|
||||
for i in $initialize; do
|
||||
eval COMMAND="$i" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to initialize modem"
|
||||
proto_notify_error "$interface" INITIALIZE_FAILED
|
||||
return 1
|
||||
}
|
||||
done
|
||||
|
||||
[ -n "$pincode" ] && {
|
||||
PINCODE="$pincode" gcom -d "$device" -s /etc/gcom/setpin.gcom || {
|
||||
echo "Unable to verify PIN"
|
||||
proto_notify_error "$interface" PIN_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
json_get_values configure configure
|
||||
echo "Configuring modem"
|
||||
for i in $configure; do
|
||||
eval COMMAND="$i" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to configure modem"
|
||||
proto_notify_error "$interface" CONFIGURE_FAILED
|
||||
return 1
|
||||
}
|
||||
done
|
||||
|
||||
[ -n "$mode" ] && {
|
||||
json_select modes
|
||||
json_get_var setmode "$mode"
|
||||
[ -n "$setmode" ] && {
|
||||
echo "Setting mode"
|
||||
eval COMMAND="$setmode" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to set operating mode"
|
||||
proto_notify_error "$interface" SETMODE_FAILED
|
||||
return 1
|
||||
}
|
||||
}
|
||||
json_select ..
|
||||
}
|
||||
|
||||
echo "Starting network $interface"
|
||||
json_get_vars connect
|
||||
[ -n "$connect" ] && {
|
||||
echo "Connecting modem"
|
||||
eval COMMAND="$connect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to connect"
|
||||
proto_notify_error "$interface" CONNECT_FAILED
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
json_get_vars finalize
|
||||
|
||||
echo "Setting up $ifname"
|
||||
proto_init_update "$ifname" 1
|
||||
proto_add_data
|
||||
json_add_string "manufacturer" "$manufacturer"
|
||||
proto_close_data
|
||||
proto_send_update "$interface"
|
||||
|
||||
local zone="$(fw3 -q network "$interface" 2>/dev/null)"
|
||||
|
||||
[ "$pdptype" = "IP" -o "$pdptype" = "IPV4V6" ] && {
|
||||
json_init
|
||||
json_add_string name "${interface}_4"
|
||||
json_add_string ifname "@$interface"
|
||||
json_add_string proto "dhcp"
|
||||
proto_add_dynamic_defaults
|
||||
[ -n "$zone" ] && {
|
||||
json_add_string zone "$zone"
|
||||
}
|
||||
json_close_object
|
||||
ubus call network add_dynamic "$(json_dump)"
|
||||
}
|
||||
|
||||
[ "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] && {
|
||||
json_init
|
||||
json_add_string name "${interface}_6"
|
||||
json_add_string ifname "@$interface"
|
||||
json_add_string proto "dhcpv6"
|
||||
json_add_string extendprefix 1
|
||||
[ "$sourcefilter" = "0" ] && json_add_boolean sourcefilter "0"
|
||||
proto_add_dynamic_defaults
|
||||
[ -n "$zone" ] && {
|
||||
json_add_string zone "$zone"
|
||||
}
|
||||
json_close_object
|
||||
ubus call network add_dynamic "$(json_dump)"
|
||||
}
|
||||
|
||||
[ -n "$finalize" ] && {
|
||||
eval COMMAND="$finalize" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to configure modem"
|
||||
proto_notify_error "$interface" FINALIZE_FAILED
|
||||
return 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proto_ncm_teardown() {
|
||||
local interface="$1"
|
||||
|
||||
local manufacturer disconnect
|
||||
|
||||
local device profile
|
||||
json_get_vars device profile
|
||||
|
||||
[ -n "$ctl_device" ] && device=$ctl_device
|
||||
|
||||
[ -n "$device" ] || {
|
||||
echo "No control device specified"
|
||||
proto_notify_error "$interface" NO_DEVICE
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
device="$(readlink -f $device)"
|
||||
[ -e "$device" ] || {
|
||||
echo "Control device not valid"
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$profile" ] || profile=1
|
||||
|
||||
echo "Stopping network $interface"
|
||||
|
||||
json_load "$(ubus call network.interface.$interface status)"
|
||||
json_select data
|
||||
json_get_vars manufacturer
|
||||
[ $? -ne 0 -o -z "$manufacturer" ] && {
|
||||
# Fallback to direct detect, for proper handle device replug.
|
||||
manufacturer=$(gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }')
|
||||
[ $? -ne 0 -o -z "$manufacturer" ] && {
|
||||
echo "Failed to get modem information"
|
||||
proto_notify_error "$interface" GETINFO_FAILED
|
||||
return 1
|
||||
}
|
||||
json_add_string "manufacturer" "$manufacturer"
|
||||
}
|
||||
|
||||
json_load "$(cat /etc/gcom/ncm.json)"
|
||||
json_select "$manufacturer" || {
|
||||
echo "Unsupported modem"
|
||||
proto_notify_error "$interface" UNSUPPORTED_MODEM
|
||||
return 1
|
||||
}
|
||||
|
||||
json_get_vars disconnect
|
||||
[ -n "$disconnect" ] && {
|
||||
eval COMMAND="$disconnect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
|
||||
echo "Failed to disconnect"
|
||||
proto_notify_error "$interface" DISCONNECT_FAILED
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
proto_init_update "*" 0
|
||||
proto_send_update "$interface"
|
||||
}
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
add_protocol ncm
|
||||
}
|
||||
31
package/network/utils/comgt/files/runcommand.gcom
Normal file
31
package/network/utils/comgt/files/runcommand.gcom
Normal file
@@ -0,0 +1,31 @@
|
||||
# run AT-command from environment
|
||||
opengt
|
||||
set com 115200n81
|
||||
set senddelay 0.02
|
||||
waitquiet 1 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
print "sending -> ",$env("COMMAND"),"\n"
|
||||
send $env("COMMAND")
|
||||
send "^m"
|
||||
|
||||
waitfor 25 "OK","ERR","ERROR","COMMAND NOT SUPPORT"
|
||||
if % = 0 goto continue
|
||||
if % = 1 goto error
|
||||
if % = 2 goto error
|
||||
if % = 3 goto notsupported
|
||||
|
||||
print "Timeout running AT-command\n"
|
||||
exit 1
|
||||
|
||||
:error
|
||||
print "Error running AT-command\n"
|
||||
exit 1
|
||||
|
||||
:notsupported
|
||||
print "AT-command not supported\n"
|
||||
exit 1
|
||||
|
||||
:continue
|
||||
exit 0
|
||||
26
package/network/utils/comgt/files/setmode.gcom
Normal file
26
package/network/utils/comgt/files/setmode.gcom
Normal file
@@ -0,0 +1,26 @@
|
||||
# set wwan mode from environment
|
||||
opengt
|
||||
set com 115200n81
|
||||
set senddelay 0.02
|
||||
waitquiet 1 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
print "Trying to set mode\n"
|
||||
send $env("MODE")
|
||||
send "^m"
|
||||
|
||||
waitfor 15 "OK","ERR","ERROR"
|
||||
if % = 0 goto continue
|
||||
if % = 1 goto modeerror
|
||||
if % = 2 goto modeerror
|
||||
|
||||
print "Timeout setting WWAN mode!\n"
|
||||
exit 1
|
||||
|
||||
:modeerror
|
||||
print "Error setting WWAN mode!\n"
|
||||
exit 1
|
||||
|
||||
:continue
|
||||
exit 0
|
||||
56
package/network/utils/comgt/files/setpin.gcom
Normal file
56
package/network/utils/comgt/files/setpin.gcom
Normal file
@@ -0,0 +1,56 @@
|
||||
# set pin code from evnironment "$PINCODE"
|
||||
opengt
|
||||
set com 115200n81
|
||||
set senddelay 0.05
|
||||
waitquiet 3 0.5
|
||||
flash 0.1
|
||||
|
||||
let c=0
|
||||
:start
|
||||
send "AT+CFUN=1^m"
|
||||
send "AT+CPIN?^m"
|
||||
waitfor 15 "SIM PUK","SIM PIN","READY","ERROR","ERR"
|
||||
if % = -1 goto timeout
|
||||
if % = 0 goto ready
|
||||
if % = 1 goto setpin
|
||||
if % = 2 goto ready
|
||||
if % = 3 goto checkrepeat
|
||||
if % = 4 goto checkrepeat
|
||||
|
||||
:checkrepeat
|
||||
inc c
|
||||
if c>3 goto pinerror
|
||||
waitquiet 12 0.5
|
||||
goto start
|
||||
|
||||
:timeout
|
||||
print "timeout checking for PIN."
|
||||
exit 1
|
||||
|
||||
:ready
|
||||
print "SIM ready\n"
|
||||
goto continue
|
||||
exit 0
|
||||
|
||||
:setpin
|
||||
# check if output was "SIM PIN2", that's ok.
|
||||
waitfor 1 "2"
|
||||
if % = 0 goto ready
|
||||
|
||||
print "Trying to set PIN\n"
|
||||
send "AT+CPIN=\""
|
||||
send $env("PINCODE")
|
||||
send "\"^m"
|
||||
|
||||
waitfor 20 "OK","ERR"
|
||||
if % = -1 goto pinerror
|
||||
if % = 0 goto continue
|
||||
if % = 1 goto pinerror
|
||||
|
||||
:pinerror
|
||||
print "Error setting PIN, check card manually\n"
|
||||
exit 1
|
||||
|
||||
:continue
|
||||
print "PIN set successfully\n"
|
||||
exit 0
|
||||
21
package/network/utils/comgt/files/ussd.gcom
Normal file
21
package/network/utils/comgt/files/ussd.gcom
Normal file
@@ -0,0 +1,21 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.02
|
||||
waitquiet 0.2 0.2
|
||||
flash 0.1
|
||||
|
||||
:start
|
||||
send "AT+CUSD=1,"
|
||||
send $env("ussd")
|
||||
send ",15"
|
||||
send "^m"
|
||||
waitfor 120 "+CUSD:"
|
||||
if % = -1 goto timeout
|
||||
get 1 "^m" $s
|
||||
print $s
|
||||
exit 0
|
||||
|
||||
:timeout
|
||||
print "ERROR: no USSD response, timeout.\n"
|
||||
exit 1
|
||||
23
package/network/utils/comgt/patches/001-compile_fix.patch
Normal file
23
package/network/utils/comgt/patches/001-compile_fix.patch
Normal file
@@ -0,0 +1,23 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -32,6 +32,7 @@ SCRIPTPATH = /etc/comgt/
|
||||
SCRIPTSRC = ./scripts/
|
||||
BIN = $(CPROG)
|
||||
MANP = comgt.1 sigmon.1
|
||||
+CC = cc
|
||||
|
||||
CFLAGS = -c
|
||||
LDFLAGS =
|
||||
@@ -70,10 +71,5 @@ clean:
|
||||
-rm *~
|
||||
-rm $(SCRIPTSRC)*~
|
||||
|
||||
-
|
||||
-comgt: comgt.o
|
||||
- cc comgt.o $(LDFLAGS) -o comgt
|
||||
-
|
||||
-comgt.o: comgt.c comgt.h
|
||||
- cc comgt.c $(CFLAGS)
|
||||
-
|
||||
+comgt: comgt.c comgt.h
|
||||
+ $(CC) $(CFLAGS) -o comgt $< $(LDFLAGS)
|
||||
105
package/network/utils/comgt/patches/002-termios.patch
Normal file
105
package/network/utils/comgt/patches/002-termios.patch
Normal file
@@ -0,0 +1,105 @@
|
||||
--- a/comgt.c
|
||||
+++ b/comgt.c
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
-#include <termio.h>
|
||||
+#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -81,7 +81,7 @@ char token[MAXTOKEN]; /* For gettoken(
|
||||
char scriptfile[MAXPATH]; /* Script file name */
|
||||
char scriptfilepath[MAXPATH]; /* temp storage for full path */
|
||||
BOOL verbose=0; /* Log actions */
|
||||
-struct termio cons, stbuf, svbuf; /* termios: svbuf=before, stbuf=while */
|
||||
+struct termios cons, stbuf, svbuf; /* termios: svbuf=before, stbuf=while */
|
||||
int comfd=0; /* Communication file descriptor. Defaults to stdin. */
|
||||
char msg[STRINGL]; /* Massage messages here */
|
||||
int preturn,returns[MAXGOSUBS];
|
||||
@@ -172,7 +172,7 @@ void dotestkey(void) {
|
||||
|
||||
/* Exit after resetting terminal settings */
|
||||
void ext(long xtc) {
|
||||
- ioctl(1, TCSETA, &cons);
|
||||
+ ioctl(1, TCSETS, &cons);
|
||||
exit(xtc);
|
||||
}
|
||||
|
||||
@@ -920,24 +920,24 @@ BOOL getonoroff(void) {
|
||||
void setcom(void) {
|
||||
stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
|
||||
stbuf.c_cflag |= (speed | bits | CREAD | clocal | parity | stopbits );
|
||||
- if (ioctl(comfd, TCSETA, &stbuf) < 0) {
|
||||
+ if (ioctl(comfd, TCSETS, &stbuf) < 0) {
|
||||
serror("Can't ioctl set device",1);
|
||||
}
|
||||
}
|
||||
|
||||
void doset(void) {
|
||||
- struct termio console;
|
||||
+ struct termios console;
|
||||
int a,b;
|
||||
gettoken();
|
||||
if(strcmp(token,"echo")==0) {
|
||||
a=0;
|
||||
if(getonoroff()) a=ECHO|ECHOE;
|
||||
- if(ioctl(0, TCGETA, &console)<0) {
|
||||
+ if(ioctl(0, TCGETS, &console)<0) {
|
||||
serror("Can't ioctl FD zero!\n",2);
|
||||
}
|
||||
console.c_lflag &= ~(ECHO | ECHOE);
|
||||
console.c_lflag |= a;
|
||||
- ioctl(0, TCSETA, &console);
|
||||
+ ioctl(0, TCSETS, &console);
|
||||
}
|
||||
else if(strcmp(token,"senddelay")==0) {
|
||||
senddelay=10000L*getdvalue();
|
||||
@@ -1224,7 +1224,7 @@ void doclose(void) {
|
||||
if(strcmp(token,"hardcom")==0) {
|
||||
if(comfd== -1) serror("Com device not open",1);
|
||||
vmsg("Closing device");
|
||||
- if (ioctl(comfd, TCSETA, &svbuf) < 0) {
|
||||
+ if (ioctl(comfd, TCSETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't ioctl set device %s.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
@@ -1266,12 +1266,12 @@ void opengt(void) {
|
||||
ext(1);
|
||||
}
|
||||
}
|
||||
- if (ioctl (comfd, TCGETA, &svbuf) < 0) {
|
||||
+ if (ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't control %s, please try again.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
setenv("COMGTDEVICE",device,1);
|
||||
- ioctl(comfd, TCGETA, &stbuf);
|
||||
+ ioctl(comfd, TCGETS, &stbuf);
|
||||
speed=stbuf.c_cflag & CBAUD;
|
||||
if (high_speed == 0) strcpy(cspeed,"115200");
|
||||
else strcpy(cspeed,"57600");
|
||||
@@ -1303,11 +1303,11 @@ void opendevice(void) {
|
||||
}
|
||||
else comfd=0;
|
||||
|
||||
- if (ioctl (comfd, TCGETA, &svbuf) < 0) {
|
||||
+ if (ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't ioctl get device %s.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
- ioctl(comfd, TCGETA, &stbuf);
|
||||
+ ioctl(comfd, TCGETS, &stbuf);
|
||||
speed=stbuf.c_cflag & CBAUD;
|
||||
switch(speed) {
|
||||
case B0: strcpy(cspeed,"0");break;
|
||||
@@ -1553,7 +1553,7 @@ int main(int argc,char **argv) {
|
||||
skip_default=0;
|
||||
filep=NULL;
|
||||
scriptspace=4096;
|
||||
- ioctl(1, TCGETA, &cons);
|
||||
+ ioctl(1, TCGETS, &cons);
|
||||
if((script=( char *)malloc(scriptspace))==NULL) {
|
||||
serror("Could not malloc()",3);
|
||||
}
|
||||
20
package/network/utils/comgt/patches/003-no_XCASE.patch
Normal file
20
package/network/utils/comgt/patches/003-no_XCASE.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
--- a/comgt.c
|
||||
+++ b/comgt.c
|
||||
@@ -1281,7 +1281,7 @@ void opengt(void) {
|
||||
parity=stbuf.c_cflag & (PARENB | PARODD);
|
||||
stbuf.c_iflag &= ~(IGNCR | ICRNL | IUCLC | INPCK | IXON | IXANY | IGNPAR );
|
||||
stbuf.c_oflag &= ~(OPOST | OLCUC | OCRNL | ONLCR | ONLRET);
|
||||
- stbuf.c_lflag &= ~(ICANON | XCASE | ECHO | ECHOE | ECHONL);
|
||||
+ stbuf.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHONL);
|
||||
stbuf.c_lflag &= ~(ECHO | ECHOE);
|
||||
stbuf.c_cc[VMIN] = 1;
|
||||
stbuf.c_cc[VTIME] = 0;
|
||||
@@ -1336,7 +1336,7 @@ void opendevice(void) {
|
||||
parity=stbuf.c_cflag & (PARENB | PARODD);
|
||||
stbuf.c_iflag &= ~(IGNCR | ICRNL | IUCLC | INPCK | IXON | IXANY | IGNPAR );
|
||||
stbuf.c_oflag &= ~(OPOST | OLCUC | OCRNL | ONLCR | ONLRET);
|
||||
- stbuf.c_lflag &= ~(ICANON | XCASE | ECHO | ECHOE | ECHONL);
|
||||
+ stbuf.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHONL);
|
||||
stbuf.c_lflag &= ~(ECHO | ECHOE);
|
||||
stbuf.c_cc[VMIN] = 1;
|
||||
stbuf.c_cc[VTIME] = 0;
|
||||
68
package/network/utils/comgt/patches/004-check_tty.patch
Normal file
68
package/network/utils/comgt/patches/004-check_tty.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
--- a/comgt.c
|
||||
+++ b/comgt.c
|
||||
@@ -91,6 +91,7 @@ unsigned long hstart,hset;
|
||||
char NullString[]={ "" };
|
||||
BOOL lastcharnl=1; /* Indicate that last char printed from getonebyte
|
||||
was a nl, so no new one is needed */
|
||||
+BOOL tty=1;
|
||||
|
||||
|
||||
//"open com \"/dev/modem\"\nset com 38400n81\nset senddelay 0.05\nsend \"ATi^m\"\nget 2 \" ^m\" $s\nprint \"Response : \",$s,\"\\n\"\nget 2 \" ^m\" $s\nprint \"Response :\",$s,\"\\n\"\nget 2 \" ^m\" $s\nprint \"Response : \",$s,\"\\n\"\n\n";
|
||||
@@ -920,7 +921,7 @@ BOOL getonoroff(void) {
|
||||
void setcom(void) {
|
||||
stbuf.c_cflag &= ~(CBAUD | CSIZE | CSTOPB | CLOCAL | PARENB);
|
||||
stbuf.c_cflag |= (speed | bits | CREAD | clocal | parity | stopbits );
|
||||
- if (ioctl(comfd, TCSETS, &stbuf) < 0) {
|
||||
+ if (tty && ioctl(comfd, TCSETS, &stbuf) < 0) {
|
||||
serror("Can't ioctl set device",1);
|
||||
}
|
||||
}
|
||||
@@ -1224,7 +1225,7 @@ void doclose(void) {
|
||||
if(strcmp(token,"hardcom")==0) {
|
||||
if(comfd== -1) serror("Com device not open",1);
|
||||
vmsg("Closing device");
|
||||
- if (ioctl(comfd, TCSETS, &svbuf) < 0) {
|
||||
+ if (tty && ioctl(comfd, TCSETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't ioctl set device %s.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
@@ -1266,12 +1267,17 @@ void opengt(void) {
|
||||
ext(1);
|
||||
}
|
||||
}
|
||||
- if (ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
+ if (isatty (comfd))
|
||||
+ tty=1;
|
||||
+ else
|
||||
+ tty=0;
|
||||
+ if (tty && ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't control %s, please try again.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
setenv("COMGTDEVICE",device,1);
|
||||
- ioctl(comfd, TCGETS, &stbuf);
|
||||
+ if (tty)
|
||||
+ ioctl(comfd, TCGETS, &stbuf);
|
||||
speed=stbuf.c_cflag & CBAUD;
|
||||
if (high_speed == 0) strcpy(cspeed,"115200");
|
||||
else strcpy(cspeed,"57600");
|
||||
@@ -1302,12 +1308,16 @@ void opendevice(void) {
|
||||
}
|
||||
}
|
||||
else comfd=0;
|
||||
-
|
||||
- if (ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
+ if (isatty (comfd))
|
||||
+ tty=1;
|
||||
+ else
|
||||
+ tty=0;
|
||||
+ if (tty && ioctl (comfd, TCGETS, &svbuf) < 0) {
|
||||
sprintf(msg,"Can't ioctl get device %s.\n",device);
|
||||
serror(msg,1);
|
||||
}
|
||||
- ioctl(comfd, TCGETS, &stbuf);
|
||||
+ if (tty)
|
||||
+ ioctl(comfd, TCGETS, &stbuf);
|
||||
speed=stbuf.c_cflag & CBAUD;
|
||||
switch(speed) {
|
||||
case B0: strcpy(cspeed,"0");break;
|
||||
80
package/network/utils/ebtables/Makefile
Normal file
80
package/network/utils/ebtables/Makefile
Normal file
@@ -0,0 +1,80 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ebtables
|
||||
PKG_SOURCE_DATE:=2018-06-27
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_URL:=https://git.netfilter.org/ebtables
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=48cff25dfea5b37e16ba5dc6601e98ab140f5f99
|
||||
PKG_MIRROR_HASH:=1ee560498e1a047b329eab3dad8425ae51e7f0527e4495efb99481ca11206b37
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:netfilter:ebtables
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ebtables-legacy
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
DEPENDS:=+kmod-ebtables
|
||||
TITLE:=Ethernet bridge firewall administration utility
|
||||
URL:=http://ebtables.sourceforge.net/
|
||||
PROVIDES:=ebtables
|
||||
ALTERNATIVES:=\
|
||||
200:/usr/sbin/ebtables:/usr/sbin/ebtables-legacy
|
||||
endef
|
||||
|
||||
define Package/ebtables-legacy-utils
|
||||
$(call Package/ebtables-legacy)
|
||||
DEPENDS:=ebtables-legacy
|
||||
TITLE:=ebtables save/restore utilities
|
||||
PROVIDES:=ebtables-utils
|
||||
ALTERNATIVES:=\
|
||||
200:/usr/sbin/ebtables-restore:/usr/sbin/ebtables-legacy-restore
|
||||
endef
|
||||
|
||||
define Package/ebtables-legacy/description
|
||||
The ebtables program is a filtering tool for a bridging firewall. The
|
||||
filtering is focussed on the Link Layer Ethernet frame fields. Apart
|
||||
from filtering, it also gives the ability to alter the Ethernet MAC
|
||||
addresses and implement a brouter.
|
||||
endef
|
||||
|
||||
define Package/ebtables-legacy-utils/description
|
||||
$(call Package/ebtables-legacy/description)
|
||||
endef
|
||||
|
||||
MAKE_VARS += EXT_LIBSI="$(LIBGCC_S)"
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LIBDIR="/usr/lib/ebtables"
|
||||
|
||||
define Package/ebtables-legacy/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/ethertypes $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ebtables
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib*.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/extensions/*.so $(1)/usr/lib/ebtables/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables $(1)/usr/sbin/ebtables-legacy
|
||||
endef
|
||||
|
||||
define Package/ebtables-legacy-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
#ebtables-save depends on perl and is just broken
|
||||
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-save $(1)/usr/sbin/ebtables-legacy-save
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-restore $(1)/usr/sbin/ebtables-legacy-restore
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ebtables-legacy))
|
||||
$(eval $(call BuildPackage,ebtables-legacy-utils))
|
||||
@@ -0,0 +1,260 @@
|
||||
--- a/extensions/Makefile
|
||||
+++ b/extensions/Makefile
|
||||
@@ -11,13 +11,13 @@ EXT_LIBSI+=$(foreach T,$(EXT_FUNC), -leb
|
||||
EXT_LIBSI+=$(foreach T,$(EXT_TABLES), -lebtable_$(T))
|
||||
|
||||
extensions/ebt_%.so: extensions/ebt_%.o
|
||||
- $(CC) $(LDFLAGS) -shared -o $@ -lc $< -nostartfiles
|
||||
+ $(CC) $(LDFLAGS) -shared -o $@ -lc $<
|
||||
|
||||
extensions/libebt_%.so: extensions/ebt_%.so
|
||||
mv $< $@
|
||||
|
||||
extensions/ebtable_%.so: extensions/ebtable_%.o
|
||||
- $(CC) $(LDFLAGS) -shared -o $@ -lc $< -nostartfiles
|
||||
+ $(CC) $(LDFLAGS) -shared -o $@ -lc $<
|
||||
|
||||
extensions/libebtable_%.so: extensions/ebtable_%.so
|
||||
mv $< $@
|
||||
--- a/extensions/ebt_802_3.c
|
||||
+++ b/extensions/ebt_802_3.c
|
||||
@@ -141,7 +141,7 @@ static struct ebt_u_match _802_3_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&_802_3_match);
|
||||
}
|
||||
--- a/extensions/ebt_among.c
|
||||
+++ b/extensions/ebt_among.c
|
||||
@@ -491,7 +491,7 @@ static struct ebt_u_match among_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&among_match);
|
||||
}
|
||||
--- a/extensions/ebt_arp.c
|
||||
+++ b/extensions/ebt_arp.c
|
||||
@@ -362,7 +362,7 @@ static struct ebt_u_match arp_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&arp_match);
|
||||
}
|
||||
--- a/extensions/ebt_arpreply.c
|
||||
+++ b/extensions/ebt_arpreply.c
|
||||
@@ -133,7 +133,7 @@ static struct ebt_u_target arpreply_targ
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_target(&arpreply_target);
|
||||
}
|
||||
--- a/extensions/ebt_ip.c
|
||||
+++ b/extensions/ebt_ip.c
|
||||
@@ -472,7 +472,7 @@ static struct ebt_u_match ip_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&ip_match);
|
||||
}
|
||||
--- a/extensions/ebt_ip6.c
|
||||
+++ b/extensions/ebt_ip6.c
|
||||
@@ -413,7 +413,7 @@ static struct ebt_u_match ip6_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&ip6_match);
|
||||
}
|
||||
--- a/extensions/ebt_limit.c
|
||||
+++ b/extensions/ebt_limit.c
|
||||
@@ -212,7 +212,7 @@ static struct ebt_u_match limit_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&limit_match);
|
||||
}
|
||||
--- a/extensions/ebt_log.c
|
||||
+++ b/extensions/ebt_log.c
|
||||
@@ -217,7 +217,7 @@ static struct ebt_u_watcher log_watcher
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_watcher(&log_watcher);
|
||||
}
|
||||
--- a/extensions/ebt_mark.c
|
||||
+++ b/extensions/ebt_mark.c
|
||||
@@ -172,7 +172,7 @@ static struct ebt_u_target mark_target =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_target(&mark_target);
|
||||
}
|
||||
--- a/extensions/ebt_mark_m.c
|
||||
+++ b/extensions/ebt_mark_m.c
|
||||
@@ -121,7 +121,7 @@ static struct ebt_u_match mark_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&mark_match);
|
||||
}
|
||||
--- a/extensions/ebt_nat.c
|
||||
+++ b/extensions/ebt_nat.c
|
||||
@@ -231,7 +231,7 @@ static struct ebt_u_target dnat_target =
|
||||
.extra_ops = opts_d,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_target(&snat_target);
|
||||
ebt_register_target(&dnat_target);
|
||||
--- a/extensions/ebt_nflog.c
|
||||
+++ b/extensions/ebt_nflog.c
|
||||
@@ -166,7 +166,7 @@ static struct ebt_u_watcher nflog_watche
|
||||
.extra_ops = nflog_opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_watcher(&nflog_watcher);
|
||||
}
|
||||
--- a/extensions/ebt_pkttype.c
|
||||
+++ b/extensions/ebt_pkttype.c
|
||||
@@ -125,7 +125,7 @@ static struct ebt_u_match pkttype_match
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&pkttype_match);
|
||||
}
|
||||
--- a/extensions/ebt_redirect.c
|
||||
+++ b/extensions/ebt_redirect.c
|
||||
@@ -108,7 +108,7 @@ static struct ebt_u_target redirect_targ
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_target(&redirect_target);
|
||||
}
|
||||
--- a/extensions/ebt_standard.c
|
||||
+++ b/extensions/ebt_standard.c
|
||||
@@ -84,7 +84,7 @@ static struct ebt_u_target standard =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_target(&standard);
|
||||
}
|
||||
--- a/extensions/ebt_stp.c
|
||||
+++ b/extensions/ebt_stp.c
|
||||
@@ -337,7 +337,7 @@ static struct ebt_u_match stp_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&stp_match);
|
||||
}
|
||||
--- a/extensions/ebt_ulog.c
|
||||
+++ b/extensions/ebt_ulog.c
|
||||
@@ -180,7 +180,7 @@ static struct ebt_u_watcher ulog_watcher
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_watcher(&ulog_watcher);
|
||||
}
|
||||
--- a/extensions/ebt_vlan.c
|
||||
+++ b/extensions/ebt_vlan.c
|
||||
@@ -181,7 +181,7 @@ static struct ebt_u_match vlan_match = {
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&vlan_match);
|
||||
}
|
||||
--- a/extensions/ebtable_broute.c
|
||||
+++ b/extensions/ebtable_broute.c
|
||||
@@ -23,7 +23,7 @@ ebt_u_table table =
|
||||
.help = print_help,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_table(&table);
|
||||
}
|
||||
--- a/extensions/ebtable_filter.c
|
||||
+++ b/extensions/ebtable_filter.c
|
||||
@@ -29,7 +29,7 @@ static struct ebt_u_table table =
|
||||
.help = print_help,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_table(&table);
|
||||
}
|
||||
--- a/extensions/ebtable_nat.c
|
||||
+++ b/extensions/ebtable_nat.c
|
||||
@@ -30,7 +30,7 @@ ebt_u_table table =
|
||||
.help = print_help,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_table(&table);
|
||||
}
|
||||
--- a/extensions/ebt_string.c
|
||||
+++ b/extensions/ebt_string.c
|
||||
@@ -312,7 +312,7 @@ static struct ebt_u_match string_match =
|
||||
.extra_ops = opts,
|
||||
};
|
||||
|
||||
-void _init(void)
|
||||
+__attribute__((constructor)) static void extension_init(void)
|
||||
{
|
||||
ebt_register_match(&string_match);
|
||||
}
|
||||
68
package/network/utils/ethtool/Makefile
Normal file
68
package/network/utils/ethtool/Makefile
Normal file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethtool
|
||||
PKG_VERSION:=6.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
|
||||
PKG_HASH:=833a8493cb9cd5809ab59743092d9a38742c282290800e9626407511bbcebf9e
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:kernel:ethtool
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ethtool
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Display or change ethernet card settings
|
||||
URL:=http://www.kernel.org/pub/software/network/ethtool/
|
||||
VARIANT:=tiny
|
||||
CONFLICTS:=ethtool-full
|
||||
endef
|
||||
|
||||
define Package/ethtool-full
|
||||
$(Package/ethtool)
|
||||
TITLE += (full)
|
||||
VARIANT:=full
|
||||
PROVIDES:=ethtool
|
||||
DEPENDS:=+libmnl
|
||||
CONFLICTS:=
|
||||
endef
|
||||
|
||||
define Package/ethtool/description
|
||||
ethtool is a small utility for examining and tuning your ethernet-based
|
||||
network interface
|
||||
endef
|
||||
|
||||
Package/ethtool-full/description:=$(Package/ethtool/description)
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
CONFIGURE_ARGS += --enable-netlink --enable-pretty-dump
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-netlink --disable-pretty-dump
|
||||
endif
|
||||
|
||||
define Package/ethtool/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
Package/ethtool-full/install=$(Package/ethtool/install)
|
||||
|
||||
$(eval $(call BuildPackage,ethtool))
|
||||
$(eval $(call BuildPackage,ethtool-full))
|
||||
268
package/network/utils/iproute2/Makefile
Normal file
268
package/network/utils/iproute2/Makefile
Normal file
@@ -0,0 +1,268 @@
|
||||
#
|
||||
# Copyright (C) 2006-2015 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iproute2
|
||||
PKG_VERSION:=6.9.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
||||
PKG_HASH:=2f643d09ea11a4a2a043c92e2b469b5f73228cbf241ae806760296ed0ec413d0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=iptables
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
|
||||
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/iproute2/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
|
||||
SUBMENU:=Routing and Redirection
|
||||
MAINTAINER:=Russell Senior <russell@personaltelco.net>
|
||||
endef
|
||||
|
||||
define Package/ip-tiny
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Routing control utility (minimal)
|
||||
VARIANT:=iptiny
|
||||
DEFAULT_VARIANT:=1
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ip-full
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Routing control utility (full)
|
||||
VARIANT:=ipfull
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
|
||||
DEPENDS:=+libnl-tiny +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/tc-tiny
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Traffic control utility (minimal)
|
||||
VARIANT:=tctiny
|
||||
DEFAULT_VARIANT:=1
|
||||
PROVIDES:=tc
|
||||
ALTERNATIVES:=200:/sbin/tc:/usr/libexec/tc-tiny
|
||||
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/tc-bpf
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Traffic control utility (bpf)
|
||||
VARIANT:=tcbpf
|
||||
PROVIDES:=tc
|
||||
ALTERNATIVES:=300:/sbin/tc:/usr/libexec/tc-bpf
|
||||
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf
|
||||
endef
|
||||
|
||||
define Package/tc-full
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Traffic control utility (full)
|
||||
VARIANT:=tcfull
|
||||
PROVIDES:=tc
|
||||
ALTERNATIVES:=400:/sbin/tc:/usr/libexec/tc-full
|
||||
DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +libxtables
|
||||
endef
|
||||
|
||||
define Package/genl
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=General netlink utility frontend
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ip-bridge
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Bridge configuration utility from iproute2
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/ss
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Socket statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libbpf +kmod-netlink-diag
|
||||
endef
|
||||
|
||||
define Package/nstat
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
|
||||
endef
|
||||
|
||||
define Package/devlink
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network devlink utility
|
||||
DEPENDS:=+libmnl
|
||||
endef
|
||||
|
||||
define Package/rdma
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network rdma utility
|
||||
DEPENDS:=+libmnl
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),iptiny)
|
||||
IP_CONFIG_TINY:=y
|
||||
LIBBPF_FORCE:=off
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),ipfull)
|
||||
HAVE_ELF:=y
|
||||
LIBBPF_FORCE:=on
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tctiny)
|
||||
LIBBPF_FORCE:=off
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tcbpf)
|
||||
HAVE_ELF:=y
|
||||
LIBBPF_FORCE:=on
|
||||
SHARED_LIBS:=y
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tcfull)
|
||||
#enable iptables/xtables requirement only if tciptables variant is selected
|
||||
TC_CONFIG_XT:=y
|
||||
TC_CONFIG_XT_OLD:=y
|
||||
TC_CONFIG_XT_OLD_H:=y
|
||||
TC_CONFIG_IPSET:=y
|
||||
HAVE_ELF:=y
|
||||
LIBBPF_FORCE:=on
|
||||
SHARED_LIBS:=y
|
||||
else
|
||||
#disable iptables requirement by default
|
||||
TC_CONFIG_XT:=n
|
||||
TC_CONFIG_XT_OLD:=n
|
||||
TC_CONFIG_XT_OLD_H:=n
|
||||
TC_CONFIG_IPSET:=n
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_devlink
|
||||
HAVE_MNL:=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_rdma
|
||||
HAVE_MNL:=y
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
|
||||
> $(PKG_BUILD_DIR)/include/SNAPSHOT.h
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS += -Wl,--as-needed
|
||||
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||
|
||||
MAKE_FLAGS += \
|
||||
KERNEL_INCLUDE="$(LINUX_DIR)/include/uapi" \
|
||||
SHARED_LIBS=$(SHARED_LIBS) \
|
||||
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
|
||||
BUILD_VARIANT=$(BUILD_VARIANT) \
|
||||
LIBBPF_FORCE=$(LIBBPF_FORCE) \
|
||||
HAVE_ELF=$(HAVE_ELF) \
|
||||
HAVE_MNL=$(HAVE_MNL) \
|
||||
HAVE_CAP=$(HAVE_CAP) \
|
||||
HAVE_TIRPC=n \
|
||||
IPT_LIB_DIR=/usr/lib/iptables \
|
||||
XT_LIB_DIR=/usr/lib/iptables \
|
||||
TC_CONFIG_XT=$(TC_CONFIG_XT) \
|
||||
TC_CONFIG_XT_OLD=$(TC_CONFIG_XT_OLD) \
|
||||
TC_CONFIG_XT_OLD_H=$(TC_CONFIG_XT_OLD_H) \
|
||||
TC_CONFIG_IPSET=$(TC_CONFIG_IPSET) \
|
||||
FPIC="$(FPIC)" \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/iproute2
|
||||
$(CP) $(PKG_BUILD_DIR)/include/bpf_elf.h $(1)/usr/include/iproute2
|
||||
$(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/ip-tiny/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
|
||||
endef
|
||||
|
||||
define Package/ip-full/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
|
||||
endef
|
||||
|
||||
define Package/tc-tiny/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-tiny
|
||||
endef
|
||||
|
||||
define Package/tc-bpf/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-bpf
|
||||
endef
|
||||
|
||||
define Package/tc-full/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full
|
||||
endef
|
||||
|
||||
define Package/genl/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ip-bridge/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ss/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/nstat/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/devlink/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/rdma/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ip-tiny))
|
||||
$(eval $(call BuildPackage,ip-full))
|
||||
$(eval $(call BuildPackage,tc-tiny))
|
||||
$(eval $(call BuildPackage,tc-bpf))
|
||||
$(eval $(call BuildPackage,tc-full))
|
||||
$(eval $(call BuildPackage,genl))
|
||||
$(eval $(call BuildPackage,ip-bridge))
|
||||
$(eval $(call BuildPackage,ss))
|
||||
$(eval $(call BuildPackage,nstat))
|
||||
$(eval $(call BuildPackage,devlink))
|
||||
$(eval $(call BuildPackage,rdma))
|
||||
@@ -0,0 +1,59 @@
|
||||
--- a/netem/maketable.c
|
||||
+++ b/netem/maketable.c
|
||||
@@ -11,7 +11,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
+#endif
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
--- a/netem/normal.c
|
||||
+++ b/netem/normal.c
|
||||
@@ -9,8 +9,12 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
#define TABLESIZE 16384
|
||||
#define TABLEFACTOR NETEM_DIST_SCALE
|
||||
--- a/netem/pareto.c
|
||||
+++ b/netem/pareto.c
|
||||
@@ -8,8 +8,12 @@
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
static const double a=3.0;
|
||||
#define TABLESIZE 16384
|
||||
--- a/netem/paretonormal.c
|
||||
+++ b/netem/paretonormal.c
|
||||
@@ -15,10 +15,13 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
-
|
||||
#include <linux/types.h>
|
||||
#include <linux/pkt_sched.h>
|
||||
+#else
|
||||
+#define NETEM_DIST_SCALE 8192
|
||||
+#endif
|
||||
|
||||
#define TABLESIZE 16384
|
||||
#define TABLEFACTOR NETEM_DIST_SCALE
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/tc/Makefile
|
||||
+++ b/tc/Makefile
|
||||
@@ -107,6 +107,9 @@ CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PR
|
||||
ifneq ($(IPT_LIB_DIR),)
|
||||
CFLAGS += -DIPT_LIB_DIR=\"$(IPT_LIB_DIR)\"
|
||||
endif
|
||||
+ifneq ($(XT_LIB_DIR),)
|
||||
+ CFLAGS += -DXT_LIB_DIR=\"$(XT_LIB_DIR)\"
|
||||
+endif
|
||||
|
||||
LEX := flex
|
||||
CFLAGS += -DYY_NO_INPUT
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/misc/Makefile
|
||||
+++ b/misc/Makefile
|
||||
@@ -2,13 +2,13 @@
|
||||
SSOBJ=ss.o ssfilter_check.o ssfilter.tab.o
|
||||
LNSTATOBJ=lnstat.o lnstat_util.o
|
||||
|
||||
-TARGETS=ss nstat ifstat rtacct lnstat
|
||||
+TARGETS=ss nstat
|
||||
|
||||
include ../config.mk
|
||||
|
||||
-ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
- TARGETS += arpd
|
||||
-endif
|
||||
+#ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
+# TARGETS += arpd
|
||||
+#endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -69,9 +69,9 @@ WFLAGS += -Wmissing-declarations -Wold-s
|
||||
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
|
||||
YACCFLAGS = -d -t -v
|
||||
|
||||
-SUBDIRS=lib ip tc bridge misc netem genl man
|
||||
+SUBDIRS=lib ip tc bridge misc genl
|
||||
ifeq ($(HAVE_MNL),y)
|
||||
-SUBDIRS += tipc devlink rdma dcb vdpa
|
||||
+SUBDIRS += devlink rdma
|
||||
endif
|
||||
|
||||
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
||||
@@ -0,0 +1,9 @@
|
||||
--- a/tc/q_fifo.c
|
||||
+++ b/tc/q_fifo.c
|
||||
@@ -90,5 +90,6 @@ struct qdisc_util pfifo_head_drop_qdisc_
|
||||
|
||||
struct qdisc_util pfifo_fast_qdisc_util = {
|
||||
.id = "pfifo_fast",
|
||||
+ .parse_qopt = fifo_parse_opt,
|
||||
.print_qopt = prio_print_opt,
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -362,7 +362,7 @@ check_tirpc()
|
||||
|
||||
check_mnl()
|
||||
{
|
||||
- if ${PKG_CONFIG} libmnl --exists; then
|
||||
+ if [ "${HAVE_MNL}" = "y" ] && ${PKG_CONFIG} libmnl --exists; then
|
||||
echo "HAVE_MNL:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -217,7 +217,7 @@ EOF
|
||||
|
||||
check_elf()
|
||||
{
|
||||
- if ${PKG_CONFIG} libelf --exists; then
|
||||
+ if [ "${HAVE_ELF}" = "y" ] && ${PKG_CONFIG} libelf --exists; then
|
||||
echo "HAVE_ELF:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -421,7 +421,7 @@ EOF
|
||||
|
||||
check_cap()
|
||||
{
|
||||
- if ${PKG_CONFIG} libcap --exists; then
|
||||
+ if [ "${HAVE_CAP}" = "y" ] && ${PKG_CONFIG} libcap --exists; then
|
||||
echo "HAVE_CAP:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -349,7 +349,7 @@ check_selinux()
|
||||
|
||||
check_tirpc()
|
||||
{
|
||||
- if ${PKG_CONFIG} libtirpc --exists; then
|
||||
+ if [ "${HAVE_TIRPC}" = "y" ] && ${PKG_CONFIG} libtirpc --exists; then
|
||||
echo "HAVE_RPC:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
include ../config.mk
|
||||
|
||||
-CFLAGS += -fPIC
|
||||
+CFLAGS += $(FPIC)
|
||||
|
||||
UTILOBJ = utils.o utils_math.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \
|
||||
inet_proto.o namespace.o json_writer.o json_print.o json_print_math.o \
|
||||
108
package/network/utils/iproute2/patches/170-ip_tiny.patch
Normal file
108
package/network/utils/iproute2/patches/170-ip_tiny.patch
Normal file
@@ -0,0 +1,108 @@
|
||||
--- a/ip/Makefile
|
||||
+++ b/ip/Makefile
|
||||
@@ -19,6 +19,13 @@ RTMONOBJ=rtmon.o
|
||||
|
||||
include ../config.mk
|
||||
|
||||
+STATIC_SYM_FILTER:=
|
||||
+ifeq ($(IP_CONFIG_TINY),y)
|
||||
+ STATIC_SYM_FILTER:=iplink_can.c iplink_ipoib.c iplink_vxlan.c
|
||||
+ CFLAGS += -DIPROUTE2_TINY
|
||||
+endif
|
||||
+STATIC_SYM_SOURCES:=$(filter-out $(STATIC_SYM_FILTER),$(wildcard *.c))
|
||||
+
|
||||
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
||||
SCRIPTS=routel
|
||||
TARGETS=ip rtmon
|
||||
@@ -48,7 +55,7 @@ else
|
||||
|
||||
ip: static-syms.o
|
||||
static-syms.o: static-syms.h
|
||||
-static-syms.h: $(wildcard *.c)
|
||||
+static-syms.h: $(STATIC_SYM_SOURCES)
|
||||
files="$^" ; \
|
||||
for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
|
||||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
||||
--- a/ip/ip.c
|
||||
+++ b/ip/ip.c
|
||||
@@ -61,11 +61,17 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
+#ifndef IPROUTE2_TINY
|
||||
"where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |\n"
|
||||
" macsec | maddress | monitor | mptcp | mroute | mrule |\n"
|
||||
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
|
||||
" ntbl | route | rule | sr | stats | tap | tcpmetrics |\n"
|
||||
" token | tunnel | tuntap | vrf | xfrm }\n"
|
||||
+#else
|
||||
+ "where OBJECT := { address | help | link | maddress | monitor |\n"
|
||||
+ " neighbor | neighbour | netns | route |\n"
|
||||
+ " rule | stats | token | tunnel }\n"
|
||||
+#endif
|
||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
||||
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
|
||||
" -f[amily] { inet | inet6 | mpls | bridge | link } |\n"
|
||||
@@ -88,37 +94,49 @@ static const struct cmd {
|
||||
int (*func)(int argc, char **argv);
|
||||
} cmds[] = {
|
||||
{ "address", do_ipaddr },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "addrlabel", do_ipaddrlabel },
|
||||
+#endif
|
||||
{ "maddress", do_multiaddr },
|
||||
{ "route", do_iproute },
|
||||
{ "rule", do_iprule },
|
||||
{ "neighbor", do_ipneigh },
|
||||
{ "neighbour", do_ipneigh },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "ntable", do_ipntable },
|
||||
{ "ntbl", do_ipntable },
|
||||
+#endif
|
||||
{ "link", do_iplink },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "l2tp", do_ipl2tp },
|
||||
{ "fou", do_ipfou },
|
||||
{ "ila", do_ipila },
|
||||
{ "macsec", do_ipmacsec },
|
||||
+#endif
|
||||
{ "tunnel", do_iptunnel },
|
||||
{ "tunl", do_iptunnel },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "tuntap", do_iptuntap },
|
||||
{ "tap", do_iptuntap },
|
||||
{ "token", do_iptoken },
|
||||
{ "tcpmetrics", do_tcp_metrics },
|
||||
{ "tcp_metrics", do_tcp_metrics },
|
||||
+#endif
|
||||
{ "monitor", do_ipmonitor },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "xfrm", do_xfrm },
|
||||
{ "mroute", do_multiroute },
|
||||
{ "mrule", do_multirule },
|
||||
+#endif
|
||||
{ "netns", do_netns },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "netconf", do_ipnetconf },
|
||||
{ "vrf", do_ipvrf},
|
||||
{ "sr", do_seg6 },
|
||||
{ "nexthop", do_ipnh },
|
||||
{ "mptcp", do_mptcp },
|
||||
{ "ioam", do_ioam6 },
|
||||
+#endif
|
||||
{ "help", do_help },
|
||||
{ "stats", do_ipstats },
|
||||
{ 0 }
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -3,6 +3,10 @@ include ../config.mk
|
||||
|
||||
CFLAGS += $(FPIC)
|
||||
|
||||
+ifeq ($(IP_CONFIG_TINY),y)
|
||||
+ CFLAGS += -DIPROUTE2_TINY
|
||||
+endif
|
||||
+
|
||||
UTILOBJ = utils.o utils_math.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \
|
||||
inet_proto.o namespace.o json_writer.o json_print.o json_print_math.o \
|
||||
names.o color.o bpf_legacy.o bpf_glue.o exec.o fs.o cg_map.o ppp_proto.o
|
||||
@@ -0,0 +1,41 @@
|
||||
From 4e7dbf76227e8c7be7897dc81def3011f637864d Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Gorski <jogo@openwrt.org>
|
||||
Date: Thu, 30 May 2013 11:54:04 +0200
|
||||
Subject: [PATCH] add support for dropping with FAILED_POLICY
|
||||
|
||||
---
|
||||
include/linux/fib_rules.h | 4 ++++
|
||||
include/linux/rtnetlink.h | 1 +
|
||||
ip/rtm_map.c | 4 ++++
|
||||
3 files changed, 9 insertions(+)
|
||||
|
||||
--- a/ip/rtm_map.c
|
||||
+++ b/ip/rtm_map.c
|
||||
@@ -49,6 +49,8 @@ char *rtnl_rtntype_n2a(int id, char *buf
|
||||
return "nat";
|
||||
case RTN_XRESOLVE:
|
||||
return "xresolve";
|
||||
+ case RTN_FAILED_POLICY:
|
||||
+ return "failed_policy";
|
||||
default:
|
||||
snprintf(buf, len, "%d", id);
|
||||
return buf;
|
||||
@@ -84,6 +86,8 @@ int rtnl_rtntype_a2n(int *id, char *arg)
|
||||
res = RTN_UNICAST;
|
||||
else if (strcmp(arg, "throw") == 0)
|
||||
res = RTN_THROW;
|
||||
+ else if (strcmp(arg, "failed_policy") == 0)
|
||||
+ res = RTN_FAILED_POLICY;
|
||||
else {
|
||||
res = strtoul(arg, &end, 0);
|
||||
if (!end || end == arg || *end || res > 255)
|
||||
--- a/include/uapi/linux/rtnetlink.h
|
||||
+++ b/include/uapi/linux/rtnetlink.h
|
||||
@@ -265,6 +265,7 @@ enum {
|
||||
RTN_THROW, /* Not in this table */
|
||||
RTN_NAT, /* Translate this address */
|
||||
RTN_XRESOLVE, /* Use external resolver */
|
||||
+ RTN_FAILED_POLICY, /* Source address failed policy */
|
||||
__RTN_MAX
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -241,7 +241,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
EOF
|
||||
|
||||
- $CC -o $TMPDIR/libbpf_test $TMPDIR/libbpf_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS >/dev/null 2>&1
|
||||
+ $CC -o $TMPDIR/libbpf_test $TMPDIR/libbpf_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS >/dev/null 2>&1
|
||||
local ret=$?
|
||||
|
||||
rm -f $TMPDIR/libbpf_test.c $TMPDIR/libbpf_test
|
||||
@@ -259,7 +259,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
EOF
|
||||
|
||||
- $CC -o $TMPDIR/libbpf_sec_test $TMPDIR/libbpf_sec_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS >/dev/null 2>&1
|
||||
+ $CC -o $TMPDIR/libbpf_sec_test $TMPDIR/libbpf_sec_test.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS $LDFLAGS >/dev/null 2>&1
|
||||
local ret=$?
|
||||
|
||||
rm -f $TMPDIR/libbpf_sec_test.c $TMPDIR/libbpf_sec_test
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/ip/Makefile
|
||||
+++ b/ip/Makefile
|
||||
@@ -28,7 +28,7 @@ STATIC_SYM_SOURCES:=$(filter-out $(STATI
|
||||
|
||||
ALLOBJ=$(IPOBJ) $(RTMONOBJ)
|
||||
SCRIPTS=routel
|
||||
-TARGETS=ip rtmon
|
||||
+TARGETS=$(findstring ip,$(BUILD_VARIANT)) rtmon
|
||||
|
||||
all: $(TARGETS) $(SCRIPTS)
|
||||
|
||||
--- a/tc/Makefile
|
||||
+++ b/tc/Makefile
|
||||
@@ -120,7 +120,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
|
||||
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic $< -o $@
|
||||
|
||||
|
||||
-all: tc $(TCSO)
|
||||
+all: $(findstring tc,$(BUILD_VARIANT)) $(TCSO)
|
||||
|
||||
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
|
||||
$(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -407,14 +407,8 @@ EOF
|
||||
if $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1; then
|
||||
echo "no"
|
||||
else
|
||||
- if ${PKG_CONFIG} libbsd --exists; then
|
||||
- echo 'CFLAGS += -DHAVE_LIBBSD' "$(${PKG_CONFIG} libbsd --cflags)" >>$CONFIG
|
||||
- echo 'LDLIBS +=' "$(${PKG_CONFIG} libbsd --libs)" >> $CONFIG
|
||||
- echo "no"
|
||||
- else
|
||||
- echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
|
||||
- echo "yes"
|
||||
- fi
|
||||
+ echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
|
||||
+ echo "yes"
|
||||
fi
|
||||
rm -f $TMPDIR/strtest.c $TMPDIR/strtest
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -336,7 +336,7 @@ check_libbpf()
|
||||
check_selinux()
|
||||
# SELinux is a compile time option in the ss utility
|
||||
{
|
||||
- if ${PKG_CONFIG} libselinux --exists; then
|
||||
+ if [ "${HAVE_SELINUX}" = "y" ] && ${PKG_CONFIG} libselinux --exists; then
|
||||
echo "HAVE_SELINUX:=y" >>$CONFIG
|
||||
echo "yes"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/rdma/rdma.h
|
||||
+++ b/rdma/rdma.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <rdma/rdma_user_cm.h>
|
||||
#include <time.h>
|
||||
#include <net/if_arp.h>
|
||||
+#include <libgen.h>
|
||||
|
||||
#include "list.h"
|
||||
#include "utils.h"
|
||||
@@ -0,0 +1,69 @@
|
||||
From 53a89bfd86fff1a00cc77cabb8457a03eaa3bc7d Mon Sep 17 00:00:00 2001
|
||||
From: Gabi Falk <gabifalk@gmx.com>
|
||||
Date: Fri, 10 May 2024 14:36:12 +0000
|
||||
Subject: [PATCH] bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl
|
||||
systems
|
||||
|
||||
On glibc based systems the definition of 'struct timeval' is pulled in
|
||||
with inclusion of <stdlib.h> header, but on musl based systems it
|
||||
doesn't work this way. Missing definition triggers an
|
||||
incompatible-pointer-types error with gcc 14 (warning on previous
|
||||
versions of gcc):
|
||||
|
||||
../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
|
||||
80 | _PRINT_FUNC(tv, const struct timeval *)
|
||||
| ^~~~~~~
|
||||
../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC'
|
||||
50 | type value); \
|
||||
| ^~~~
|
||||
../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
|
||||
80 | _PRINT_FUNC(tv, const struct timeval *)
|
||||
| ^~~~~~~
|
||||
../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC'
|
||||
55 | type value) \
|
||||
| ^~~~
|
||||
../include/json_print.h: In function 'print_tv':
|
||||
../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types]
|
||||
58 | value); \
|
||||
| ^~~~~
|
||||
| |
|
||||
| const struct timeval *
|
||||
|
||||
Signed-off-by: Gabi Falk <gabifalk@gmx.com>
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
---
|
||||
bridge/vlan.c | 1 +
|
||||
bridge/vni.c | 1 +
|
||||
vdpa/vdpa.c | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
--- a/bridge/vlan.c
|
||||
+++ b/bridge/vlan.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/time.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_bridge.h>
|
||||
--- a/bridge/vni.c
|
||||
+++ b/bridge/vni.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/time.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_link.h>
|
||||
--- a/vdpa/vdpa.c
|
||||
+++ b/vdpa/vdpa.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
+#include <sys/time.h>
|
||||
#include <linux/genetlink.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/vdpa.h>
|
||||
75
package/network/utils/ipset/Makefile
Normal file
75
package/network/utils/ipset/Makefile
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
# Copyright (C) 2009-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ipset
|
||||
PKG_VERSION:=7.21
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://ipset.netfilter.org
|
||||
PKG_HASH:=e2c6ce4fcf3acb3893ca5d35c86935f80ad76fc5ccae601185842df760e0bc69
|
||||
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:netfilter:ipset
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipset/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS+= +kmod-ipt-ipset +libmnl
|
||||
TITLE:=IPset administration utility
|
||||
URL:=http://ipset.netfilter.org/
|
||||
endef
|
||||
|
||||
define Package/ipset
|
||||
$(call Package/ipset/Default)
|
||||
DEPENDS+= +libipset
|
||||
endef
|
||||
|
||||
define Package/libipset
|
||||
$(call Package/ipset/Default)
|
||||
ABI_VERSION:=13
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-static \
|
||||
--with-kbuild="$(LINUX_DIR)"
|
||||
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
|
||||
|
||||
MAKE_FLAGS += \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
SHELL="$(BASH)"
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/libipset $(1)/usr/include/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/libipset.pc $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/ipset/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ipset $(1)/usr/sbin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ipset-translate $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/libipset/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libipset*.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libipset))
|
||||
$(eval $(call BuildPackage,ipset))
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/src/ipset.c
|
||||
+++ b/src/ipset.c
|
||||
@@ -6,8 +6,8 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
-#define _GNU_SOURCE
|
||||
#include <assert.h> /* assert */
|
||||
+#include <libgen.h> /* basename */
|
||||
#include <stdio.h> /* fprintf */
|
||||
#include <stdlib.h> /* exit */
|
||||
#include <string.h> /* strcmp */
|
||||
781
package/network/utils/iptables/Makefile
Normal file
781
package/network/utils/iptables/Makefile
Normal file
@@ -0,0 +1,781 @@
|
||||
#
|
||||
# Copyright (C) 2006-2016 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=iptables
|
||||
PKG_VERSION:=1.8.8
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_HASH:=71c75889dc710676631553eb1511da0177bbaaf1b551265b912d236c3f51859f
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_FLAGS:=gc-sections no-lto
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:netfilter:iptables
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
ifeq ($(DUMP),)
|
||||
-include $(LINUX_DIR)/.config
|
||||
include $(INCLUDE_DIR)/netfilter.mk
|
||||
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | $(MKHASH) md5)
|
||||
endif
|
||||
|
||||
|
||||
define Package/iptables/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
URL:=https://netfilter.org/
|
||||
endef
|
||||
|
||||
define Package/iptables/Module
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=+libxtables $(1)
|
||||
endef
|
||||
|
||||
define Package/xtables-legacy
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool
|
||||
DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables
|
||||
endef
|
||||
|
||||
define Package/iptables-zz-legacy
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool
|
||||
DEPENDS+= +xtables-legacy
|
||||
PROVIDES:=iptables iptables-legacy
|
||||
ALTERNATIVES:=\
|
||||
200:/usr/sbin/iptables:/usr/sbin/xtables-legacy-multi \
|
||||
200:/usr/sbin/iptables-restore:/usr/sbin/xtables-legacy-multi \
|
||||
200:/usr/sbin/iptables-save:/usr/sbin/xtables-legacy-multi
|
||||
endef
|
||||
|
||||
define Package/iptables-zz-legacy/description
|
||||
IP firewall administration tool.
|
||||
|
||||
Matches:
|
||||
- icmp
|
||||
- tcp
|
||||
- udp
|
||||
- comment
|
||||
- conntrack
|
||||
- limit
|
||||
- mac
|
||||
- mark
|
||||
- multiport
|
||||
- set
|
||||
- state
|
||||
- time
|
||||
|
||||
Targets:
|
||||
- ACCEPT
|
||||
- CT
|
||||
- DNAT
|
||||
- DROP
|
||||
- REJECT
|
||||
- FLOWOFFLOAD
|
||||
- LOG
|
||||
- MARK
|
||||
- MASQUERADE
|
||||
- REDIRECT
|
||||
- SET
|
||||
- SNAT
|
||||
- TCPMSS
|
||||
|
||||
Tables:
|
||||
- filter
|
||||
- mangle
|
||||
- nat
|
||||
- raw
|
||||
|
||||
endef
|
||||
|
||||
define Package/xtables-nft
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool nft
|
||||
DEPENDS:=+libnftnl +libiptext +IPV6:libiptext6 +libiptext-nft +kmod-nft-compat
|
||||
endef
|
||||
|
||||
define Package/arptables-nft
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=+kmod-nft-arp +xtables-nft +kmod-arptables
|
||||
TITLE:=ARP firewall administration tool nft
|
||||
PROVIDES:=arptables
|
||||
ALTERNATIVES:=\
|
||||
300:/usr/sbin/arptables:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/arptables-restore:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/arptables-save:/usr/sbin/xtables-nft-multi
|
||||
endef
|
||||
|
||||
define Package/ebtables-nft
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=+kmod-nft-bridge +xtables-nft +kmod-ebtables
|
||||
TITLE:=Bridge firewall administration tool nft
|
||||
PROVIDES:=ebtables
|
||||
ALTERNATIVES:=\
|
||||
300:/usr/sbin/ebtables:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/ebtables-restore:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/ebtables-save:/usr/sbin/xtables-nft-multi
|
||||
endef
|
||||
|
||||
define Package/iptables-nft
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool nft
|
||||
DEPENDS:=+kmod-ipt-core +xtables-nft
|
||||
PROVIDES:=iptables
|
||||
ALTERNATIVES:=\
|
||||
300:/usr/sbin/iptables:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/iptables-restore:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/iptables-save:/usr/sbin/xtables-nft-multi
|
||||
endef
|
||||
|
||||
define Package/iptables-nft/description
|
||||
Extra iptables nftables nft binaries.
|
||||
iptables-nft
|
||||
iptables-nft-restore
|
||||
iptables-nft-save
|
||||
iptables-translate
|
||||
iptables-restore-translate
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-conntrack-extra
|
||||
$(call Package/iptables/Module, +kmod-ipt-conntrack-extra)
|
||||
TITLE:=Extra connection tracking extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-conntrack-extra/description
|
||||
Extra iptables extensions for connection tracking.
|
||||
|
||||
Matches:
|
||||
- connbytes
|
||||
- connlimit
|
||||
- connmark
|
||||
- recent
|
||||
- helper
|
||||
|
||||
Targets:
|
||||
- CONNMARK
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-conntrack-label
|
||||
$(call Package/iptables/Module, +kmod-ipt-conntrack-label @IPTABLES_CONNLABEL)
|
||||
TITLE:=Connection tracking labeling extension
|
||||
DEFAULT:=y if IPTABLES_CONNLABEL
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-conntrack-label/description
|
||||
Match and set label(s) on connection tracking entries
|
||||
|
||||
Matches:
|
||||
- connlabel
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-filter
|
||||
$(call Package/iptables/Module, +kmod-ipt-filter)
|
||||
TITLE:=Content inspection extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-filter/description
|
||||
iptables extensions for packet content inspection.
|
||||
Includes support for:
|
||||
|
||||
Matches:
|
||||
- string
|
||||
- bpf
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ipopt
|
||||
$(call Package/iptables/Module, +kmod-ipt-ipopt)
|
||||
TITLE:=IP/Packet option extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ipopt/description
|
||||
iptables extensions for matching/changing IP packet options.
|
||||
|
||||
Matches:
|
||||
- dscp
|
||||
- ecn
|
||||
- length
|
||||
- statistic
|
||||
- tcpmss
|
||||
- unclean
|
||||
- hl
|
||||
|
||||
Targets:
|
||||
- DSCP
|
||||
- CLASSIFY
|
||||
- ECN
|
||||
- HL
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ipsec
|
||||
$(call Package/iptables/Module, +kmod-ipt-ipsec)
|
||||
TITLE:=IPsec extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ipsec/description
|
||||
iptables extensions for matching ipsec traffic.
|
||||
|
||||
Matches:
|
||||
- ah
|
||||
- esp
|
||||
- policy
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-nat-extra
|
||||
$(call Package/iptables/Module, +kmod-ipt-nat-extra)
|
||||
TITLE:=Extra NAT extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-nat-extra/description
|
||||
iptables extensions for extra NAT targets.
|
||||
|
||||
Targets:
|
||||
- MIRROR
|
||||
- NETMAP
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-nflog
|
||||
$(call Package/iptables/Module, +kmod-nfnetlink-log +kmod-ipt-nflog)
|
||||
TITLE:=Netfilter NFLOG target
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-nflog/description
|
||||
iptables extension for user-space logging via NFNETLINK.
|
||||
|
||||
Includes:
|
||||
- libxt_NFLOG
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-trace
|
||||
$(call Package/iptables/Module, +kmod-ipt-debug)
|
||||
TITLE:=Netfilter TRACE target
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-trace/description
|
||||
iptables extension for TRACE target
|
||||
|
||||
Includes:
|
||||
- libxt_TRACE
|
||||
|
||||
endef
|
||||
|
||||
|
||||
define Package/iptables-mod-nfqueue
|
||||
$(call Package/iptables/Module, +kmod-nfnetlink-queue +kmod-ipt-nfqueue)
|
||||
TITLE:=Netfilter NFQUEUE target
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-nfqueue/description
|
||||
iptables extension for user-space queuing via NFNETLINK.
|
||||
|
||||
Includes:
|
||||
- libxt_NFQUEUE
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-hashlimit
|
||||
$(call Package/iptables/Module, +kmod-ipt-hashlimit)
|
||||
TITLE:=hashlimit matching
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-hashlimit/description
|
||||
iptables extensions for hashlimit matching
|
||||
|
||||
Matches:
|
||||
- hashlimit
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-rpfilter
|
||||
$(call Package/iptables/Module, +kmod-ipt-rpfilter)
|
||||
TITLE:=rpfilter iptables extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-rpfilter/description
|
||||
iptables extensions for reverse path filter test on a packet
|
||||
|
||||
Matches:
|
||||
- rpfilter
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-iprange
|
||||
$(call Package/iptables/Module, +kmod-ipt-iprange)
|
||||
TITLE:=IP range extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-iprange/description
|
||||
iptables extensions for matching ip ranges.
|
||||
|
||||
Matches:
|
||||
- iprange
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-cluster
|
||||
$(call Package/iptables/Module, +kmod-ipt-cluster)
|
||||
TITLE:=Match cluster extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-cluster/description
|
||||
iptables extensions for matching cluster.
|
||||
|
||||
Netfilter (IPv4/IPv6) module for matching cluster
|
||||
This option allows you to build work-load-sharing clusters of
|
||||
network servers/stateful firewalls without having a dedicated
|
||||
load-balancing router/server/switch. Basically, this match returns
|
||||
true when the packet must be handled by this cluster node. Thus,
|
||||
all nodes see all packets and this match decides which node handles
|
||||
what packets. The work-load sharing algorithm is based on source
|
||||
address hashing.
|
||||
|
||||
This module is usable for ipv4 and ipv6.
|
||||
|
||||
If you select it, it enables kmod-ipt-cluster.
|
||||
|
||||
see `iptables -m cluster --help` for more information.
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-clusterip
|
||||
$(call Package/iptables/Module, +kmod-ipt-clusterip)
|
||||
TITLE:=Clusterip extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-clusterip/description
|
||||
iptables extensions for CLUSTERIP.
|
||||
The CLUSTERIP target allows you to build load-balancing clusters of
|
||||
network servers without having a dedicated load-balancing
|
||||
router/server/switch.
|
||||
|
||||
If you select it, it enables kmod-ipt-clusterip.
|
||||
|
||||
see `iptables -j CLUSTERIP --help` for more information.
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-extra
|
||||
$(call Package/iptables/Module, +kmod-ipt-extra)
|
||||
TITLE:=Other extra iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-extra/description
|
||||
Other extra iptables extensions.
|
||||
|
||||
Matches:
|
||||
- addrtype
|
||||
- condition
|
||||
- owner
|
||||
- pkttype
|
||||
- quota
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-physdev
|
||||
$(call Package/iptables/Module, +kmod-ipt-physdev)
|
||||
TITLE:=physdev iptables extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-physdev/description
|
||||
The iptables physdev match.
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-led
|
||||
$(call Package/iptables/Module, +kmod-ipt-led)
|
||||
TITLE:=LED trigger iptables extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-led/description
|
||||
iptables extension for triggering a LED.
|
||||
|
||||
Targets:
|
||||
- LED
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-socket
|
||||
$(call Package/iptables/Module, +kmod-ipt-socket)
|
||||
TITLE:=Socket match iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-socket/description
|
||||
Socket match iptables extensions.
|
||||
|
||||
Matches:
|
||||
- socket
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-tproxy
|
||||
$(call Package/iptables/Module, +kmod-ipt-tproxy)
|
||||
TITLE:=Transparent proxy iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-tproxy/description
|
||||
Transparent proxy iptables extensions.
|
||||
|
||||
Targets:
|
||||
- TPROXY
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-tee
|
||||
$(call Package/iptables/Module, +kmod-ipt-tee)
|
||||
TITLE:=TEE iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-tee/description
|
||||
TEE iptables extensions.
|
||||
|
||||
Targets:
|
||||
- TEE
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-u32
|
||||
$(call Package/iptables/Module, +kmod-ipt-u32)
|
||||
TITLE:=U32 iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-u32/description
|
||||
U32 iptables extensions.
|
||||
|
||||
Matches:
|
||||
- u32
|
||||
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-checksum
|
||||
$(call Package/iptables/Module, +kmod-ipt-checksum)
|
||||
TITLE:=IP CHECKSUM target extension
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-checksum/description
|
||||
iptables extension for the CHECKSUM calculation target
|
||||
endef
|
||||
|
||||
define Package/ip6tables-zz-legacy
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=@IPV6 +kmod-ip6tables +xtables-legacy
|
||||
CATEGORY:=Network
|
||||
TITLE:=IPv6 firewall administration tool
|
||||
PROVIDES:=ip6tables ip6tables-legacy
|
||||
ALTERNATIVES:=\
|
||||
200:/usr/sbin/ip6tables:/usr/sbin/xtables-legacy-multi \
|
||||
200:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-legacy-multi \
|
||||
200:/usr/sbin/ip6tables-save:/usr/sbin/xtables-legacy-multi
|
||||
endef
|
||||
|
||||
define Package/ip6tables-nft
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=@IPV6 +kmod-ip6tables +xtables-nft
|
||||
TITLE:=IP firewall administration tool nft
|
||||
PROVIDES:=ip6tables
|
||||
ALTERNATIVES:=\
|
||||
300:/usr/sbin/ip6tables:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-nft-multi \
|
||||
300:/usr/sbin/ip6tables-save:/usr/sbin/xtables-nft-multi
|
||||
endef
|
||||
|
||||
define Package/ip6tables-nft/description
|
||||
Extra ip6tables nftables nft binaries.
|
||||
ip6tables-nft
|
||||
ip6tables-nft-restore
|
||||
ip6tables-nft-save
|
||||
ip6tables-translate
|
||||
ip6tables-restore-translate
|
||||
endef
|
||||
|
||||
define Package/ip6tables-extra
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=+libxtables +kmod-ip6tables-extra
|
||||
TITLE:=IPv6 header matching modules
|
||||
endef
|
||||
|
||||
define Package/ip6tables-extra/description
|
||||
iptables header matching modules for IPv6
|
||||
endef
|
||||
|
||||
define Package/ip6tables-mod-nat
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=+libxtables +kmod-ipt-nat6
|
||||
TITLE:=IPv6 NAT extensions
|
||||
endef
|
||||
|
||||
define Package/ip6tables-mod-nat/description
|
||||
iptables extensions for IPv6-NAT targets.
|
||||
endef
|
||||
|
||||
define Package/libip4tc
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4 firewall - shared libiptc library
|
||||
ABI_VERSION:=2
|
||||
endef
|
||||
|
||||
define Package/libip6tc
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv6 firewall - shared libiptc library
|
||||
ABI_VERSION:=2
|
||||
endef
|
||||
|
||||
define Package/libiptext
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4 firewall - shared libiptext library
|
||||
ABI_VERSION:=0
|
||||
DEPENDS:=+libxtables
|
||||
endef
|
||||
|
||||
define Package/libiptext6
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv6 firewall - shared libiptext library
|
||||
ABI_VERSION:=0
|
||||
DEPENDS:=+libxtables
|
||||
endef
|
||||
|
||||
define Package/libiptext-nft
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4/IPv6 firewall - shared libiptext nft library
|
||||
ABI_VERSION:=0
|
||||
DEPENDS:=+libxtables
|
||||
endef
|
||||
|
||||
define Package/libxtables
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4/IPv6 firewall - shared xtables library
|
||||
MENU:=1
|
||||
ABI_VERSION:=12
|
||||
DEPENDS:=+IPTABLES_CONNLABEL:libnetfilter-conntrack
|
||||
endef
|
||||
|
||||
define Package/libxtables/config
|
||||
config IPTABLES_CONNLABEL
|
||||
bool "Enable Connlabel support"
|
||||
default n
|
||||
help
|
||||
This enable connlabel support in iptables.
|
||||
endef
|
||||
|
||||
TARGET_CPPFLAGS := \
|
||||
-I$(PKG_BUILD_DIR)/include \
|
||||
-I$(LINUX_DIR)/user_headers/include \
|
||||
$(TARGET_CPPFLAGS)
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(PKG_BUILD_DIR)/include \
|
||||
-I$(LINUX_DIR)/user_headers/include \
|
||||
-DNO_LEGACY
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-shared \
|
||||
--enable-static \
|
||||
--enable-devel \
|
||||
--with-kernel="$(LINUX_DIR)/user_headers" \
|
||||
--with-xtlibdir=/usr/lib/iptables \
|
||||
--with-xt-lock-name=/var/run/xtables.lock \
|
||||
$(if $(CONFIG_IPTABLES_CONNLABEL),,--disable-connlabel) \
|
||||
$(if $(CONFIG_IPV6),,--disable-ipv6)
|
||||
|
||||
MAKE_FLAGS := \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
COPT_FLAGS="$(TARGET_CFLAGS)" \
|
||||
KERNEL_DIR="$(LINUX_DIR)/user_headers/" PREFIX=/usr \
|
||||
KBUILD_OUTPUT="$(LINUX_DIR)" \
|
||||
BUILTIN_MODULES="$(patsubst ip6t_%,%,$(patsubst ipt_%,%,$(patsubst xt_%,%,$(IPT_BUILTIN) $(IPT_CONNTRACK-m) $(IPT_NAT-m))))"
|
||||
|
||||
ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
|
||||
define Build/Configure/rebuild
|
||||
$(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.\?o -or -name \*.a | $(XARGS) rm -f
|
||||
rm -f $(PKG_BUILD_DIR)/.config_*
|
||||
rm -f $(PKG_BUILD_DIR)/.configured_*
|
||||
touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
$(Build/Configure/rebuild)
|
||||
$(Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/iptables
|
||||
$(INSTALL_DIR) $(1)/usr/include/net/netfilter
|
||||
|
||||
# XXX: iptables header fixup, some headers are not installed by iptables anymore
|
||||
$(CP) $(PKG_BUILD_DIR)/include/iptables/*.h $(1)/usr/include/iptables/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/iptables.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/ip6tables.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/libiptc $(1)/usr/include/
|
||||
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip*tc.so* $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/xtables.pc $(1)/usr/lib/pkgconfig/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libip*tc.pc $(1)/usr/lib/pkgconfig/
|
||||
|
||||
# XXX: needed by firewall3
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext*.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/xtables-legacy/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/iptables-zz-legacy/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-legacy{,-restore,-save} $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
endef
|
||||
|
||||
define Package/xtables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-nft-multi $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/arptables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/arptables-nft{,-restore,-save} $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libarpt_*.so $(1)/usr/lib/iptables/
|
||||
endef
|
||||
|
||||
define Package/ebtables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ebtables-nft{,-restore,-save} $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libebt_*.so $(1)/usr/lib/iptables/
|
||||
endef
|
||||
|
||||
define Package/iptables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-nft{,-restore,-save} $(1)/usr/sbin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore}-translate $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ip6tables-zz-legacy/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-legacy{,-restore,-save} $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/ip6tables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-nft{,-restore,-save} $(1)/usr/sbin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-restore}-translate $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/libip4tc/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libip6tc/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip6tc.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libiptext/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext.so $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext4.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libiptext6/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext6.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libiptext-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext_*.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libxtables/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libxtables.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define BuildPlugin
|
||||
define Package/$(1)/install
|
||||
$(INSTALL_DIR) $$(1)/usr/lib/iptables
|
||||
for m in $(patsubst xt_%,ipt_%,$(2)) $(patsubst ipt_%,xt_%,$(2)) $(patsubst xt_%,ip6t_%,$(2)) $(patsubst ip6t_%,xt_%,$(2)); do \
|
||||
if [ -f $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so ]; then \
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so $$(1)/usr/lib/iptables/ ; \
|
||||
fi; \
|
||||
done
|
||||
$(3)
|
||||
endef
|
||||
|
||||
$$(eval $$(call BuildPackage,$(1)))
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libxtables))
|
||||
$(eval $(call BuildPackage,libip4tc))
|
||||
$(eval $(call BuildPackage,libip6tc))
|
||||
$(eval $(call BuildPackage,libiptext))
|
||||
$(eval $(call BuildPackage,libiptext6))
|
||||
$(eval $(call BuildPackage,libiptext-nft))
|
||||
$(eval $(call BuildPackage,xtables-legacy))
|
||||
$(eval $(call BuildPackage,xtables-nft))
|
||||
$(eval $(call BuildPackage,arptables-nft))
|
||||
$(eval $(call BuildPackage,ebtables-nft))
|
||||
$(eval $(call BuildPackage,iptables-nft))
|
||||
$(eval $(call BuildPackage,iptables-zz-legacy))
|
||||
$(eval $(call BuildPlugin,iptables-mod-conntrack-extra,$(IPT_CONNTRACK_EXTRA-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-conntrack-label,$(IPT_CONNTRACK_LABEL-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-extra,$(IPT_EXTRA-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-physdev,$(IPT_PHYSDEV-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-filter,$(IPT_FILTER-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-ipopt,$(IPT_IPOPT-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-ipsec,$(IPT_IPSEC-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-nat-extra,$(IPT_NAT_EXTRA-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-iprange,$(IPT_IPRANGE-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-cluster,$(IPT_CLUSTER-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-clusterip,$(IPT_CLUSTERIP-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-hashlimit,$(IPT_HASHLIMIT-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-rpfilter,$(IPT_RPFILTER-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-led,$(IPT_LED-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-socket,$(IPT_SOCKET-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-tproxy,$(IPT_TPROXY-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-tee,$(IPT_TEE-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-u32,$(IPT_U32-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-nflog,$(IPT_NFLOG-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-trace,$(IPT_DEBUG-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-nfqueue,$(IPT_NFQUEUE-m)))
|
||||
$(eval $(call BuildPlugin,iptables-mod-checksum,$(IPT_CHECKSUM-m)))
|
||||
$(eval $(call BuildPackage,ip6tables-nft))
|
||||
$(eval $(call BuildPackage,ip6tables-zz-legacy))
|
||||
$(eval $(call BuildPlugin,ip6tables-extra,$(IPT_IPV6_EXTRA-m)))
|
||||
$(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m)))
|
||||
|
||||
@@ -0,0 +1,452 @@
|
||||
From 74267bacce0c43e5038b0377cb7c08f1ad9d50a3 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Date: Sat, 23 Mar 2019 10:21:03 +0000
|
||||
Subject: [PATCH] iptables: connmark - add set-dscpmark option for openwrt
|
||||
|
||||
Naive user space front end to xt_connmark 'setdscp' option.
|
||||
|
||||
iptables -A QOS_MARK_eth0 -t mangle -j CONNMARK --set-dscpmark 0xfc000000/0x01000000
|
||||
|
||||
This version has a hack to support a backport to 4.14
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
extensions/libxt_CONNMARK.c | 315 +++++++++++++++++++++++++-
|
||||
include/linux/netfilter/xt_connmark.h | 10 +
|
||||
2 files changed, 324 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/extensions/libxt_CONNMARK.c
|
||||
+++ b/extensions/libxt_CONNMARK.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
+#include <strings.h>
|
||||
#include <xtables.h>
|
||||
#include <linux/netfilter/xt_CONNMARK.h>
|
||||
|
||||
@@ -49,6 +50,7 @@ enum {
|
||||
O_CTMASK,
|
||||
O_NFMASK,
|
||||
O_MASK,
|
||||
+ O_DSCP_MARK,
|
||||
F_SET_MARK = 1 << O_SET_MARK,
|
||||
F_SAVE_MARK = 1 << O_SAVE_MARK,
|
||||
F_RESTORE_MARK = 1 << O_RESTORE_MARK,
|
||||
@@ -61,8 +63,10 @@ enum {
|
||||
F_CTMASK = 1 << O_CTMASK,
|
||||
F_NFMASK = 1 << O_NFMASK,
|
||||
F_MASK = 1 << O_MASK,
|
||||
+ F_DSCP_MARK = 1 << O_DSCP_MARK,
|
||||
F_OP_ANY = F_SET_MARK | F_SAVE_MARK | F_RESTORE_MARK |
|
||||
- F_AND_MARK | F_OR_MARK | F_XOR_MARK | F_SET_XMARK,
|
||||
+ F_AND_MARK | F_OR_MARK | F_XOR_MARK | F_SET_XMARK |
|
||||
+ F_DSCP_MARK,
|
||||
};
|
||||
|
||||
static const char *const xt_connmark_shift_ops[] = {
|
||||
@@ -114,6 +118,8 @@ static const struct xt_option_entry conn
|
||||
.excl = F_MASK, .flags = XTOPT_PUT, XTOPT_POINTER(s, nfmask)},
|
||||
{.name = "mask", .id = O_MASK, .type = XTTYPE_UINT32,
|
||||
.excl = F_CTMASK | F_NFMASK},
|
||||
+ {.name = "set-dscpmark", .id = O_DSCP_MARK, .type = XTTYPE_MARKMASK32,
|
||||
+ .excl = F_OP_ANY},
|
||||
XTOPT_TABLEEND,
|
||||
};
|
||||
#undef s
|
||||
@@ -148,6 +154,38 @@ static const struct xt_option_entry conn
|
||||
};
|
||||
#undef s
|
||||
|
||||
+#define s struct xt_connmark_tginfo3
|
||||
+static const struct xt_option_entry connmark_tg_opts_v3[] = {
|
||||
+ {.name = "set-xmark", .id = O_SET_XMARK, .type = XTTYPE_MARKMASK32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "set-mark", .id = O_SET_MARK, .type = XTTYPE_MARKMASK32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "and-mark", .id = O_AND_MARK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "or-mark", .id = O_OR_MARK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "xor-mark", .id = O_XOR_MARK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "save-mark", .id = O_SAVE_MARK, .type = XTTYPE_NONE,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "restore-mark", .id = O_RESTORE_MARK, .type = XTTYPE_NONE,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ {.name = "left-shift-mark", .id = O_LEFT_SHIFT_MARK, .type = XTTYPE_UINT8,
|
||||
+ .min = 0, .max = 32},
|
||||
+ {.name = "right-shift-mark", .id = O_RIGHT_SHIFT_MARK, .type = XTTYPE_UINT8,
|
||||
+ .min = 0, .max = 32},
|
||||
+ {.name = "ctmask", .id = O_CTMASK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_MASK, .flags = XTOPT_PUT, XTOPT_POINTER(s, ctmask)},
|
||||
+ {.name = "nfmask", .id = O_NFMASK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_MASK, .flags = XTOPT_PUT, XTOPT_POINTER(s, nfmask)},
|
||||
+ {.name = "mask", .id = O_MASK, .type = XTTYPE_UINT32,
|
||||
+ .excl = F_CTMASK | F_NFMASK},
|
||||
+ {.name = "set-dscpmark", .id = O_DSCP_MARK, .type = XTTYPE_MARKMASK32,
|
||||
+ .excl = F_OP_ANY},
|
||||
+ XTOPT_TABLEEND,
|
||||
+};
|
||||
+#undef s
|
||||
+
|
||||
static void connmark_tg_help(void)
|
||||
{
|
||||
printf(
|
||||
@@ -175,6 +213,15 @@ static void connmark_tg_help_v2(void)
|
||||
);
|
||||
}
|
||||
|
||||
+static void connmark_tg_help_v3(void)
|
||||
+{
|
||||
+ connmark_tg_help_v2();
|
||||
+ printf(
|
||||
+" --set-dscpmark value/mask Save DSCP to conntrack mark value\n"
|
||||
+);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static void connmark_tg_init(struct xt_entry_target *target)
|
||||
{
|
||||
struct xt_connmark_tginfo1 *info = (void *)target->data;
|
||||
@@ -199,6 +246,16 @@ static void connmark_tg_init_v2(struct x
|
||||
info->shift_bits = 0;
|
||||
}
|
||||
|
||||
+static void connmark_tg_init_v3(struct xt_entry_target *target)
|
||||
+{
|
||||
+ struct xt_connmark_tginfo3 *info;
|
||||
+
|
||||
+ connmark_tg_init_v2(target);
|
||||
+ info = (void *)target->data;
|
||||
+
|
||||
+ info->func = 0;
|
||||
+}
|
||||
+
|
||||
static void CONNMARK_parse(struct xt_option_call *cb)
|
||||
{
|
||||
struct xt_connmark_target_info *markinfo = cb->data;
|
||||
@@ -253,6 +310,23 @@ static void connmark_tg_parse(struct xt_
|
||||
info->ctmark = cb->val.u32;
|
||||
info->ctmask = 0;
|
||||
break;
|
||||
+ case O_DSCP_MARK:
|
||||
+/* we sneaky sneaky this. nfmask isn't used by the set mark functionality
|
||||
+ * and by default is set to uint32max. We can use the top bit as a flag
|
||||
+ * that we're in DSCP_MARK submode of SET_MARK, if set then it's normal
|
||||
+ * if unset then we're in DSCP_MARK
|
||||
+ */
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->ctmark = cb->val.mark;
|
||||
+ info->ctmask = cb->val.mask;
|
||||
+ info->nfmask = info->ctmark ? ffs(info->ctmark) - 1 : 0;
|
||||
+ /* need 6 contiguous bits */
|
||||
+ if ((~0 & (info->ctmark >> info->nfmask)) != 0x3f)
|
||||
+ xtables_error(PARAMETER_PROBLEM,
|
||||
+ "CONNMARK set-dscpmark: need 6 contiguous dscpmask bits");
|
||||
+ if (info->ctmark & info->ctmask)
|
||||
+ xtables_error(PARAMETER_PROBLEM,
|
||||
+ "CONNMARK set-dscpmark: dscpmask/statemask bits overlap");
|
||||
case O_SAVE_MARK:
|
||||
info->mode = XT_CONNMARK_SAVE;
|
||||
break;
|
||||
@@ -320,6 +394,78 @@ static void connmark_tg_parse_v2(struct
|
||||
}
|
||||
}
|
||||
|
||||
+static void connmark_tg_parse_v3(struct xt_option_call *cb)
|
||||
+{
|
||||
+ struct xt_connmark_tginfo3 *info = cb->data;
|
||||
+
|
||||
+ xtables_option_parse(cb);
|
||||
+ switch (cb->entry->id) {
|
||||
+ case O_SET_XMARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_VALUE;
|
||||
+ info->ctmark = cb->val.mark;
|
||||
+ info->ctmask = cb->val.mask;
|
||||
+ break;
|
||||
+ case O_SET_MARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_VALUE;
|
||||
+ info->ctmark = cb->val.mark;
|
||||
+ info->ctmask = cb->val.mark | cb->val.mask;
|
||||
+ break;
|
||||
+ case O_AND_MARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_VALUE;
|
||||
+ info->ctmark = 0;
|
||||
+ info->ctmask = ~cb->val.u32;
|
||||
+ break;
|
||||
+ case O_OR_MARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_VALUE;
|
||||
+ info->ctmark = cb->val.u32;
|
||||
+ info->ctmask = cb->val.u32;
|
||||
+ break;
|
||||
+ case O_XOR_MARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_VALUE;
|
||||
+ info->ctmark = cb->val.u32;
|
||||
+ info->ctmask = 0;
|
||||
+ break;
|
||||
+ case O_DSCP_MARK:
|
||||
+ info->mode = XT_CONNMARK_SET;
|
||||
+ info->func = XT_CONNMARK_DSCP;
|
||||
+ info->ctmark = cb->val.mark;
|
||||
+ info->ctmask = cb->val.mask;
|
||||
+ info->shift_bits = info->ctmark ? ffs(info->ctmark) - 1 : 0;
|
||||
+ /* need 6 contiguous bits */
|
||||
+ if ((~0 & (info->ctmark >> info->shift_bits)) != 0x3f)
|
||||
+ xtables_error(PARAMETER_PROBLEM,
|
||||
+ "CONNMARK set-dscpmark: need 6 contiguous dscpmask bits");
|
||||
+ if (info->ctmark & info->ctmask)
|
||||
+ xtables_error(PARAMETER_PROBLEM,
|
||||
+ "CONNMARK set-dscpmark: dscpmask/statemask bits overlap");
|
||||
+ break;
|
||||
+ case O_SAVE_MARK:
|
||||
+ info->mode = XT_CONNMARK_SAVE;
|
||||
+ break;
|
||||
+ case O_RESTORE_MARK:
|
||||
+ info->mode = XT_CONNMARK_RESTORE;
|
||||
+ break;
|
||||
+ case O_MASK:
|
||||
+ info->nfmask = info->ctmask = cb->val.u32;
|
||||
+ break;
|
||||
+ case O_LEFT_SHIFT_MARK:
|
||||
+ info->shift_dir = D_SHIFT_LEFT;
|
||||
+ info->shift_bits = cb->val.u8;
|
||||
+ break;
|
||||
+ case O_RIGHT_SHIFT_MARK:
|
||||
+ info->shift_dir = D_SHIFT_RIGHT;
|
||||
+ info->shift_bits = cb->val.u8;
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void connmark_tg_check(struct xt_fcheck_call *cb)
|
||||
{
|
||||
if (!(cb->xflags & F_OP_ANY))
|
||||
@@ -463,6 +609,65 @@ connmark_tg_print_v2(const void *ip, con
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+connmark_tg_print_v3(const void *ip, const struct xt_entry_target *target,
|
||||
+ int numeric)
|
||||
+{
|
||||
+ const struct xt_connmark_tginfo3 *info = (const void *)target->data;
|
||||
+ const char *shift_op = xt_connmark_shift_ops[info->shift_dir];
|
||||
+
|
||||
+ switch (info->mode) {
|
||||
+ case XT_CONNMARK_SET:
|
||||
+ if (info->func & XT_CONNMARK_DSCP) {
|
||||
+ printf(" CONNMARK DSCP 0x%x/0x%x",
|
||||
+ info->ctmark, info->ctmask);
|
||||
+ }
|
||||
+ if (info->func & XT_CONNMARK_VALUE) {
|
||||
+ if (info->ctmark == 0)
|
||||
+ printf(" CONNMARK and 0x%x",
|
||||
+ (unsigned int)(uint32_t)~info->ctmask);
|
||||
+ else if (info->ctmark == info->ctmask)
|
||||
+ printf(" CONNMARK or 0x%x", info->ctmark);
|
||||
+ else if (info->ctmask == 0)
|
||||
+ printf(" CONNMARK xor 0x%x", info->ctmark);
|
||||
+ else if (info->ctmask == 0xFFFFFFFFU)
|
||||
+ printf(" CONNMARK set 0x%x", info->ctmark);
|
||||
+ else
|
||||
+ printf(" CONNMARK xset 0x%x/0x%x",
|
||||
+ info->ctmark, info->ctmask);
|
||||
+ }
|
||||
+ break;
|
||||
+ case XT_CONNMARK_SAVE:
|
||||
+ if (info->nfmask == UINT32_MAX && info->ctmask == UINT32_MAX)
|
||||
+ printf(" CONNMARK save");
|
||||
+ else if (info->nfmask == info->ctmask)
|
||||
+ printf(" CONNMARK save mask 0x%x", info->nfmask);
|
||||
+ else
|
||||
+ printf(" CONNMARK save nfmask 0x%x ctmask ~0x%x",
|
||||
+ info->nfmask, info->ctmask);
|
||||
+ break;
|
||||
+ case XT_CONNMARK_RESTORE:
|
||||
+ if (info->ctmask == UINT32_MAX && info->nfmask == UINT32_MAX)
|
||||
+ printf(" CONNMARK restore");
|
||||
+ else if (info->ctmask == info->nfmask)
|
||||
+ printf(" CONNMARK restore mask 0x%x", info->ctmask);
|
||||
+ else
|
||||
+ printf(" CONNMARK restore ctmask 0x%x nfmask ~0x%x",
|
||||
+ info->ctmask, info->nfmask);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ printf(" ERROR: UNKNOWN CONNMARK MODE");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (info->mode <= XT_CONNMARK_RESTORE &&
|
||||
+ !(info->mode == XT_CONNMARK_SET && info->func == XT_CONNMARK_DSCP) &&
|
||||
+ info->shift_bits != 0) {
|
||||
+ printf(" %s %u", shift_op, info->shift_bits);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void CONNMARK_save(const void *ip, const struct xt_entry_target *target)
|
||||
{
|
||||
const struct xt_connmark_target_info *markinfo =
|
||||
@@ -548,6 +753,38 @@ connmark_tg_save_v2(const void *ip, cons
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+connmark_tg_save_v3(const void *ip, const struct xt_entry_target *target)
|
||||
+{
|
||||
+ const struct xt_connmark_tginfo3 *info = (const void *)target->data;
|
||||
+ const char *shift_op = xt_connmark_shift_ops[info->shift_dir];
|
||||
+
|
||||
+ switch (info->mode) {
|
||||
+ case XT_CONNMARK_SET:
|
||||
+ if (info->func & XT_CONNMARK_VALUE)
|
||||
+ printf(" --set-xmark 0x%x/0x%x", info->ctmark, info->ctmask);
|
||||
+ if (info->func & XT_CONNMARK_DSCP)
|
||||
+ printf(" --set-dscpmark 0x%x/0x%x", info->ctmark, info->ctmask);
|
||||
+ break;
|
||||
+ case XT_CONNMARK_SAVE:
|
||||
+ printf(" --save-mark --nfmask 0x%x --ctmask 0x%x",
|
||||
+ info->nfmask, info->ctmask);
|
||||
+ break;
|
||||
+ case XT_CONNMARK_RESTORE:
|
||||
+ printf(" --restore-mark --nfmask 0x%x --ctmask 0x%x",
|
||||
+ info->nfmask, info->ctmask);
|
||||
+ break;
|
||||
+ default:
|
||||
+ printf(" ERROR: UNKNOWN CONNMARK MODE");
|
||||
+ break;
|
||||
+ }
|
||||
+ if (info->mode <= XT_CONNMARK_RESTORE &&
|
||||
+ !(info->mode == XT_CONNMARK_SET && info->func == XT_CONNMARK_DSCP) &&
|
||||
+ info->shift_bits != 0) {
|
||||
+ printf(" --%s %u", shift_op, info->shift_bits);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int connmark_tg_xlate(struct xt_xlate *xl,
|
||||
const struct xt_xlate_tg_params *params)
|
||||
{
|
||||
@@ -639,6 +876,66 @@ static int connmark_tg_xlate_v2(struct x
|
||||
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+static int connmark_tg_xlate_v3(struct xt_xlate *xl,
|
||||
+ const struct xt_xlate_tg_params *params)
|
||||
+{
|
||||
+ const struct xt_connmark_tginfo3 *info =
|
||||
+ (const void *)params->target->data;
|
||||
+ const char *shift_op = xt_connmark_shift_ops[info->shift_dir];
|
||||
+
|
||||
+ switch (info->mode) {
|
||||
+ case XT_CONNMARK_SET:
|
||||
+ xt_xlate_add(xl, "ct mark set ");
|
||||
+ if (info->func & XT_CONNMARK_VALUE) {
|
||||
+ if (info->ctmask == 0xFFFFFFFFU)
|
||||
+ xt_xlate_add(xl, "0x%x ", info->ctmark);
|
||||
+ else if (info->ctmark == 0)
|
||||
+ xt_xlate_add(xl, "ct mark and 0x%x", ~info->ctmask);
|
||||
+ else if (info->ctmark == info->ctmask)
|
||||
+ xt_xlate_add(xl, "ct mark or 0x%x",
|
||||
+ info->ctmark);
|
||||
+ else if (info->ctmask == 0)
|
||||
+ xt_xlate_add(xl, "ct mark xor 0x%x",
|
||||
+ info->ctmark);
|
||||
+ else
|
||||
+ xt_xlate_add(xl, "ct mark xor 0x%x and 0x%x",
|
||||
+ info->ctmark, ~info->ctmask);
|
||||
+ }
|
||||
+ if (info->func & XT_CONNMARK_DSCP) {
|
||||
+/* FIXME the nftables syntax would go here if only we knew what it was */
|
||||
+ xt_xlate_add(xl, "ct mark set typeof(ct mark) ip dscp "
|
||||
+ "<< %u or 0x%x", info->shift_bits,
|
||||
+ info->ctmask);
|
||||
+ }
|
||||
+ break;
|
||||
+ case XT_CONNMARK_SAVE:
|
||||
+ xt_xlate_add(xl, "ct mark set mark");
|
||||
+ if (!(info->nfmask == UINT32_MAX &&
|
||||
+ info->ctmask == UINT32_MAX)) {
|
||||
+ if (info->nfmask == info->ctmask)
|
||||
+ xt_xlate_add(xl, " and 0x%x", info->nfmask);
|
||||
+ }
|
||||
+ break;
|
||||
+ case XT_CONNMARK_RESTORE:
|
||||
+ xt_xlate_add(xl, "meta mark set ct mark");
|
||||
+ if (!(info->nfmask == UINT32_MAX &&
|
||||
+ info->ctmask == UINT32_MAX)) {
|
||||
+ if (info->nfmask == info->ctmask)
|
||||
+ xt_xlate_add(xl, " and 0x%x", info->nfmask);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (info->mode <= XT_CONNMARK_RESTORE &&
|
||||
+ !(info->mode == XT_CONNMARK_SET && info->func == XT_CONNMARK_DSCP) &&
|
||||
+ info->shift_bits != 0) {
|
||||
+ xt_xlate_add(xl, " %s %u", shift_op, info->shift_bits);
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static struct xtables_target connmark_tg_reg[] = {
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
@@ -687,6 +984,22 @@ static struct xtables_target connmark_tg
|
||||
.x6_options = connmark_tg_opts_v2,
|
||||
.xlate = connmark_tg_xlate_v2,
|
||||
},
|
||||
+ {
|
||||
+ .version = XTABLES_VERSION,
|
||||
+ .name = "CONNMARK",
|
||||
+ .revision = 3,
|
||||
+ .family = NFPROTO_UNSPEC,
|
||||
+ .size = XT_ALIGN(sizeof(struct xt_connmark_tginfo3)),
|
||||
+ .userspacesize = XT_ALIGN(sizeof(struct xt_connmark_tginfo3)),
|
||||
+ .help = connmark_tg_help_v3,
|
||||
+ .init = connmark_tg_init_v3,
|
||||
+ .print = connmark_tg_print_v3,
|
||||
+ .save = connmark_tg_save_v3,
|
||||
+ .x6_parse = connmark_tg_parse_v3,
|
||||
+ .x6_fcheck = connmark_tg_check,
|
||||
+ .x6_options = connmark_tg_opts_v3,
|
||||
+ .xlate = connmark_tg_xlate_v3,
|
||||
+ },
|
||||
};
|
||||
|
||||
void _init(void)
|
||||
--- a/include/linux/netfilter/xt_connmark.h
|
||||
+++ b/include/linux/netfilter/xt_connmark.h
|
||||
@@ -18,6 +18,11 @@ enum {
|
||||
XT_CONNMARK_RESTORE
|
||||
};
|
||||
|
||||
+enum {
|
||||
+ XT_CONNMARK_VALUE = (1 << 0),
|
||||
+ XT_CONNMARK_DSCP = (1 << 1)
|
||||
+};
|
||||
+
|
||||
struct xt_connmark_tginfo1 {
|
||||
__u32 ctmark, ctmask, nfmask;
|
||||
__u8 mode;
|
||||
@@ -28,6 +33,11 @@ struct xt_connmark_tginfo2 {
|
||||
__u8 shift_dir, shift_bits, mode;
|
||||
};
|
||||
|
||||
+struct xt_connmark_tginfo3 {
|
||||
+ __u32 ctmark, ctmask, nfmask;
|
||||
+ __u8 shift_dir, shift_bits, mode, func;
|
||||
+};
|
||||
+
|
||||
struct xt_connmark_mtinfo1 {
|
||||
__u32 mark, mask;
|
||||
__u8 invert;
|
||||
@@ -0,0 +1,144 @@
|
||||
From f319389525b066b7dc6d389c88f16a0df3b8f189 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Hainke <vincent@systemli.org>
|
||||
Date: Mon, 16 May 2022 18:16:41 +0200
|
||||
Subject: treewide: use uint* instead of u_int*
|
||||
|
||||
Gcc complains about missing types. Some commits introduced u_int* instead
|
||||
of uint*. Use uint treewide.
|
||||
|
||||
Fixes errors in the form of:
|
||||
In file included from xtables-legacy-multi.c:5:
|
||||
xshared.h:83:56: error: unknown type name 'u_int16_t'; did you mean 'uint16_t'?
|
||||
83 | set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
|
||||
| ^~~~~~~~~
|
||||
| uint16_t
|
||||
make[6]: *** [Makefile:712: xtables_legacy_multi-xtables-legacy-multi.o] Error 1
|
||||
|
||||
Avoid libipq API breakage by adjusting libipq.h include accordingly. For
|
||||
arpt_mangle.h kernel uAPI header, apply same change as in kernel commit
|
||||
e91ded8db5747 ("uapi: netfilter_arp: use __u8 instead of u_int8_t").
|
||||
|
||||
Signed-off-by: Nick Hainke <vincent@systemli.org>
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
---
|
||||
extensions/libxt_conntrack.c | 2 +-
|
||||
include/libipq/libipq.h | 8 ++++----
|
||||
include/libiptc/libxtc.h | 2 +-
|
||||
include/linux/netfilter_arp/arpt_mangle.h | 2 +-
|
||||
iptables/xshared.c | 2 +-
|
||||
iptables/xshared.h | 2 +-
|
||||
libipq/ipq_create_handle.3 | 2 +-
|
||||
libipq/ipq_set_mode.3 | 2 +-
|
||||
8 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/extensions/libxt_conntrack.c
|
||||
+++ b/extensions/libxt_conntrack.c
|
||||
@@ -778,7 +778,7 @@ matchinfo_print(const void *ip, const st
|
||||
|
||||
static void
|
||||
conntrack_dump_ports(const char *prefix, const char *opt,
|
||||
- u_int16_t port_low, u_int16_t port_high)
|
||||
+ uint16_t port_low, uint16_t port_high)
|
||||
{
|
||||
if (port_high == 0 || port_low == port_high)
|
||||
printf(" %s%s %u", prefix, opt, port_low);
|
||||
--- a/include/libipq/libipq.h
|
||||
+++ b/include/libipq/libipq.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
-#include <sys/types.h>
|
||||
+#include <stdint.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
#include <asm/types.h>
|
||||
@@ -48,19 +48,19 @@ typedef unsigned long ipq_id_t;
|
||||
struct ipq_handle
|
||||
{
|
||||
int fd;
|
||||
- u_int8_t blocking;
|
||||
+ uint8_t blocking;
|
||||
struct sockaddr_nl local;
|
||||
struct sockaddr_nl peer;
|
||||
};
|
||||
|
||||
-struct ipq_handle *ipq_create_handle(u_int32_t flags, u_int32_t protocol);
|
||||
+struct ipq_handle *ipq_create_handle(uint32_t flags, uint32_t protocol);
|
||||
|
||||
int ipq_destroy_handle(struct ipq_handle *h);
|
||||
|
||||
ssize_t ipq_read(const struct ipq_handle *h,
|
||||
unsigned char *buf, size_t len, int timeout);
|
||||
|
||||
-int ipq_set_mode(const struct ipq_handle *h, u_int8_t mode, size_t len);
|
||||
+int ipq_set_mode(const struct ipq_handle *h, uint8_t mode, size_t len);
|
||||
|
||||
ipq_packet_msg_t *ipq_get_packet(const unsigned char *buf);
|
||||
|
||||
--- a/include/libiptc/libxtc.h
|
||||
+++ b/include/libiptc/libxtc.h
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef XT_MIN_ALIGN
|
||||
-/* xt_entry has pointers and u_int64_t's in it, so if you align to
|
||||
+/* xt_entry has pointers and uint64_t's in it, so if you align to
|
||||
it, you'll also align to any crazy matches and targets someone
|
||||
might write */
|
||||
#define XT_MIN_ALIGN (__alignof__(struct xt_entry))
|
||||
--- a/include/linux/netfilter_arp/arpt_mangle.h
|
||||
+++ b/include/linux/netfilter_arp/arpt_mangle.h
|
||||
@@ -13,7 +13,7 @@ struct arpt_mangle
|
||||
union {
|
||||
struct in_addr tgt_ip;
|
||||
} u_t;
|
||||
- u_int8_t flags;
|
||||
+ __u8 flags;
|
||||
int target;
|
||||
};
|
||||
|
||||
--- a/iptables/xshared.c
|
||||
+++ b/iptables/xshared.c
|
||||
@@ -1025,7 +1025,7 @@ static const int inverse_for_options[NUM
|
||||
};
|
||||
|
||||
void
|
||||
-set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
|
||||
+set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
|
||||
bool invert)
|
||||
{
|
||||
if (*options & option)
|
||||
--- a/iptables/xshared.h
|
||||
+++ b/iptables/xshared.h
|
||||
@@ -80,7 +80,7 @@ struct xtables_target;
|
||||
#define IPT_INV_ARPHRD 0x0800
|
||||
|
||||
void
|
||||
-set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
|
||||
+set_option(unsigned int *options, unsigned int option, uint16_t *invflg,
|
||||
bool invert);
|
||||
|
||||
/**
|
||||
--- a/libipq/ipq_create_handle.3
|
||||
+++ b/libipq/ipq_create_handle.3
|
||||
@@ -24,7 +24,7 @@ ipq_create_handle, ipq_destroy_handle \(
|
||||
.br
|
||||
.B #include <libipq.h>
|
||||
.sp
|
||||
-.BI "struct ipq_handle *ipq_create_handle(u_int32_t " flags ", u_int32_t " protocol ");"
|
||||
+.BI "struct ipq_handle *ipq_create_handle(uint32_t " flags ", uint32_t " protocol ");"
|
||||
.br
|
||||
.BI "int ipq_destroy_handle(struct ipq_handle *" h );
|
||||
.SH DESCRIPTION
|
||||
--- a/libipq/ipq_set_mode.3
|
||||
+++ b/libipq/ipq_set_mode.3
|
||||
@@ -24,7 +24,7 @@ ipq_set_mode \(em set the ip_queue queui
|
||||
.br
|
||||
.B #include <libipq.h>
|
||||
.sp
|
||||
-.BI "int ipq_set_mode(const struct ipq_handle *" h ", u_int8_t " mode ", size_t " range );
|
||||
+.BI "int ipq_set_mode(const struct ipq_handle *" h ", uint8_t " mode ", size_t " range );
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B ipq_set_mode
|
||||
@@ -0,0 +1,60 @@
|
||||
From 0e7cf0ad306cdf95dc3c28d15a254532206a888e Mon Sep 17 00:00:00 2001
|
||||
From: Phil Sutter <phil@nwl.cc>
|
||||
Date: Wed, 18 May 2022 16:04:09 +0200
|
||||
Subject: Revert "fix build for missing ETH_ALEN definition"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit c5d9a723b5159a28f547b577711787295a14fd84 as it broke
|
||||
compiling against musl libc. Might be a bug in the latter, but for the
|
||||
time being try to please both by avoiding the include and instead
|
||||
defining ETH_ALEN if unset.
|
||||
|
||||
While being at it, move netinet/ether.h include up.
|
||||
|
||||
Fixes: 1bdb5535f561a ("libxtables: Extend MAC address printing/parsing support")
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
Reviewed-by: Maciej Żenczykowski <maze@google.com>
|
||||
---
|
||||
libxtables/xtables.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/libxtables/xtables.c
|
||||
+++ b/libxtables/xtables.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
+#include <netinet/ether.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
@@ -45,7 +46,6 @@
|
||||
|
||||
#include <xtables.h>
|
||||
#include <limits.h> /* INT_MAX in ip_tables.h/ip6_tables.h */
|
||||
-#include <linux/if_ether.h> /* ETH_ALEN */
|
||||
#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
#include <libiptc/libxtc.h>
|
||||
@@ -72,6 +72,10 @@
|
||||
#define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe"
|
||||
#endif
|
||||
|
||||
+#ifndef ETH_ALEN
|
||||
+#define ETH_ALEN 6
|
||||
+#endif
|
||||
+
|
||||
/* we need this for ip6?tables-restore. ip6?tables-restore.c sets line to the
|
||||
* current line of the input file, in order to give a more precise error
|
||||
* message. ip6?tables itself doesn't need this, so it is initialized to the
|
||||
@@ -2245,8 +2249,6 @@ void xtables_print_num(uint64_t number,
|
||||
printf(FMT("%4lluT ","%lluT "), (unsigned long long)number);
|
||||
}
|
||||
|
||||
-#include <netinet/ether.h>
|
||||
-
|
||||
static const unsigned char mac_type_unicast[ETH_ALEN] = {};
|
||||
static const unsigned char msk_type_unicast[ETH_ALEN] = {1};
|
||||
static const unsigned char mac_type_multicast[ETH_ALEN] = {1};
|
||||
@@ -0,0 +1,23 @@
|
||||
From b72eb12ea5a61df0655ad99d5048994e916be83a Mon Sep 17 00:00:00 2001
|
||||
From: Phil Sutter <phil@nwl.cc>
|
||||
Date: Fri, 13 May 2022 16:51:58 +0200
|
||||
Subject: [PATCH] xshared: Fix build for -Werror=format-security
|
||||
|
||||
Gcc complains about the omitted format string.
|
||||
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
---
|
||||
iptables/xshared.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/iptables/xshared.c
|
||||
+++ b/iptables/xshared.c
|
||||
@@ -1307,7 +1307,7 @@ static void check_empty_interface(struct
|
||||
return;
|
||||
|
||||
if (args->family != NFPROTO_ARP)
|
||||
- xtables_error(PARAMETER_PROBLEM, msg);
|
||||
+ xtables_error(PARAMETER_PROBLEM, "%s", msg);
|
||||
|
||||
fprintf(stderr, "%s", msg);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0ebf52fc951b2a4d98a166afb34af4f364bbeece Mon Sep 17 00:00:00 2001
|
||||
From: Ben Brown <ben@demerara.io>
|
||||
Date: Wed, 25 May 2022 16:26:13 +0100
|
||||
Subject: build: Fix error during out of tree build
|
||||
|
||||
Fixes the following error:
|
||||
|
||||
../../libxtables/xtables.c:52:10: fatal error: libiptc/linux_list.h: No such file or directory
|
||||
52 | #include <libiptc/linux_list.h>
|
||||
|
||||
Fixes: f58b0d7406451 ("libxtables: Implement notargets hash table")
|
||||
Signed-off-by: Ben Brown <ben@demerara.io>
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
---
|
||||
libxtables/Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/libxtables/Makefile.am
|
||||
+++ b/libxtables/Makefile.am
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- Makefile -*-
|
||||
|
||||
AM_CFLAGS = ${regular_CFLAGS}
|
||||
-AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir}/iptables ${kinclude_CPPFLAGS}
|
||||
+AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir}/iptables -I${top_srcdir} ${kinclude_CPPFLAGS}
|
||||
|
||||
lib_LTLIBRARIES = libxtables.la
|
||||
libxtables_la_SOURCES = xtables.c xtoptions.c getethertype.c
|
||||
@@ -0,0 +1,82 @@
|
||||
From ef108943f69a6e20533d58823740d3f0534ea8ec Mon Sep 17 00:00:00 2001
|
||||
From: Phil Sutter <phil@nwl.cc>
|
||||
Date: Wed, 1 Jun 2022 19:15:06 +0200
|
||||
Subject: libxtables: Unexport init_extensions*() declarations
|
||||
|
||||
The functions are used for static builds to initialize extensions after
|
||||
libxtables init. Regular library users should not need them, but the
|
||||
empty declarations introduced in #else case (and therefore present in
|
||||
user's env) may clash with existing symbol names.
|
||||
|
||||
Avoid problems and guard the whole block declaring the function
|
||||
prototypes and mangling extensions' _init functions by XTABLES_INTERNAL.
|
||||
|
||||
Reported-by: Nick Hainke <vincent@systemli.org>
|
||||
Fixes: 6c689b639cf8e ("Simplify static build extension loading")
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
---
|
||||
include/xtables.h | 44 ++++++++++++++++++++++----------------------
|
||||
1 file changed, 22 insertions(+), 22 deletions(-)
|
||||
|
||||
--- a/include/xtables.h
|
||||
+++ b/include/xtables.h
|
||||
@@ -585,27 +585,6 @@ static inline void xtables_print_mark_ma
|
||||
xtables_print_val_mask(mark, mask, NULL);
|
||||
}
|
||||
|
||||
-#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
|
||||
-# ifdef _INIT
|
||||
-# undef _init
|
||||
-# define _init _INIT
|
||||
-# endif
|
||||
- extern void init_extensions(void);
|
||||
- extern void init_extensions4(void);
|
||||
- extern void init_extensions6(void);
|
||||
- extern void init_extensionsa(void);
|
||||
- extern void init_extensionsb(void);
|
||||
-#else
|
||||
-# define _init __attribute__((constructor)) _INIT
|
||||
-# define EMPTY_FUNC_DEF(x) static inline void x(void) {}
|
||||
- EMPTY_FUNC_DEF(init_extensions)
|
||||
- EMPTY_FUNC_DEF(init_extensions4)
|
||||
- EMPTY_FUNC_DEF(init_extensions6)
|
||||
- EMPTY_FUNC_DEF(init_extensionsa)
|
||||
- EMPTY_FUNC_DEF(init_extensionsb)
|
||||
-# undef EMPTY_FUNC_DEF
|
||||
-#endif
|
||||
-
|
||||
extern const struct xtables_pprot xtables_chain_protos[];
|
||||
extern uint16_t xtables_parse_protocol(const char *s);
|
||||
|
||||
@@ -663,9 +642,30 @@ void xtables_announce_chain(const char *
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||
# endif
|
||||
|
||||
+#if defined(ALL_INCLUSIVE) || defined(NO_SHARED_LIBS)
|
||||
+# ifdef _INIT
|
||||
+# undef _init
|
||||
+# define _init _INIT
|
||||
+# endif
|
||||
+ extern void init_extensions(void);
|
||||
+ extern void init_extensions4(void);
|
||||
+ extern void init_extensions6(void);
|
||||
+ extern void init_extensionsa(void);
|
||||
+ extern void init_extensionsb(void);
|
||||
+#else
|
||||
+# define _init __attribute__((constructor)) _INIT
|
||||
+# define EMPTY_FUNC_DEF(x) static inline void x(void) {}
|
||||
+ EMPTY_FUNC_DEF(init_extensions)
|
||||
+ EMPTY_FUNC_DEF(init_extensions4)
|
||||
+ EMPTY_FUNC_DEF(init_extensions6)
|
||||
+ EMPTY_FUNC_DEF(init_extensionsa)
|
||||
+ EMPTY_FUNC_DEF(init_extensionsb)
|
||||
+# undef EMPTY_FUNC_DEF
|
||||
+#endif
|
||||
+
|
||||
extern void _init(void);
|
||||
|
||||
-#endif
|
||||
+#endif /* XTABLES_INTERNAL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
@@ -0,0 +1,40 @@
|
||||
From da5b32fb4656ab69fe1156eb7e36c7c961839e8a Mon Sep 17 00:00:00 2001
|
||||
From: Phil Sutter <phil@nwl.cc>
|
||||
Date: Wed, 8 Jun 2022 13:45:13 +0200
|
||||
Subject: [PATCH] extensions: string: Review parse_string() function
|
||||
|
||||
* Compare against sizeof(info->pattern) which is more clear than having
|
||||
to know that this buffer is of size XT_STRING_MAX_PATTERN_SIZE
|
||||
|
||||
* Invert the check and error early to reduce indenting
|
||||
|
||||
* Pass info->patlen to memcpy() to avoid reading past end of 's'
|
||||
|
||||
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
||||
---
|
||||
extensions/libxt_string.c | 13 ++++++-------
|
||||
1 file changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/extensions/libxt_string.c
|
||||
+++ b/extensions/libxt_string.c
|
||||
@@ -78,14 +78,13 @@ static void string_init(struct xt_entry_
|
||||
|
||||
static void
|
||||
parse_string(const char *s, struct xt_string_info *info)
|
||||
-{
|
||||
+{
|
||||
/* xt_string does not need \0 at the end of the pattern */
|
||||
- if (strlen(s) <= XT_STRING_MAX_PATTERN_SIZE) {
|
||||
- memcpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE);
|
||||
- info->patlen = strnlen(s, XT_STRING_MAX_PATTERN_SIZE);
|
||||
- return;
|
||||
- }
|
||||
- xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s);
|
||||
+ if (strlen(s) > sizeof(info->pattern))
|
||||
+ xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s);
|
||||
+
|
||||
+ info->patlen = strnlen(s, sizeof(info->pattern));
|
||||
+ memcpy(info->pattern, s, info->patlen);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -0,0 +1,28 @@
|
||||
--- a/libxtables/xtables.c
|
||||
+++ b/libxtables/xtables.c
|
||||
@@ -1093,12 +1093,6 @@ void xtables_register_match(struct xtabl
|
||||
struct xtables_match **pos;
|
||||
bool seen_myself = false;
|
||||
|
||||
- if (me->next) {
|
||||
- fprintf(stderr, "%s: match \"%s\" already registered\n",
|
||||
- xt_params->program_name, me->name);
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
if (me->version == NULL) {
|
||||
fprintf(stderr, "%s: match %s<%u> is missing a version\n",
|
||||
xt_params->program_name, me->name, me->revision);
|
||||
@@ -1277,12 +1271,6 @@ void xtables_register_target(struct xtab
|
||||
struct xtables_target **pos;
|
||||
bool seen_myself = false;
|
||||
|
||||
- if (me->next) {
|
||||
- fprintf(stderr, "%s: target \"%s\" already registered\n",
|
||||
- xt_params->program_name, me->name);
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
if (me->version == NULL) {
|
||||
fprintf(stderr, "%s: target %s<%u> is missing a version\n",
|
||||
xt_params->program_name, me->name, me->revision);
|
||||
@@ -0,0 +1,27 @@
|
||||
--- a/libxtables/xtables.c
|
||||
+++ b/libxtables/xtables.c
|
||||
@@ -476,7 +476,7 @@ char *xtables_strdup(const char *s)
|
||||
return dup;
|
||||
}
|
||||
|
||||
-static char *get_modprobe(void)
|
||||
+__attribute__((unused)) static char *get_modprobe(void)
|
||||
{
|
||||
int procfile;
|
||||
char *ret;
|
||||
@@ -511,6 +511,7 @@ static char *get_modprobe(void)
|
||||
|
||||
int xtables_insmod(const char *modname, const char *modprobe, bool quiet)
|
||||
{
|
||||
+#if 0
|
||||
char *buf = NULL;
|
||||
char *argv[4];
|
||||
int status;
|
||||
@@ -545,6 +546,7 @@ int xtables_insmod(const char *modname,
|
||||
free(buf);
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
|
||||
return 0;
|
||||
+#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/iptables/xtables-legacy-multi.c
|
||||
+++ b/iptables/xtables-legacy-multi.c
|
||||
@@ -32,8 +32,10 @@ static const struct subcommand multi_sub
|
||||
|
||||
|
||||
#endif
|
||||
+#ifdef ENABLE_XML
|
||||
{"iptables-xml", iptables_xml_main},
|
||||
{"xml", iptables_xml_main},
|
||||
+#endif
|
||||
#ifdef ENABLE_IPV6
|
||||
{"ip6tables", ip6tables_main},
|
||||
{"main6", ip6tables_main},
|
||||
@@ -0,0 +1,79 @@
|
||||
--- a/extensions/GNUmakefile.in
|
||||
+++ b/extensions/GNUmakefile.in
|
||||
@@ -50,11 +50,31 @@ pfb_build_mod := $(filter-out @blacklist
|
||||
pfa_build_mod := $(filter-out @blacklist_modules@ @blacklist_a_modules@,${pfa_build_mod})
|
||||
pf4_build_mod := $(filter-out @blacklist_modules@ @blacklist_4_modules@,${pf4_build_mod})
|
||||
pf6_build_mod := $(filter-out @blacklist_modules@ @blacklist_6_modules@,${pf6_build_mod})
|
||||
-pfx_objs := $(patsubst %,libxt_%.o,${pfx_build_mod})
|
||||
-pfb_objs := $(patsubst %,libebt_%.o,${pfb_build_mod})
|
||||
-pfa_objs := $(patsubst %,libarpt_%.o,${pfa_build_mod})
|
||||
-pf4_objs := $(patsubst %,libipt_%.o,${pf4_build_mod})
|
||||
-pf6_objs := $(patsubst %,libip6t_%.o,${pf6_build_mod})
|
||||
+ifdef BUILTIN_MODULES
|
||||
+pfx_build_static := $(filter $(BUILTIN_MODULES),${pfx_build_mod})
|
||||
+pfb_build_static := $(filter $(BUILTIN_MODULES),${pfb_build_mod})
|
||||
+pfa_build_static := $(filter $(BUILTIN_MODULES),${pfa_build_mod})
|
||||
+pf4_build_static := $(filter $(BUILTIN_MODULES),${pf4_build_mod})
|
||||
+pf6_build_static := $(filter $(BUILTIN_MODULES),${pf6_build_mod})
|
||||
+else
|
||||
+@ENABLE_STATIC_TRUE@ pfx_build_static := $(pfx_build_mod)
|
||||
+@ENABLE_STATIC_TRUE@ pfb_build_static := $(pfb_build_mod)
|
||||
+@ENABLE_STATIC_TRUE@ pfa_build_static := $(pfa_build_mod)
|
||||
+@ENABLE_STATIC_TRUE@ pf4_build_static := $(pf4_build_mod)
|
||||
+@ENABLE_STATIC_TRUE@ pf6_build_static := $(pf6_build_mod)
|
||||
+endif
|
||||
+
|
||||
+pfx_build_mod := $(filter-out $(pfx_build_static),$(pfx_build_mod))
|
||||
+pfb_build_mod := $(filter-out $(pfb_build_static),$(pfb_build_mod))
|
||||
+pfa_build_mod := $(filter-out $(pfa_build_static),$(pfa_build_mod))
|
||||
+pf4_build_mod := $(filter-out $(pf4_build_static),$(pf4_build_mod))
|
||||
+pf6_build_mod := $(filter-out $(pf6_build_static),$(pf6_build_mod))
|
||||
+
|
||||
+pfx_objs := $(patsubst %,libxt_%.o,${pfx_build_static})
|
||||
+pfb_objs := $(patsubst %,libebt_%.o,${pfb_build_static})
|
||||
+pfa_objs := $(patsubst %,libarpt_%.o,${pfa_build_static})
|
||||
+pf4_objs := $(patsubst %,libipt_%.o,${pf4_build_static})
|
||||
+pf6_objs := $(patsubst %,libip6t_%.o,${pf6_build_static})
|
||||
pfx_solibs := $(patsubst %,libxt_%.so,${pfx_build_mod})
|
||||
pfb_solibs := $(patsubst %,libebt_%.so,${pfb_build_mod})
|
||||
pfa_solibs := $(patsubst %,libarpt_%.so,${pfa_build_mod})
|
||||
@@ -68,14 +88,14 @@ pfx_symlink_files := $(patsubst %,libxt_
|
||||
#
|
||||
targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
|
||||
targets_install :=
|
||||
-@ENABLE_STATIC_TRUE@ libext_objs := ${pfx_objs}
|
||||
-@ENABLE_STATIC_TRUE@ libext_ebt_objs := ${pfb_objs}
|
||||
-@ENABLE_STATIC_TRUE@ libext_arpt_objs := ${pfa_objs}
|
||||
-@ENABLE_STATIC_TRUE@ libext4_objs := ${pf4_objs}
|
||||
-@ENABLE_STATIC_TRUE@ libext6_objs := ${pf6_objs}
|
||||
-@ENABLE_STATIC_FALSE@ targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} ${pfx_symlink_files}
|
||||
-@ENABLE_STATIC_FALSE@ targets_install += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs}
|
||||
-@ENABLE_STATIC_FALSE@ symlinks_install := ${pfx_symlink_files}
|
||||
+libext_objs := ${pfx_objs}
|
||||
+libext_ebt_objs := ${pfb_objs}
|
||||
+libext_arpt_objs := ${pfa_objs}
|
||||
+libext4_objs := ${pf4_objs}
|
||||
+libext6_objs := ${pf6_objs}
|
||||
+targets += ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs} ${pfx_symlink_files}
|
||||
+targets_install := $(strip ${pfx_solibs} ${pfb_solibs} ${pf4_solibs} ${pf6_solibs} ${pfa_solibs})
|
||||
+symlinks_install := ${pfx_symlink_files}
|
||||
|
||||
.SECONDARY:
|
||||
|
||||
@@ -163,11 +183,11 @@ libext4.a: initext4.o ${libext4_objs}
|
||||
libext6.a: initext6.o ${libext6_objs}
|
||||
${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
|
||||
-initext_func := $(addprefix xt_,${pfx_build_mod})
|
||||
-initextb_func := $(addprefix ebt_,${pfb_build_mod})
|
||||
-initexta_func := $(addprefix arpt_,${pfa_build_mod})
|
||||
-initext4_func := $(addprefix ipt_,${pf4_build_mod})
|
||||
-initext6_func := $(addprefix ip6t_,${pf6_build_mod})
|
||||
+initext_func := $(addprefix xt_,${pfx_build_static})
|
||||
+initextb_func := $(addprefix ebt_,${pfb_build_static})
|
||||
+initexta_func := $(addprefix arpt_,${pfa_build_static})
|
||||
+initext4_func := $(addprefix ipt_,${pf4_build_static})
|
||||
+initext6_func := $(addprefix ip6t_,${pf6_build_static})
|
||||
|
||||
.initext.dd: FORCE
|
||||
@echo "${initext_func}" >$@.tmp; \
|
||||
102
package/network/utils/iptables/patches/600-shared-libext.patch
Normal file
102
package/network/utils/iptables/patches/600-shared-libext.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
--- a/extensions/GNUmakefile.in
|
||||
+++ b/extensions/GNUmakefile.in
|
||||
@@ -86,7 +86,7 @@ pfx_symlink_files := $(patsubst %,libxt_
|
||||
#
|
||||
# Building blocks
|
||||
#
|
||||
-targets := libext.a libext4.a libext6.a libext_ebt.a libext_arpt.a matches.man targets.man
|
||||
+targets := libiptext.so libiptext4.so libiptext6.so libiptext_ebt.so libiptext_arpt.so matches.man targets.man
|
||||
targets_install :=
|
||||
libext_objs := ${pfx_objs}
|
||||
libext_ebt_objs := ${pfb_objs}
|
||||
@@ -132,7 +132,7 @@ clean:
|
||||
distclean: clean
|
||||
|
||||
init%.o: init%.c
|
||||
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<;
|
||||
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
|
||||
|
||||
-include .*.d
|
||||
|
||||
@@ -166,22 +166,22 @@ xt_connlabel_LIBADD = @libnetfilter_conn
|
||||
# handling code in the Makefiles.
|
||||
#
|
||||
lib%.o: ${srcdir}/lib%.c
|
||||
- ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<;
|
||||
+ ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
|
||||
|
||||
-libext.a: initext.o ${libext_objs}
|
||||
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
+libiptext.so: initext.o ${libext_objs}
|
||||
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
|
||||
|
||||
-libext_ebt.a: initextb.o ${libext_ebt_objs}
|
||||
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
+libiptext_ebt.so: initextb.o ${libext_ebt_objs}
|
||||
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
|
||||
|
||||
-libext_arpt.a: initexta.o ${libext_arpt_objs}
|
||||
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
+libiptext_arpt.so: initexta.o ${libext_arpt_objs}
|
||||
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
|
||||
|
||||
-libext4.a: initext4.o ${libext4_objs}
|
||||
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
+libiptext4.so: initext4.o ${libext4_objs}
|
||||
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
|
||||
|
||||
-libext6.a: initext6.o ${libext6_objs}
|
||||
- ${AM_VERBOSE_AR} ${AR} crs $@ $^;
|
||||
+libiptext6.so: initext6.o ${libext6_objs}
|
||||
+ ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -shared ${LDFLAGS} -o $@ $^ -L../libxtables/.libs -lxtables $(foreach obj,$^,${$(patsubst lib%.o,%,$(obj))_LIBADD});
|
||||
|
||||
initext_func := $(addprefix xt_,${pfx_build_static})
|
||||
initextb_func := $(addprefix ebt_,${pfb_build_static})
|
||||
--- a/iptables/Makefile.am
|
||||
+++ b/iptables/Makefile.am
|
||||
@@ -7,19 +7,22 @@ BUILT_SOURCES =
|
||||
|
||||
xtables_legacy_multi_SOURCES = xtables-legacy-multi.c iptables-xml.c
|
||||
xtables_legacy_multi_CFLAGS = ${AM_CFLAGS}
|
||||
-xtables_legacy_multi_LDADD = ../extensions/libext.a
|
||||
+xtables_legacy_multi_LDADD =
|
||||
+xtables_legacy_multi_LDFLAGS = -L../extensions/ -liptext
|
||||
if ENABLE_STATIC
|
||||
xtables_legacy_multi_CFLAGS += -DALL_INCLUSIVE
|
||||
endif
|
||||
if ENABLE_IPV4
|
||||
xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c
|
||||
xtables_legacy_multi_CFLAGS += -DENABLE_IPV4
|
||||
-xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a
|
||||
+xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la
|
||||
+xtables_legacy_multi_LDFLAGS += -liptext4
|
||||
endif
|
||||
if ENABLE_IPV6
|
||||
xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c
|
||||
xtables_legacy_multi_CFLAGS += -DENABLE_IPV6
|
||||
-xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a
|
||||
+xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la
|
||||
+xtables_legacy_multi_LDFLAGS += -liptext6
|
||||
endif
|
||||
xtables_legacy_multi_SOURCES += xshared.c iptables-restore.c iptables-save.c
|
||||
xtables_legacy_multi_LDADD += ../libxtables/libxtables.la -lm
|
||||
@@ -28,7 +31,8 @@ xtables_legacy_multi_LDADD += ../libxt
|
||||
if ENABLE_NFTABLES
|
||||
xtables_nft_multi_SOURCES = xtables-nft-multi.c iptables-xml.c
|
||||
xtables_nft_multi_CFLAGS = ${AM_CFLAGS}
|
||||
-xtables_nft_multi_LDADD = ../extensions/libext.a ../extensions/libext_ebt.a
|
||||
+xtables_nft_multi_LDADD =
|
||||
+xtables_nft_multi_LDFLAGS = -L../extensions/ -liptext -liptext_ebt
|
||||
if ENABLE_STATIC
|
||||
xtables_nft_multi_CFLAGS += -DALL_INCLUSIVE
|
||||
endif
|
||||
@@ -42,7 +46,8 @@ xtables_nft_multi_SOURCES += xtables-sav
|
||||
xtables-eb-standalone.c xtables-eb.c \
|
||||
xtables-eb-translate.c \
|
||||
xtables-translate.c
|
||||
-xtables_nft_multi_LDADD += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS} ../extensions/libext4.a ../extensions/libext6.a ../extensions/libext_ebt.a ../extensions/libext_arpt.a
|
||||
+xtables_nft_multi_LDADD += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS}
|
||||
+xtables_nft_multi_LDFLAGS += -liptext4 -liptext6 -liptext_arpt
|
||||
xtables_nft_multi_SOURCES += xshared.c
|
||||
xtables_nft_multi_LDADD += ../libxtables/libxtables.la -lm
|
||||
endif
|
||||
@@ -0,0 +1,95 @@
|
||||
--- a/extensions/libxt_conntrack.c
|
||||
+++ b/extensions/libxt_conntrack.c
|
||||
@@ -1399,6 +1399,7 @@ static int conntrack3_mt6_xlate(struct x
|
||||
}
|
||||
|
||||
static struct xtables_match conntrack_mt_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.version = XTABLES_VERSION,
|
||||
.name = "conntrack",
|
||||
@@ -1474,6 +1475,7 @@ static struct xtables_match conntrack_mt
|
||||
.alias = conntrack_print_name_alias,
|
||||
.x6_options = conntrack2_mt_opts,
|
||||
},
|
||||
+#endif
|
||||
{
|
||||
.version = XTABLES_VERSION,
|
||||
.name = "conntrack",
|
||||
@@ -1506,6 +1508,7 @@ static struct xtables_match conntrack_mt
|
||||
.x6_options = conntrack3_mt_opts,
|
||||
.xlate = conntrack3_mt6_xlate,
|
||||
},
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "state",
|
||||
@@ -1536,6 +1539,8 @@ static struct xtables_match conntrack_mt
|
||||
.x6_parse = state_ct23_parse,
|
||||
.x6_options = state_opts,
|
||||
},
|
||||
+#endif
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "state",
|
||||
@@ -1565,6 +1570,7 @@ static struct xtables_match conntrack_mt
|
||||
.x6_parse = state_parse,
|
||||
.x6_options = state_opts,
|
||||
},
|
||||
+#endif
|
||||
};
|
||||
|
||||
void _init(void)
|
||||
--- a/extensions/libxt_CT.c
|
||||
+++ b/extensions/libxt_CT.c
|
||||
@@ -363,6 +363,7 @@ static int xlate_ct1_tg(struct xt_xlate
|
||||
}
|
||||
|
||||
static struct xtables_target ct_target_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "CT",
|
||||
@@ -388,6 +389,7 @@ static struct xtables_target ct_target_r
|
||||
.x6_parse = ct_parse_v1,
|
||||
.x6_options = ct_opts_v1,
|
||||
},
|
||||
+#endif
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "CT",
|
||||
@@ -403,6 +405,7 @@ static struct xtables_target ct_target_r
|
||||
.x6_options = ct_opts_v1,
|
||||
.xlate = xlate_ct1_tg,
|
||||
},
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "NOTRACK",
|
||||
@@ -441,6 +444,7 @@ static struct xtables_target ct_target_r
|
||||
.revision = 0,
|
||||
.version = XTABLES_VERSION,
|
||||
},
|
||||
+#endif
|
||||
};
|
||||
|
||||
void _init(void)
|
||||
--- a/extensions/libxt_multiport.c
|
||||
+++ b/extensions/libxt_multiport.c
|
||||
@@ -591,6 +591,7 @@ static int multiport_xlate6_v1(struct xt
|
||||
}
|
||||
|
||||
static struct xtables_match multiport_mt_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "multiport",
|
||||
@@ -621,6 +622,7 @@ static struct xtables_match multiport_mt
|
||||
.x6_options = multiport_opts,
|
||||
.xlate = multiport_xlate6,
|
||||
},
|
||||
+#endif
|
||||
{
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "multiport",
|
||||
@@ -0,0 +1,95 @@
|
||||
--- /dev/null
|
||||
+++ b/extensions/libxt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+#include <stdio.h>
|
||||
+#include <xtables.h>
|
||||
+#include <linux/netfilter/xt_FLOWOFFLOAD.h>
|
||||
+
|
||||
+enum {
|
||||
+ O_HW,
|
||||
+};
|
||||
+
|
||||
+static void offload_help(void)
|
||||
+{
|
||||
+ printf(
|
||||
+"FLOWOFFLOAD target options:\n"
|
||||
+" --hw Enable hardware offload\n"
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+static const struct xt_option_entry offload_opts[] = {
|
||||
+ {.name = "hw", .id = O_HW, .type = XTTYPE_NONE},
|
||||
+ XTOPT_TABLEEND,
|
||||
+};
|
||||
+
|
||||
+static void offload_parse(struct xt_option_call *cb)
|
||||
+{
|
||||
+ struct xt_flowoffload_target_info *info = cb->data;
|
||||
+
|
||||
+ xtables_option_parse(cb);
|
||||
+ switch (cb->entry->id) {
|
||||
+ case O_HW:
|
||||
+ info->flags |= XT_FLOWOFFLOAD_HW;
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void offload_print(const void *ip, const struct xt_entry_target *target, int numeric)
|
||||
+{
|
||||
+ const struct xt_flowoffload_target_info *info =
|
||||
+ (const struct xt_flowoffload_target_info *)target->data;
|
||||
+
|
||||
+ printf(" FLOWOFFLOAD");
|
||||
+ if (info->flags & XT_FLOWOFFLOAD_HW)
|
||||
+ printf(" hw");
|
||||
+}
|
||||
+
|
||||
+static void offload_save(const void *ip, const struct xt_entry_target *target)
|
||||
+{
|
||||
+ const struct xt_flowoffload_target_info *info =
|
||||
+ (const struct xt_flowoffload_target_info *)target->data;
|
||||
+
|
||||
+ if (info->flags & XT_FLOWOFFLOAD_HW)
|
||||
+ printf(" --hw");
|
||||
+}
|
||||
+
|
||||
+static struct xtables_target offload_tg_reg[] = {
|
||||
+ {
|
||||
+ .family = NFPROTO_UNSPEC,
|
||||
+ .name = "FLOWOFFLOAD",
|
||||
+ .revision = 0,
|
||||
+ .version = XTABLES_VERSION,
|
||||
+ .size = XT_ALIGN(sizeof(struct xt_flowoffload_target_info)),
|
||||
+ .userspacesize = sizeof(struct xt_flowoffload_target_info),
|
||||
+ .help = offload_help,
|
||||
+ .print = offload_print,
|
||||
+ .save = offload_save,
|
||||
+ .x6_parse = offload_parse,
|
||||
+ .x6_options = offload_opts,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+void _init(void)
|
||||
+{
|
||||
+ xtables_register_targets(offload_tg_reg, ARRAY_SIZE(offload_tg_reg));
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/include/linux/netfilter/xt_FLOWOFFLOAD.h
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
+#ifndef _XT_FLOWOFFLOAD_H
|
||||
+#define _XT_FLOWOFFLOAD_H
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+
|
||||
+enum {
|
||||
+ XT_FLOWOFFLOAD_HW = 1 << 0,
|
||||
+
|
||||
+ XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW
|
||||
+};
|
||||
+
|
||||
+struct xt_flowoffload_target_info {
|
||||
+ __u32 flags;
|
||||
+};
|
||||
+
|
||||
+#endif /* _XT_FLOWOFFLOAD_H */
|
||||
75
package/network/utils/iw/Makefile
Normal file
75
package/network/utils/iw/Makefile
Normal file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# Copyright (C) 2007-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iw
|
||||
PKG_VERSION:=6.9
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/iw
|
||||
PKG_HASH:=3f2db22ad41c675242b98ae3942dbf3112548c60a42ff739210f2de4e98e4894
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:kernel:iw
|
||||
|
||||
PKG_BUILD_FLAGS:=gc-sections lto
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iw
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=cfg80211 interface configuration utility
|
||||
URL:=http://wireless.kernel.org/en/users/Documentation/iw
|
||||
DEPENDS:= +libnl-tiny
|
||||
VARIANT:=tiny
|
||||
endef
|
||||
|
||||
define Package/iw-full
|
||||
$(Package/iw)
|
||||
TITLE += (full version)
|
||||
VARIANT:=full
|
||||
PROVIDES:=iw
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
echo "const char iw_version[] = \"$(PKG_VERSION)\";" > $(PKG_BUILD_DIR)/version.c
|
||||
echo "#!/bin/sh" > $(PKG_BUILD_DIR)/version.sh
|
||||
chmod +x $(PKG_BUILD_DIR)/version.sh
|
||||
endef
|
||||
|
||||
TARGET_CPPFLAGS:= \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny \
|
||||
$(TARGET_CPPFLAGS) \
|
||||
-DCONFIG_LIBNL20 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
TARGET_CPPFLAGS += -DIW_FULL
|
||||
MAKE_FLAGS += IW_FULL=1
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
NL1FOUND="" NL2FOUND=Y \
|
||||
NLLIBNAME="libnl-tiny" \
|
||||
LIBS="-lm -lnl-tiny" \
|
||||
V=1
|
||||
|
||||
define Package/iw/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iw $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
Package/iw-full/install=$(Package/iw/install)
|
||||
|
||||
$(eval $(call BuildPackage,iw))
|
||||
$(eval $(call BuildPackage,iw-full))
|
||||
@@ -0,0 +1,68 @@
|
||||
From 1f3706d10812d70adefe32fe0d7d3a3ec25374f0 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Sun, 21 Nov 2021 00:02:57 +0100
|
||||
Subject: Revert "iw: allow specifying CFLAGS/LIBS externally"
|
||||
|
||||
This reverts commit 1325244b77d56fd7a16d1e35fdae0efc151920b1.
|
||||
|
||||
The OpenWrt build system provides the CFLAGS and LIBS names from the
|
||||
package Makefile to overwrite them for libnl-tiny. This is not possible
|
||||
after this upstream change which we revert here any more
|
||||
|
||||
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
---
|
||||
Makefile | 20 ++++++++++----------
|
||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -46,30 +46,30 @@ NLLIBNAME = libnl-1
|
||||
endif
|
||||
|
||||
ifeq ($(NL2FOUND),Y)
|
||||
-override CFLAGS += -DCONFIG_LIBNL20
|
||||
-override LIBS += -lnl-genl
|
||||
+CFLAGS += -DCONFIG_LIBNL20
|
||||
+LIBS += -lnl-genl
|
||||
NLLIBNAME = libnl-2.0
|
||||
endif
|
||||
|
||||
ifeq ($(NL3xFOUND),Y)
|
||||
# libnl 3.2 might be found as 3.2 and 3.0
|
||||
NL3FOUND = N
|
||||
-override CFLAGS += -DCONFIG_LIBNL30
|
||||
-override LIBS += -lnl-genl-3
|
||||
+CFLAGS += -DCONFIG_LIBNL30
|
||||
+LIBS += -lnl-genl-3
|
||||
NLLIBNAME = libnl-3.0
|
||||
endif
|
||||
|
||||
ifeq ($(NL3FOUND),Y)
|
||||
-override CFLAGS += -DCONFIG_LIBNL30
|
||||
-override LIBS += -lnl-genl
|
||||
+CFLAGS += -DCONFIG_LIBNL30
|
||||
+LIBS += -lnl-genl
|
||||
NLLIBNAME = libnl-3.0
|
||||
endif
|
||||
|
||||
# nl-3.1 has a broken libnl-gnl-3.1.pc file
|
||||
# as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $?
|
||||
ifeq ($(NL31FOUND),Y)
|
||||
-override CFLAGS += -DCONFIG_LIBNL30
|
||||
-override LIBS += -lnl-genl
|
||||
+CFLAGS += -DCONFIG_LIBNL30
|
||||
+LIBS += -lnl-genl
|
||||
NLLIBNAME = libnl-3.1
|
||||
endif
|
||||
|
||||
@@ -77,8 +77,8 @@ ifeq ($(NLLIBNAME),)
|
||||
$(error Cannot find development files for any supported version of libnl)
|
||||
endif
|
||||
|
||||
-override LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
|
||||
-override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
|
||||
+LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
|
||||
+CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
|
||||
endif # NO_PKG_CONFIG
|
||||
|
||||
ifeq ($(V),1)
|
||||
@@ -0,0 +1,12 @@
|
||||
--- a/survey.c
|
||||
+++ b/survey.c
|
||||
@@ -60,6 +60,9 @@ static int print_survey_handler(struct n
|
||||
if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX])
|
||||
printf("\tchannel receive time:\t\t%llu ms\n",
|
||||
(unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));
|
||||
+ if (sinfo[NL80211_SURVEY_INFO_TIME_BSS_RX])
|
||||
+ printf("\tchannel BSS receive time:\t%llu ms\n",
|
||||
+ (unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_TIME_BSS_RX]));
|
||||
if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX])
|
||||
printf("\tchannel transmit time:\t\t%llu ms\n",
|
||||
(unsigned long long)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX]));
|
||||
371
package/network/utils/iw/patches/200-reduce_size.patch
Normal file
371
package/network/utils/iw/patches/200-reduce_size.patch
Normal file
@@ -0,0 +1,371 @@
|
||||
--- a/event.c
|
||||
+++ b/event.c
|
||||
@@ -973,6 +973,7 @@ static int print_event(struct nl_msg *ms
|
||||
}
|
||||
|
||||
switch (gnlh->cmd) {
|
||||
+#ifdef IW_FULL
|
||||
case NL80211_CMD_NEW_WIPHY:
|
||||
printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
|
||||
break;
|
||||
@@ -1008,6 +1009,7 @@ static int print_event(struct nl_msg *ms
|
||||
case NL80211_CMD_SCHED_SCAN_RESULTS:
|
||||
printf("got scheduled scan results\n");
|
||||
break;
|
||||
+#endif
|
||||
case NL80211_CMD_WIPHY_REG_CHANGE:
|
||||
case NL80211_CMD_REG_CHANGE:
|
||||
if (gnlh->cmd == NL80211_CMD_WIPHY_REG_CHANGE)
|
||||
@@ -1090,6 +1092,7 @@ static int print_event(struct nl_msg *ms
|
||||
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
|
||||
printf("del station %s\n", macbuf);
|
||||
break;
|
||||
+#ifdef IW_FULL
|
||||
case NL80211_CMD_JOIN_IBSS:
|
||||
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
|
||||
printf("IBSS %s joined\n", macbuf);
|
||||
@@ -1297,9 +1300,9 @@ static int print_event(struct nl_msg *ms
|
||||
case NL80211_CMD_ASSOC_COMEBACK: /* 147 */
|
||||
parse_assoc_comeback(tb, gnlh->cmd);
|
||||
break;
|
||||
+#endif
|
||||
default:
|
||||
- printf("unknown event %d (%s)\n",
|
||||
- gnlh->cmd, command_name(gnlh->cmd));
|
||||
+ printf("unknown event %d\n", gnlh->cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
--- a/info.c
|
||||
+++ b/info.c
|
||||
@@ -446,6 +446,7 @@ next:
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_band[NL80211_BAND_ATTR_RATES]) {
|
||||
printf("\t\tBitrates (non-HT):\n");
|
||||
nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
|
||||
@@ -462,6 +463,7 @@ next:
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,6 +529,7 @@ next:
|
||||
printf("\tCoverage class: %d (up to %dm)\n", coverage, 450 * coverage);
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_msg[NL80211_ATTR_CIPHER_SUITES]) {
|
||||
int num = nla_len(tb_msg[NL80211_ATTR_CIPHER_SUITES]) / sizeof(__u32);
|
||||
int i;
|
||||
@@ -538,6 +541,7 @@ next:
|
||||
cipher_name(ciphers[i]));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
|
||||
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
|
||||
@@ -555,9 +559,11 @@ next:
|
||||
print_iftype_list("\tSupported interface modes", "\t\t",
|
||||
tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]);
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES])
|
||||
print_iftype_list("\tsoftware interface modes (can always be added)",
|
||||
"\t\t", tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]);
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
|
||||
struct nlattr *nl_combi;
|
||||
@@ -647,6 +653,7 @@ broken_combination:
|
||||
printf("\tinterface combinations are not supported\n");
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
|
||||
printf("\tSupported commands:\n");
|
||||
nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
|
||||
@@ -744,6 +751,7 @@ broken_combination:
|
||||
printf("\t\t * wake up on TCP connection\n");
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_ROAM_SUPPORT])
|
||||
printf("\tDevice supports roaming.\n");
|
||||
@@ -782,6 +790,7 @@ broken_combination:
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_msg[NL80211_ATTR_FEATURE_FLAGS]) {
|
||||
unsigned int features = nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]);
|
||||
|
||||
@@ -846,6 +855,7 @@ broken_combination:
|
||||
if (features & NL80211_FEATURE_ND_RANDOM_MAC_ADDR)
|
||||
printf("\tDevice supports randomizing MAC-addr in net-detect scans.\n");
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
|
||||
printf("\tDevice supports T-DLS.\n");
|
||||
@@ -914,6 +924,7 @@ TOPLEVEL(list, NULL, NL80211_CMD_GET_WIP
|
||||
"List all wireless devices and their capabilities.");
|
||||
TOPLEVEL(phy, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info, NULL);
|
||||
|
||||
+#ifdef IW_FULL
|
||||
static int handle_commands(struct nl80211_state *state, struct nl_msg *msg,
|
||||
int argc, char **argv, enum id_input id)
|
||||
{
|
||||
@@ -925,6 +936,7 @@ static int handle_commands(struct nl8021
|
||||
}
|
||||
TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
|
||||
"list all known commands and their decimal & hex value");
|
||||
+#endif
|
||||
|
||||
static int print_feature_handler(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
--- a/scan.c
|
||||
+++ b/scan.c
|
||||
@@ -1308,6 +1308,9 @@ static void print_ht_op(const uint8_t ty
|
||||
printf("\t\t * secondary channel offset: %s\n",
|
||||
ht_secondary_offset[data[1] & 0x3]);
|
||||
printf("\t\t * STA channel width: %s\n", sta_chan_width[(data[1] & 0x4)>>2]);
|
||||
+#ifndef IW_FULL
|
||||
+ return;
|
||||
+#endif
|
||||
printf("\t\t * RIFS: %d\n", (data[1] & 0x8)>>3);
|
||||
printf("\t\t * HT protection: %s\n", protection[data[2] & 0x3]);
|
||||
printf("\t\t * non-GF present: %d\n", (data[2] & 0x4) >> 2);
|
||||
@@ -1818,30 +1821,31 @@ static void print_ie(const struct ie_pri
|
||||
static const struct ie_print ieprinters[] = {
|
||||
[0] = { "SSID", print_ssid, 0, 32,
|
||||
BIT(PRINT_SCAN) | BIT(PRINT_LINK) | BIT(PRINT_LINK_MLO_MLD), },
|
||||
+ [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
|
||||
+ [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
|
||||
+ [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
|
||||
+ [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
|
||||
+ [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
|
||||
+ [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
|
||||
+ [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
|
||||
+ [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
|
||||
+#ifdef IW_FULL
|
||||
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
|
||||
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
|
||||
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
|
||||
[6] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), },
|
||||
[7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
|
||||
- [11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
|
||||
[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
|
||||
[35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
|
||||
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
|
||||
- [45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
|
||||
[47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
|
||||
[51] = { "AP Channel Report", print_ap_channel_report, 1, 255, BIT(PRINT_SCAN), },
|
||||
[59] = { "Supported operating classes", print_supp_op_classes, 1, 255, BIT(PRINT_SCAN), },
|
||||
[66] = { "Measurement Pilot Transmission", print_measurement_pilot_tx, 1, 255, BIT(PRINT_SCAN), },
|
||||
[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
|
||||
- [61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
|
||||
- [62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
|
||||
- [191] = { "VHT capabilities", print_vht_capa, 12, 255, BIT(PRINT_SCAN), },
|
||||
- [192] = { "VHT operation", print_vht_oper, 5, 255, BIT(PRINT_SCAN), },
|
||||
- [48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
|
||||
[50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
|
||||
[70] = { "RM enabled capabilities", print_rm_enabled_capabilities, 5, 5, BIT(PRINT_SCAN), },
|
||||
[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
|
||||
- [114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
|
||||
[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
|
||||
[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
|
||||
[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
|
||||
@@ -1850,6 +1854,7 @@ static const struct ie_print ieprinters[
|
||||
[214] = { "Short beacon interval", print_short_beacon_int, 2, 2, BIT(PRINT_SCAN), },
|
||||
[217] = { "S1G capabilities", print_s1g_capa, 15, 15, BIT(PRINT_SCAN), },
|
||||
[232] = { "S1G operation", print_s1g_oper, 6, 6, BIT(PRINT_SCAN), },
|
||||
+#endif
|
||||
};
|
||||
|
||||
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
|
||||
@@ -2185,8 +2190,10 @@ static void print_wifi_wps(const uint8_t
|
||||
|
||||
static const struct ie_print wifiprinters[] = {
|
||||
[1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), },
|
||||
+#ifdef IW_FULL
|
||||
[2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
|
||||
[4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
|
||||
+#endif
|
||||
};
|
||||
|
||||
static inline void print_p2p(const uint8_t type, uint8_t len,
|
||||
@@ -2349,6 +2356,10 @@ static void print_vendor(unsigned char l
|
||||
return;
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
+ return;
|
||||
+#endif
|
||||
+
|
||||
if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) {
|
||||
if (data[3] < ARRAY_SIZE(wfa_printers) &&
|
||||
wfa_printers[data[3]].name &&
|
||||
@@ -2483,6 +2494,7 @@ static void print_capa_non_dmg(__u16 cap
|
||||
printf(" ESS");
|
||||
if (capa & WLAN_CAPABILITY_IBSS)
|
||||
printf(" IBSS");
|
||||
+#ifdef IW_FULL
|
||||
if (capa & WLAN_CAPABILITY_CF_POLLABLE)
|
||||
printf(" CfPollable");
|
||||
if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
|
||||
@@ -2511,6 +2523,7 @@ static void print_capa_non_dmg(__u16 cap
|
||||
printf(" DelayedBACK");
|
||||
if (capa & WLAN_CAPABILITY_IMM_BACK)
|
||||
printf(" ImmediateBACK");
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int print_bss_handler(struct nl_msg *msg, void *arg)
|
||||
@@ -2601,8 +2614,10 @@ static int print_bss_handler(struct nl_m
|
||||
else
|
||||
printf("\tfreq: %d\n", freq);
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (freq > 45000)
|
||||
is_dmg = true;
|
||||
+#endif
|
||||
}
|
||||
if (bss[NL80211_BSS_BEACON_INTERVAL])
|
||||
printf("\tbeacon interval: %d TUs\n",
|
||||
@@ -2796,6 +2811,7 @@ static int handle_stop_sched_scan(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
COMMAND(scan, sched_start,
|
||||
SCHED_SCAN_OPTIONS,
|
||||
NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
|
||||
@@ -2806,3 +2822,4 @@ COMMAND(scan, sched_start,
|
||||
COMMAND(scan, sched_stop, "",
|
||||
NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
|
||||
"Stop an ongoing scheduled scan.");
|
||||
+#endif
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -153,6 +153,7 @@ static const char *commands[NL80211_CMD_
|
||||
|
||||
static char cmdbuf[100];
|
||||
|
||||
+#ifdef IW_FULL
|
||||
const char *command_name(enum nl80211_commands cmd)
|
||||
{
|
||||
if (cmd <= NL80211_CMD_MAX && commands[cmd])
|
||||
@@ -160,6 +161,7 @@ const char *command_name(enum nl80211_co
|
||||
sprintf(cmdbuf, "Unknown command (%d)", cmd);
|
||||
return cmdbuf;
|
||||
}
|
||||
+#endif
|
||||
|
||||
int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
|
||||
{
|
||||
@@ -313,6 +315,9 @@ int parse_keys(struct nl_msg *msg, char
|
||||
char keybuf[13];
|
||||
int pos = 0;
|
||||
|
||||
+#ifndef IW_FULL
|
||||
+ return 1;
|
||||
+#endif
|
||||
if (!*argc)
|
||||
return 1;
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -24,6 +24,12 @@ _OBJS := $(sort $(patsubst %.c,%.o,$(wil
|
||||
VERSION_OBJS := $(filter-out version.o, $(_OBJS))
|
||||
OBJS := $(VERSION_OBJS) version.o
|
||||
|
||||
+OBJS_FULL = ocb offch cqm wowlan coalesce roc p2p vendor mgmt ap sha256 nan bloom measurements ftm
|
||||
+ifdef IW_FULL
|
||||
+ CFLAGS += -DIW_FULL
|
||||
+else
|
||||
+ OBJS:=$(filter-out $(patsubst %,%.o,$(OBJS_FULL)),$(OBJS))
|
||||
+endif
|
||||
ALL = iw
|
||||
|
||||
ifeq ($(NO_PKG_CONFIG),)
|
||||
--- a/station.c
|
||||
+++ b/station.c
|
||||
@@ -801,10 +801,12 @@ static int handle_station_set_plink(stru
|
||||
nla_put_failure:
|
||||
return -ENOBUFS;
|
||||
}
|
||||
+#ifdef IW_FULL
|
||||
COMMAND_ALIAS(station, set, "<MAC address> plink_action <open|block>",
|
||||
NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
|
||||
"Set mesh peer link action for this station (peer).",
|
||||
select_station_cmd, station_set_plink);
|
||||
+#endif
|
||||
|
||||
static int handle_station_set_vlan(struct nl80211_state *state,
|
||||
struct nl_msg *msg,
|
||||
@@ -899,11 +901,13 @@ static int handle_station_set_mesh_power
|
||||
nla_put_failure:
|
||||
return -ENOBUFS;
|
||||
}
|
||||
+#ifdef IW_FULL
|
||||
COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
|
||||
"<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
|
||||
handle_station_set_mesh_power_mode,
|
||||
"Set link-specific mesh power mode for this station",
|
||||
select_station_cmd, station_set_mesh_power_mode);
|
||||
+#endif
|
||||
|
||||
static int handle_station_set_airtime_weight(struct nl80211_state *state,
|
||||
struct nl_msg *msg,
|
||||
--- a/interface.c
|
||||
+++ b/interface.c
|
||||
@@ -668,9 +668,11 @@ static int handle_interface_wds_peer(str
|
||||
nla_put_failure:
|
||||
return -ENOBUFS;
|
||||
}
|
||||
+#ifdef IW_FULL
|
||||
COMMAND(set, peer, "<MAC address>",
|
||||
NL80211_CMD_SET_WDS_PEER, 0, CIB_NETDEV, handle_interface_wds_peer,
|
||||
"Set interface WDS peer.");
|
||||
+#endif
|
||||
|
||||
static int set_mcast_rate(struct nl80211_state *state,
|
||||
struct nl_msg *msg,
|
||||
@@ -760,6 +762,7 @@ static int handle_chan(struct nl80211_st
|
||||
return handle_chanfreq(state, msg, true, argc, argv, id);
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
SECTION(switch);
|
||||
COMMAND(switch, freq,
|
||||
"<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
|
||||
@@ -1031,3 +1034,4 @@ COMMAND(set, tidconf, "[peer <MAC addres
|
||||
" $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates auto\n"
|
||||
" $ iw dev wlan0 set tidconf peer xx:xx:xx:xx:xx:xx tids 0x2 bitrates limit vht-mcs-5 4:9\n"
|
||||
);
|
||||
+#endif
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -403,6 +403,7 @@ err_out:
|
||||
free(cac_trigger_argv);
|
||||
return err;
|
||||
}
|
||||
+#ifdef IW_FULL
|
||||
TOPLEVEL(cac, "channel <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
|
||||
"freq <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz]\n"
|
||||
"freq <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
|
||||
@@ -422,6 +423,7 @@ COMMAND(cac, background,
|
||||
NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_background,
|
||||
"Start background channel availability check (CAC) looking to look for\n"
|
||||
"radars on the given channel.");
|
||||
+#endif
|
||||
|
||||
static int handle_fragmentation(struct nl80211_state *state,
|
||||
struct nl_msg *msg,
|
||||
46
package/network/utils/iwcap/Makefile
Normal file
46
package/network/utils/iwcap/Makefile
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (C) 2012 Jo-Philipp Wich <jo@mein.io>
|
||||
#
|
||||
# This is free software, licensed under the Apache 2 license.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iwcap
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/iwcap
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Simple radiotap capture utility
|
||||
MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
endef
|
||||
|
||||
define Package/iwcap/description
|
||||
The iwcap utility receives radiotap packet data from wifi monitor interfaces
|
||||
and outputs it to pcap format. It gathers recived packets in a fixed ring
|
||||
buffer to dump them on demand which is useful for background monitoring.
|
||||
Alternatively the utility can stream the data to stdout to act as remote
|
||||
capture drone for Wireshark or similar programs.
|
||||
endef
|
||||
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) $(TARGET_CFLAGS) \
|
||||
-o $(PKG_BUILD_DIR)/iwcap $(PKG_BUILD_DIR)/iwcap.c
|
||||
endef
|
||||
|
||||
|
||||
define Package/iwcap/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwcap $(1)/usr/sbin/iwcap
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iwcap))
|
||||
583
package/network/utils/iwcap/src/iwcap.c
Normal file
583
package/network/utils/iwcap/src/iwcap.c
Normal file
@@ -0,0 +1,583 @@
|
||||
/*
|
||||
* iwcap.c - A simply radiotap capture utility outputting pcap dumps
|
||||
*
|
||||
* Copyright 2012 Jo-Philipp Wich <jo@mein.io>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <byteswap.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_packet.h>
|
||||
|
||||
#define ARPHRD_IEEE80211_RADIOTAP 803
|
||||
|
||||
#define DLT_IEEE802_11_RADIO 127
|
||||
#define LEN_IEEE802_11_HDR 32
|
||||
|
||||
#define FRAMETYPE_MASK 0xFC
|
||||
#define FRAMETYPE_BEACON 0x80
|
||||
#define FRAMETYPE_DATA 0x08
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define le16(x) __bswap_16(x)
|
||||
#else
|
||||
#define le16(x) (x)
|
||||
#endif
|
||||
|
||||
uint8_t run_dump = 0;
|
||||
uint8_t run_stop = 0;
|
||||
uint8_t run_daemon = 0;
|
||||
|
||||
uint32_t frames_captured = 0;
|
||||
uint32_t frames_filtered = 0;
|
||||
|
||||
int capture_sock = -1;
|
||||
const char *ifname = NULL;
|
||||
|
||||
|
||||
struct ringbuf {
|
||||
uint32_t len; /* number of slots */
|
||||
uint32_t fill; /* last used slot */
|
||||
uint32_t slen; /* slot size */
|
||||
void *buf; /* ring memory */
|
||||
};
|
||||
|
||||
struct ringbuf_entry {
|
||||
uint32_t len; /* used slot memory */
|
||||
uint32_t olen; /* original data size */
|
||||
uint32_t sec; /* epoch of slot creation */
|
||||
uint32_t usec; /* epoch microseconds */
|
||||
};
|
||||
|
||||
typedef struct pcap_hdr_s {
|
||||
uint32_t magic_number; /* magic number */
|
||||
uint16_t version_major; /* major version number */
|
||||
uint16_t version_minor; /* minor version number */
|
||||
int32_t thiszone; /* GMT to local correction */
|
||||
uint32_t sigfigs; /* accuracy of timestamps */
|
||||
uint32_t snaplen; /* max length of captured packets, in octets */
|
||||
uint32_t network; /* data link type */
|
||||
} pcap_hdr_t;
|
||||
|
||||
typedef struct pcaprec_hdr_s {
|
||||
uint32_t ts_sec; /* timestamp seconds */
|
||||
uint32_t ts_usec; /* timestamp microseconds */
|
||||
uint32_t incl_len; /* number of octets of packet saved in file */
|
||||
uint32_t orig_len; /* actual length of packet */
|
||||
} pcaprec_hdr_t;
|
||||
|
||||
typedef struct ieee80211_radiotap_header {
|
||||
u_int8_t it_version; /* set to 0 */
|
||||
u_int8_t it_pad;
|
||||
u_int16_t it_len; /* entire length */
|
||||
u_int32_t it_present; /* fields present */
|
||||
} __attribute__((__packed__)) radiotap_hdr_t;
|
||||
|
||||
|
||||
int check_type(void)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
||||
|
||||
if (ioctl(capture_sock, SIOCGIFHWADDR, &ifr) < 0)
|
||||
return -1;
|
||||
|
||||
return (ifr.ifr_hwaddr.sa_family == ARPHRD_IEEE80211_RADIOTAP);
|
||||
}
|
||||
|
||||
int set_promisc(int on)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
|
||||
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
|
||||
|
||||
if (ioctl(capture_sock, SIOCGIFFLAGS, &ifr) < 0)
|
||||
return -1;
|
||||
|
||||
if (on && !(ifr.ifr_flags & IFF_PROMISC))
|
||||
{
|
||||
ifr.ifr_flags |= IFF_PROMISC;
|
||||
|
||||
if (ioctl(capture_sock, SIOCSIFFLAGS, &ifr))
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (!on && (ifr.ifr_flags & IFF_PROMISC))
|
||||
{
|
||||
ifr.ifr_flags &= ~IFF_PROMISC;
|
||||
|
||||
if (ioctl(capture_sock, SIOCSIFFLAGS, &ifr))
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void sig_dump(int sig)
|
||||
{
|
||||
run_dump = 1;
|
||||
}
|
||||
|
||||
void sig_teardown(int sig)
|
||||
{
|
||||
run_stop = 1;
|
||||
}
|
||||
|
||||
|
||||
void write_pcap_header(FILE *o)
|
||||
{
|
||||
pcap_hdr_t ghdr = {
|
||||
.magic_number = 0xa1b2c3d4,
|
||||
.version_major = 2,
|
||||
.version_minor = 4,
|
||||
.thiszone = 0,
|
||||
.sigfigs = 0,
|
||||
.snaplen = 0xFFFF,
|
||||
.network = DLT_IEEE802_11_RADIO
|
||||
};
|
||||
|
||||
fwrite(&ghdr, 1, sizeof(ghdr), o);
|
||||
}
|
||||
|
||||
void write_pcap_frame(FILE *o, uint32_t *sec, uint32_t *usec,
|
||||
uint16_t len, uint16_t olen)
|
||||
{
|
||||
struct timeval tv;
|
||||
pcaprec_hdr_t fhdr;
|
||||
|
||||
if (!sec || !usec)
|
||||
{
|
||||
gettimeofday(&tv, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
tv.tv_sec = *sec;
|
||||
tv.tv_usec = *usec;
|
||||
}
|
||||
|
||||
fhdr.ts_sec = tv.tv_sec;
|
||||
fhdr.ts_usec = tv.tv_usec;
|
||||
fhdr.incl_len = len;
|
||||
fhdr.orig_len = olen;
|
||||
|
||||
fwrite(&fhdr, 1, sizeof(fhdr), o);
|
||||
}
|
||||
|
||||
|
||||
struct ringbuf * ringbuf_init(uint32_t num_item, uint16_t len_item)
|
||||
{
|
||||
static struct ringbuf r;
|
||||
|
||||
if (len_item <= 0)
|
||||
return NULL;
|
||||
|
||||
r.buf = malloc(num_item * (len_item + sizeof(struct ringbuf_entry)));
|
||||
|
||||
if (r.buf)
|
||||
{
|
||||
r.len = num_item;
|
||||
r.fill = 0;
|
||||
r.slen = (len_item + sizeof(struct ringbuf_entry));
|
||||
|
||||
memset(r.buf, 0, num_item * len_item);
|
||||
|
||||
return &r;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct ringbuf_entry * ringbuf_add(struct ringbuf *r)
|
||||
{
|
||||
struct timeval t;
|
||||
struct ringbuf_entry *e;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
|
||||
e = r->buf + (r->fill++ * r->slen);
|
||||
r->fill %= r->len;
|
||||
|
||||
memset(e, 0, r->slen);
|
||||
|
||||
e->sec = t.tv_sec;
|
||||
e->usec = t.tv_usec;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
struct ringbuf_entry * ringbuf_get(struct ringbuf *r, int i)
|
||||
{
|
||||
struct ringbuf_entry *e = r->buf + (((r->fill + i) % r->len) * r->slen);
|
||||
|
||||
if (e->len > 0)
|
||||
return e;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ringbuf_free(struct ringbuf *r)
|
||||
{
|
||||
free(r->buf);
|
||||
memset(r, 0, sizeof(*r));
|
||||
}
|
||||
|
||||
|
||||
void msg(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
if (run_daemon)
|
||||
vsyslog(LOG_INFO | LOG_USER, fmt, ap);
|
||||
else
|
||||
vfprintf(stderr, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, n;
|
||||
struct ringbuf *ring;
|
||||
struct ringbuf_entry *e;
|
||||
struct sockaddr_ll local = {
|
||||
.sll_family = AF_PACKET,
|
||||
.sll_protocol = htons(ETH_P_ALL)
|
||||
};
|
||||
|
||||
radiotap_hdr_t *rhdr;
|
||||
|
||||
uint8_t frametype;
|
||||
uint8_t pktbuf[0xFFFF];
|
||||
ssize_t pktlen;
|
||||
|
||||
FILE *o;
|
||||
|
||||
int opt;
|
||||
|
||||
uint8_t promisc = 0;
|
||||
uint8_t streaming = 0;
|
||||
uint8_t foreground = 0;
|
||||
uint8_t filter_data = 0;
|
||||
uint8_t filter_beacon = 0;
|
||||
uint8_t header_written = 0;
|
||||
|
||||
uint32_t ringsz = 1024 * 1024; /* 1 Mbyte ring buffer */
|
||||
uint16_t pktcap = 256; /* truncate frames after 265KB */
|
||||
|
||||
const char *output = NULL;
|
||||
|
||||
|
||||
while ((opt = getopt(argc, argv, "i:r:c:o:sfhBD")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'i':
|
||||
ifname = optarg;
|
||||
if (!(local.sll_ifindex = if_nametoindex(ifname)))
|
||||
{
|
||||
msg("Unknown interface '%s'\n", ifname);
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
ringsz = atoi(optarg);
|
||||
if (ringsz < (3 * pktcap))
|
||||
{
|
||||
msg("Ring size of %d bytes is too short, "
|
||||
"must be at least %d bytes\n", ringsz, 3 * pktcap);
|
||||
return 3;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
pktcap = atoi(optarg);
|
||||
if (pktcap <= (sizeof(radiotap_hdr_t) + LEN_IEEE802_11_HDR))
|
||||
{
|
||||
msg("Packet truncate after %d bytes is too short, "
|
||||
"must be at least %d bytes\n",
|
||||
pktcap, sizeof(radiotap_hdr_t) + LEN_IEEE802_11_HDR);
|
||||
return 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
streaming = 1;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
output = optarg;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
filter_beacon = 1;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
filter_data = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
foreground = 1;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
msg(
|
||||
"Usage:\n"
|
||||
" %s -i {iface} -s [-b] [-d]\n"
|
||||
" %s -i {iface} -o {file} [-r len] [-c len] [-B] [-D] [-f]\n"
|
||||
"\n"
|
||||
" -i iface\n"
|
||||
" Specify interface to use, must be in monitor mode and\n"
|
||||
" produce IEEE 802.11 Radiotap headers.\n\n"
|
||||
" -s\n"
|
||||
" Stream to stdout instead of Dumping to file on USR1.\n\n"
|
||||
" -o file\n"
|
||||
" Write current ringbuffer contents to given output file\n"
|
||||
" on receipt of SIGUSR1.\n\n"
|
||||
" -r len\n"
|
||||
" Specify the amount of bytes to use for the ringbuffer.\n"
|
||||
" The default length is %d bytes.\n\n"
|
||||
" -c len\n"
|
||||
" Truncate captured packets after given amount of bytes.\n"
|
||||
" The default size limit is %d bytes.\n\n"
|
||||
" -B\n"
|
||||
" Don't store beacon frames in ring, default is keep.\n\n"
|
||||
" -D\n"
|
||||
" Don't store data frames in ring, default is keep.\n\n"
|
||||
" -f\n"
|
||||
" Do not daemonize but keep running in foreground.\n\n"
|
||||
" -h\n"
|
||||
" Display this help.\n\n",
|
||||
argv[0], argv[0], ringsz, pktcap);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!streaming && !output)
|
||||
{
|
||||
msg("No output file specified\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (streaming && output)
|
||||
{
|
||||
msg("The -s and -o options are exclusive\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (streaming && isatty(1))
|
||||
{
|
||||
msg("Refusing to stream into a terminal\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!local.sll_ifindex)
|
||||
{
|
||||
msg("No interface specified\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!check_type())
|
||||
{
|
||||
msg("Bad interface: not ARPHRD_IEEE80211_RADIOTAP\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ((capture_sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0)
|
||||
{
|
||||
msg("Unable to create raw socket: %s\n",
|
||||
strerror(errno));
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (bind(capture_sock, (struct sockaddr *)&local, sizeof(local)) == -1)
|
||||
{
|
||||
msg("Unable to bind to interface: %s\n",
|
||||
strerror(errno));
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (!streaming)
|
||||
{
|
||||
if (!foreground)
|
||||
{
|
||||
switch (fork())
|
||||
{
|
||||
case -1:
|
||||
msg("Unable to fork: %s\n", strerror(errno));
|
||||
return 8;
|
||||
|
||||
case 0:
|
||||
umask(0077);
|
||||
chdir("/");
|
||||
freopen("/dev/null", "r", stdin);
|
||||
freopen("/dev/null", "w", stdout);
|
||||
freopen("/dev/null", "w", stderr);
|
||||
run_daemon = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Daemon launched ...\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
msg("Monitoring interface %s ...\n", ifname);
|
||||
|
||||
if (!(ring = ringbuf_init(ringsz / pktcap, pktcap)))
|
||||
{
|
||||
msg("Unable to allocate ring buffer: %s\n",
|
||||
strerror(errno));
|
||||
return 5;
|
||||
}
|
||||
|
||||
msg(" * Using %d bytes ringbuffer with %d slots\n", ringsz, ring->len);
|
||||
msg(" * Truncating frames at %d bytes\n", pktcap);
|
||||
msg(" * Dumping data to file %s\n", output);
|
||||
|
||||
signal(SIGUSR1, sig_dump);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Monitoring interface %s ...\n", ifname);
|
||||
msg(" * Streaming data to stdout\n");
|
||||
}
|
||||
|
||||
msg(" * Beacon frames are %sfiltered\n", filter_beacon ? "" : "not ");
|
||||
msg(" * Data frames are %sfiltered\n", filter_data ? "" : "not ");
|
||||
|
||||
signal(SIGINT, sig_teardown);
|
||||
signal(SIGTERM, sig_teardown);
|
||||
|
||||
promisc = set_promisc(1);
|
||||
|
||||
/* capture loop */
|
||||
while (1)
|
||||
{
|
||||
if (run_dump)
|
||||
{
|
||||
msg("Dumping ring to %s ...\n", output);
|
||||
|
||||
if (!(o = fopen(output, "w")))
|
||||
{
|
||||
msg("Unable to open %s: %s\n",
|
||||
output, strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
write_pcap_header(o);
|
||||
|
||||
/* sig_dump packet buffer */
|
||||
for (i = 0, n = 0; i < ring->len; i++)
|
||||
{
|
||||
if (!(e = ringbuf_get(ring, i)))
|
||||
continue;
|
||||
|
||||
write_pcap_frame(o, &(e->sec), &(e->usec), e->len, e->olen);
|
||||
fwrite((void *)e + sizeof(*e), 1, e->len, o);
|
||||
n++;
|
||||
}
|
||||
|
||||
fclose(o);
|
||||
|
||||
msg(" * %d frames captured\n", frames_captured);
|
||||
msg(" * %d frames filtered\n", frames_filtered);
|
||||
msg(" * %d frames dumped\n", n);
|
||||
}
|
||||
|
||||
run_dump = 0;
|
||||
}
|
||||
if (run_stop)
|
||||
{
|
||||
msg("Shutting down ...\n");
|
||||
|
||||
if (promisc)
|
||||
set_promisc(0);
|
||||
|
||||
if (ring)
|
||||
ringbuf_free(ring);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pktlen = recvfrom(capture_sock, pktbuf, sizeof(pktbuf), 0, NULL, 0);
|
||||
frames_captured++;
|
||||
|
||||
/* check received frametype, if we should filter it, rewind the ring */
|
||||
rhdr = (radiotap_hdr_t *)pktbuf;
|
||||
|
||||
if (pktlen <= sizeof(radiotap_hdr_t) || le16(rhdr->it_len) >= pktlen)
|
||||
{
|
||||
frames_filtered++;
|
||||
continue;
|
||||
}
|
||||
|
||||
frametype = *(uint8_t *)(pktbuf + le16(rhdr->it_len));
|
||||
|
||||
if ((filter_data && (frametype & FRAMETYPE_MASK) == FRAMETYPE_DATA) ||
|
||||
(filter_beacon && (frametype & FRAMETYPE_MASK) == FRAMETYPE_BEACON))
|
||||
{
|
||||
frames_filtered++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (streaming)
|
||||
{
|
||||
if (!header_written)
|
||||
{
|
||||
write_pcap_header(stdout);
|
||||
header_written = 1;
|
||||
}
|
||||
|
||||
write_pcap_frame(stdout, NULL, NULL, pktlen, pktlen);
|
||||
fwrite(pktbuf, 1, pktlen, stdout);
|
||||
fflush(stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
e = ringbuf_add(ring);
|
||||
e->olen = pktlen;
|
||||
e->len = (pktlen > pktcap) ? pktcap : pktlen;
|
||||
|
||||
memcpy((void *)e + sizeof(*e), pktbuf, e->len);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
121
package/network/utils/iwinfo/Makefile
Normal file
121
package/network/utils/iwinfo/Makefile
Normal file
@@ -0,0 +1,121 @@
|
||||
#
|
||||
# Copyright (C) 2010-2016 Jo-Philipp Wich <jo@mein.io>
|
||||
#
|
||||
# This is free software, licensed under the GPL 2 license.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libiwinfo
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git
|
||||
PKG_SOURCE_DATE:=2024-07-06
|
||||
PKG_SOURCE_VERSION:=215820132b943b700d56441ecbd5a4efa09edc7c
|
||||
PKG_MIRROR_HASH:=f815ee1e0bde98f80a5de9f2711d5044479f936c07e21fc47d3a7f97955e7883
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_BUILD_FLAGS:=no-lto
|
||||
|
||||
IWINFO_ABI_VERSION:=20230701
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/libiwinfo
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Generalized Wireless Information Library (iwinfo)
|
||||
DEPENDS:=+libnl-tiny +libuci +libubus +libiwinfo-data
|
||||
ABI_VERSION:=$(IWINFO_ABI_VERSION)
|
||||
endef
|
||||
|
||||
define Package/libiwinfo/description
|
||||
Wireless information library with simplified API for nl80211
|
||||
and wext driver interfaces.
|
||||
endef
|
||||
|
||||
|
||||
define Package/libiwinfo-lua
|
||||
SUBMENU:=Lua
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=libiwinfo Lua binding
|
||||
DEPENDS:=+libiwinfo +liblua
|
||||
endef
|
||||
|
||||
define Package/libiwinfo-lua/description
|
||||
This is the Lua binding for the iwinfo library. It provides access to all enabled
|
||||
backends.
|
||||
endef
|
||||
|
||||
|
||||
define Package/libiwinfo-data
|
||||
TITLE:=libiwinfo Lua binding
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
|
||||
define Package/iwinfo
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Generalized Wireless Information utility
|
||||
DEPENDS:=+libiwinfo
|
||||
endef
|
||||
|
||||
define Package/iwinfo/description
|
||||
Command line frontend for the wireless information library.
|
||||
endef
|
||||
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
MAKE_FLAGS += \
|
||||
FPIC="$(FPIC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
BACKENDS="nl80211" \
|
||||
SOVERSION="$(IWINFO_ABI_VERSION)"
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/iwinfo
|
||||
$(CP) $(PKG_BUILD_DIR)/include/iwinfo.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/include/iwinfo/* $(1)/usr/include/iwinfo/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libiwinfo.so* $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
|
||||
endef
|
||||
|
||||
define Package/libiwinfo/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so.$(IWINFO_ABI_VERSION) $(1)/usr/lib/libiwinfo.so.$(IWINFO_ABI_VERSION)
|
||||
endef
|
||||
|
||||
define Package/libiwinfo-lua/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo.so $(1)/usr/lib/lua/iwinfo.so
|
||||
endef
|
||||
|
||||
define Package/libiwinfo-data/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/libiwinfo
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/devices.txt $(1)/usr/share/libiwinfo/devices.txt
|
||||
endef
|
||||
|
||||
define Package/iwinfo/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iwinfo $(1)/usr/bin/iwinfo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libiwinfo))
|
||||
$(eval $(call BuildPackage,libiwinfo-lua))
|
||||
$(eval $(call BuildPackage,libiwinfo-data))
|
||||
$(eval $(call BuildPackage,iwinfo))
|
||||
39
package/network/utils/layerscape/restool/Makefile
Normal file
39
package/network/utils/layerscape/restool/Makefile
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# Copyright 2017 NXP
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=restool
|
||||
PKG_VERSION:=21.08
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/nxp-qoriq/restool
|
||||
PKG_SOURCE_VERSION:=LSDK-21.08
|
||||
PKG_MIRROR_HASH:=3c289e6c9adc2c61445473ecd8b1b1a7b6dfd19a66d3c65f3b83b669e4c3e25b
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/restool
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Layerscape DPAA2 dynamical management tool
|
||||
DEPENDS:=@TARGET_layerscape_armv8_64b
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
DESTDIR="$(PKG_BUILD_DIR)"/output/ \
|
||||
install
|
||||
|
||||
define Package/restool/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/output/usr/local/bin/* $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,restool))
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -53,14 +53,13 @@ restool: $(OBJ)
|
||||
%.1: %.md
|
||||
pandoc --standalone --to man $^ -o $@
|
||||
|
||||
-install: restool scripts/ls-main scripts/ls-append-dpl scripts/ls-debug scripts/restool_completion.sh $(MANPAGE)
|
||||
+install: restool scripts/ls-main scripts/ls-append-dpl scripts/ls-debug scripts/restool_completion.sh
|
||||
install -D -m 755 restool $(DESTDIR)$(bindir)/restool
|
||||
install -D -m 755 scripts/ls-main $(DESTDIR)$(bindir)/ls-main
|
||||
install -D -m 755 scripts/ls-append-dpl $(DESTDIR)$(bindir)/ls-append-dpl
|
||||
install -D -m 755 scripts/ls-debug $(DESTDIR)$(bindir)/ls-debug
|
||||
$(foreach symlink, $(RESTOOL_SCRIPT_SYMLINKS), sh -c "cd $(DESTDIR)$(bindir) && ln -sf ls-main $(symlink)" ;)
|
||||
install -D -m 755 scripts/restool_completion.sh $(DESTDIR)$(bindir_completion)/restool
|
||||
- install -m 0644 -D $(MANPAGE) $(call get_manpage_destination,$(MANPAGE))
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(MANPAGE) \
|
||||
200
package/network/utils/linux-atm/Makefile
Normal file
200
package/network/utils/linux-atm/Makefile
Normal file
@@ -0,0 +1,200 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=linux-atm
|
||||
PKG_VERSION:=2.5.2
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
|
||||
PKG_HASH:=9645481a2b16476b59220aa2d6bc5bc41043f291326c9b37581018fbd16dd53a
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
PKG_CPE_ID:=cpe:/a:linux-atm:linux-atm
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ATM_DEBUG_BINS:=aread awrite atmdiag atmdump atmswitch saaldump \
|
||||
sonetdiag svc_recv svc_send ttcp_atm
|
||||
ATM_DEBUG_SBINS:=atmaddr atmloop atmtcp esi atmsigd bus \
|
||||
ilmid ilmidiag lecs les mpcd zeppelin
|
||||
ATM_DEBUG_TOOLS:=$(ATM_DEBUG_BINS) $(ATM_DEBUG_SBINS)
|
||||
|
||||
define Package/linux-atm
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Linux ATM library
|
||||
URL:=http://linux-atm.sourceforge.net/
|
||||
endef
|
||||
|
||||
define Package/linux-atm/description
|
||||
This package contains a library for accessing the Linux ATM subsystem.
|
||||
endef
|
||||
|
||||
define Package/linux-atm/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+linux-atm
|
||||
URL:=http://linux-atm.sourceforge.net/
|
||||
SUBMENU:=Linux ATM tools
|
||||
endef
|
||||
|
||||
define Package/atm-tools
|
||||
$(call Package/linux-atm/Default)
|
||||
TITLE:=Linux ATM tools
|
||||
endef
|
||||
|
||||
define Package/atm-tools/description
|
||||
This package contains the Linux ATM tools.
|
||||
endef
|
||||
|
||||
define Package/atm-diagnostics
|
||||
$(call Package/linux-atm/Default)
|
||||
TITLE:=Linux ATM Diagnostics
|
||||
endef
|
||||
|
||||
define Package/atm-diagnostics/description
|
||||
This package contains the Linux ATM diagnostics.
|
||||
endef
|
||||
|
||||
define Package/atm-debug-tools
|
||||
$(call Package/linux-atm/Default)
|
||||
TITLE:=Linux ATM debugging tools
|
||||
endef
|
||||
|
||||
define Package/atm-debug-tools/description
|
||||
This package contains the Linux ATM debugging tools.
|
||||
endef
|
||||
|
||||
define Package/br2684ctl
|
||||
$(call Package/linux-atm/Default)
|
||||
TITLE:=ATM Ethernet bridging configuration utility
|
||||
endef
|
||||
|
||||
define Package/br2684ctl/description
|
||||
Support for AAL5 encapsulation (RFC-1483/RFC-2684) over ATM.
|
||||
endef
|
||||
|
||||
define GenAtmPlugin
|
||||
define Package/$(1)
|
||||
$(call Package/linux-atm/Default)
|
||||
TITLE:=Linux ATM tool $(2)
|
||||
endef
|
||||
|
||||
define Package/$(1)/description
|
||||
Linux ATM tool $(2).
|
||||
endef
|
||||
endef
|
||||
|
||||
$(foreach t,$(ATM_DEBUG_TOOLS),$(eval $(call GenAtmPlugin,atm-$(t),$(t))))
|
||||
|
||||
TARGET_CFLAGS += -I$(LINUX_DIR)/user_headers/include
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default)
|
||||
# prevent autoheader invocation
|
||||
touch $(PKG_BUILD_DIR)/stamp-h.in
|
||||
endef
|
||||
|
||||
unexport PREFIX
|
||||
|
||||
define Build/Compile
|
||||
# src/qgen is built with HOSTCC, which does not really like our LDFLAGS
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/src/qgen \
|
||||
LDFLAGS="" \
|
||||
all
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) OBJCOPY=$(TARGET_CROSS)objcopy all
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/include \
|
||||
$(PKG_INSTALL_DIR)/usr/lib \
|
||||
$(1)/usr/
|
||||
endef
|
||||
|
||||
define Package/linux-atm/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libatm.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/atm-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmarp{,d} $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
|
||||
define BuildAtmPlugin
|
||||
define Package/$(1)/install
|
||||
$(INSTALL_DIR) $$(1)/usr/$(3)
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/$(3)/$(2) $$(1)/usr/$(3)
|
||||
endef
|
||||
|
||||
$$(eval $$(call BuildPackage,$(1)))
|
||||
endef
|
||||
|
||||
define Package/atm-debug-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmaddr $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmloop $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmtcp $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/esi $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aread $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/awrite $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdiag $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdump $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/atmsigd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bus $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ilmid $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ilmidiag $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lecs $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/les $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mpcd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zeppelin $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmswitch $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/saaldump $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sonetdiag $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svc_recv $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/svc_send $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ttcp_atm $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/atm-diagnostics/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aread $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/awrite $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdiag $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atmdump $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/br2684ctl/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/hotplug.d/atm $(1)/usr/sbin $(1)/lib/netifd
|
||||
$(INSTALL_BIN) ./files/br2684-up $(1)/lib/netifd/br2684-up
|
||||
$(INSTALL_BIN) ./files/br2684ctl $(1)/etc/init.d/
|
||||
$(INSTALL_CONF) ./files/atm.hotplug $(1)/etc/hotplug.d/atm/00-trigger
|
||||
$(INSTALL_BIN) \
|
||||
./files/br2684ctl_wrap \
|
||||
$(PKG_INSTALL_DIR)/usr/sbin/br2684ctl \
|
||||
$(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,linux-atm))
|
||||
$(eval $(call BuildPackage,atm-tools))
|
||||
$(eval $(call BuildPackage,atm-debug-tools))
|
||||
$(eval $(call BuildPackage,atm-diagnostics))
|
||||
$(eval $(call BuildPackage,br2684ctl))
|
||||
$(foreach t,$(ATM_DEBUG_BINS),$(eval $(call BuildAtmPlugin,atm-$(t),$(t),bin)))
|
||||
$(foreach t,$(ATM_DEBUG_SBINS),$(eval $(call BuildAtmPlugin,atm-$(t),$(t),sbin)))
|
||||
1
package/network/utils/linux-atm/files/atm.hotplug
Normal file
1
package/network/utils/linux-atm/files/atm.hotplug
Normal file
@@ -0,0 +1 @@
|
||||
ubus call service event '{ "type": "hotplug.atm", "data": { "name": "'"$DEVICENAME"'" } }'
|
||||
3
package/network/utils/linux-atm/files/br2684-up
Normal file
3
package/network/utils/linux-atm/files/br2684-up
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions/network.sh
|
||||
network_ready_device "$1"
|
||||
84
package/network/utils/linux-atm/files/br2684ctl
Executable file
84
package/network/utils/linux-atm/files/br2684ctl
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=50
|
||||
USE_PROCD=1
|
||||
|
||||
start_daemon() {
|
||||
local cfg="$1"
|
||||
|
||||
local atmdev disabled
|
||||
|
||||
config_get_bool disabled "$cfg" disabled 0
|
||||
[ "$disabled" -eq 1 ] && return
|
||||
|
||||
config_get atmdev "$cfg" atmdev 0
|
||||
|
||||
local nameprefix
|
||||
config_get nameprefix "$cfg" nameprefix "nas"
|
||||
|
||||
local unit
|
||||
config_get unit "$cfg" unit 0
|
||||
|
||||
local vpi
|
||||
config_get vpi "$cfg" vpi 8
|
||||
|
||||
local vci
|
||||
config_get vci "$cfg" vci 35
|
||||
|
||||
local encaps
|
||||
config_get encaps "$cfg" encaps
|
||||
|
||||
case "$encaps" in
|
||||
1|vc) encaps=1;;
|
||||
*) encaps=0;;
|
||||
esac
|
||||
|
||||
local payload
|
||||
config_get payload "$cfg" payload
|
||||
|
||||
case "$payload" in
|
||||
0|routed) payload=0;;
|
||||
*) payload=1;;
|
||||
esac
|
||||
|
||||
local qos
|
||||
config_get qos "$cfg" qos
|
||||
|
||||
local sendsize
|
||||
config_get sendsize "$cfg" sendsize
|
||||
|
||||
found=
|
||||
for device in /sys/class/atm/*; do
|
||||
[ -d "$device" ] || break
|
||||
[ "$(cat $device/atmindex)" = "$atmdev" ] || continue
|
||||
found=1
|
||||
break
|
||||
done
|
||||
|
||||
[ -n "$found" ] || return
|
||||
|
||||
local circuit="$atmdev.$vpi.$vci"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command \
|
||||
/usr/sbin/br2684ctl_wrap "${nameprefix}${unit}" \
|
||||
-n "$nameprefix" -c "$unit" -e "$encaps" -p "$payload" \
|
||||
-a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"} \
|
||||
-S /lib/netifd/br2684-up
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
local script=$(readlink "$initscript")
|
||||
local name=$(basename ${script:-$initscript})
|
||||
|
||||
procd_open_trigger
|
||||
procd_add_raw_trigger hotplug.atm 2000 /etc/init.d/$name reload
|
||||
procd_add_config_trigger "config.change" "network" /etc/init.d/$name reload
|
||||
procd_close_trigger
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load network
|
||||
config_foreach start_daemon atm-bridge
|
||||
}
|
||||
5
package/network/utils/linux-atm/files/br2684ctl_wrap
Normal file
5
package/network/utils/linux-atm/files/br2684ctl_wrap
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions/network.sh
|
||||
device="$1"; shift
|
||||
network_defer_device "$device"
|
||||
exec /usr/sbin/br2684ctl "$@"
|
||||
@@ -0,0 +1,319 @@
|
||||
--- a/src/mpoad/mpcd.8
|
||||
+++ b/src/mpoad/mpcd.8
|
||||
@@ -28,7 +28,7 @@ mpcd \- ATM MPOA (Multi\-Protocol Over A
|
||||
.B ]]
|
||||
.SH DESCRIPTION
|
||||
MPOA client
|
||||
-.SM(MPC) is responsible for creating and receiving
|
||||
+.SM (MPC) is responsible for creating and receiving
|
||||
internetwork layer shortcuts. Using these shortcuts MPCs forward
|
||||
unicast internetwork layer packets effectively over ATM without need
|
||||
for routing protocols.
|
||||
@@ -43,7 +43,7 @@ accepts shortcuts and packets arriving o
|
||||
shortcuts is done with the help of
|
||||
.SM MPOA
|
||||
server
|
||||
-.SM(MPS).
|
||||
+.SM (MPS).
|
||||
.PP
|
||||
Just as the Linux
|
||||
.SM LAN
|
||||
--- a/src/led/zeppelin.8
|
||||
+++ b/src/led/zeppelin.8
|
||||
@@ -99,7 +99,7 @@ Ring and ATM parts of the ELAN, so using
|
||||
recommended. Token Ring support has received less testing than its
|
||||
Ethernet counterpart.
|
||||
.SH FILES
|
||||
-.IP \fI/var/run/lec[interface number].pid\fP
|
||||
+.IP \fI/var/run/lec[interface\ number].pid\fP
|
||||
The file containing the process id of zeppelin.
|
||||
.SH BUGS
|
||||
John Bonham died 1980 and Led Zeppelin broke.
|
||||
--- a/src/sigd/atmsigd.conf.4
|
||||
+++ b/src/sigd/atmsigd.conf.4
|
||||
@@ -125,7 +125,7 @@ a comment. The `#' character cannot be e
|
||||
.P
|
||||
If an option is specified in \fBatmsigd.conf\fP and on the command
|
||||
line, the command line has priority.
|
||||
-.COMPATIBILITY
|
||||
+.SH COMPATIBILITY
|
||||
Certain options used by past versions of \fBatmsigd\fP but no longer documented
|
||||
on the man page are still recognized and supported, but they also yield a
|
||||
warning message. Future versions of \fBatmsigd\fP will not recognize those
|
||||
--- a/src/arpd/io.c
|
||||
+++ b/src/arpd/io.c
|
||||
@@ -277,7 +277,8 @@ static void accept_new(void)
|
||||
struct atm_qos qos;
|
||||
ENTRY *entry;
|
||||
VCC *vcc;
|
||||
- int fd,len,size,error;
|
||||
+ int fd,error;
|
||||
+ socklen_t len,size;
|
||||
|
||||
len = sizeof(addr);
|
||||
if ((fd = accept(incoming,(struct sockaddr *) &addr,&len)) < 0) {
|
||||
@@ -614,7 +615,8 @@ int ip_itf_info(int number,uint32_t *ip,
|
||||
|
||||
int get_local(int fd,struct sockaddr_atmsvc *addr)
|
||||
{
|
||||
- int length,result;
|
||||
+ int result;
|
||||
+ size_t length;
|
||||
|
||||
length = sizeof(struct sockaddr_atmsvc);
|
||||
result = getsockname(fd,(struct sockaddr *) addr,&length);
|
||||
--- a/src/arpd/table.c
|
||||
+++ b/src/arpd/table.c
|
||||
@@ -101,7 +101,8 @@ static void dump_vcc(VCC *vcc)
|
||||
char addr_buf[MAX_ATM_ADDR_LEN+1];
|
||||
char qos_buf[MAX_ATM_QOS_LEN+1];
|
||||
struct atm_qos qos;
|
||||
- int size,sndbuf;
|
||||
+ int sndbuf;
|
||||
+ socklen_t size;
|
||||
|
||||
size = sizeof(addr);
|
||||
if (getpeername(vcc->fd,(struct sockaddr *) &addr,&size) < 0) {
|
||||
--- a/src/ilmid/asn1/asn_int.c
|
||||
+++ b/src/ilmid/asn1/asn_int.c
|
||||
@@ -185,7 +185,7 @@ FILE* f _AND_
|
||||
AsnInt* v _AND_
|
||||
unsigned short int indent)
|
||||
{
|
||||
- fprintf(f,"%d", *v);
|
||||
+ fprintf(f,"%ld", *v);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,5 +370,5 @@ FILE* f _AND_
|
||||
UAsnInt* v _AND_
|
||||
unsigned short int indent)
|
||||
{
|
||||
- fprintf(f,"%u", *v);
|
||||
+ fprintf(f,"%lu", *v);
|
||||
}
|
||||
--- a/src/ilmid/asn1/asn_oid.c
|
||||
+++ b/src/ilmid/asn1/asn_oid.c
|
||||
@@ -127,7 +127,7 @@ unsigned short int indent)
|
||||
if (firstArcNum > 2)
|
||||
firstArcNum = 2;
|
||||
|
||||
- fprintf(f,"%u %u", firstArcNum, arcNum - (firstArcNum * 40));
|
||||
+ fprintf(f,"%d %lu", firstArcNum, arcNum - (firstArcNum * 40));
|
||||
|
||||
for (; i < v->octetLen ; )
|
||||
{
|
||||
@@ -136,7 +136,7 @@ unsigned short int indent)
|
||||
|
||||
arcNum = (arcNum << 7) + (v->octs[i] & 0x7f);
|
||||
i++;
|
||||
- fprintf(f," %u", arcNum);
|
||||
+ fprintf(f," %lu", arcNum);
|
||||
}
|
||||
fprintf(f,"}");
|
||||
|
||||
--- a/src/lane/connect.c
|
||||
+++ b/src/lane/connect.c
|
||||
@@ -258,7 +258,8 @@ static int
|
||||
data_handler(const Event_t *event, void *funcdata)
|
||||
{
|
||||
Conn_t *tmp, *newconn;
|
||||
- int fd, nbytes;
|
||||
+ int fd;
|
||||
+ socklen_t nbytes;
|
||||
static char buffer[BUFSIZE];
|
||||
LaneControl_t *ctmp;
|
||||
struct sockaddr_atmsvc addr;
|
||||
--- a/src/lane/connect_bus.c
|
||||
+++ b/src/lane/connect_bus.c
|
||||
@@ -170,7 +170,8 @@ static int
|
||||
data_handler(const Event_t *event, void *funcdata)
|
||||
{
|
||||
Conn_t *tmp, *newconn;
|
||||
- int fd, nbytes;
|
||||
+ int fd;
|
||||
+ socklen_t nbytes;
|
||||
static char buffer[BUFSIZE];
|
||||
struct sockaddr_atmsvc addr;
|
||||
|
||||
--- a/src/lane/lane_atm.c
|
||||
+++ b/src/lane/lane_atm.c
|
||||
@@ -138,7 +138,7 @@ atm_connect_back(const AtmAddr_t *our_ad
|
||||
struct atm_blli blli;
|
||||
struct atm_qos qos;
|
||||
int fd, ret;
|
||||
- int len = sizeof(address);
|
||||
+ socklen_t len = sizeof(address);
|
||||
|
||||
fd = socket(PF_ATMSVC, SOCK_DGRAM, 0);
|
||||
if (fd <0) {
|
||||
--- a/src/lane/lecs.c
|
||||
+++ b/src/lane/lecs.c
|
||||
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
|
||||
int just_dump=0;
|
||||
fd_set fds;
|
||||
struct sockaddr_atmsvc client;
|
||||
- int len;
|
||||
+ socklen_t len;
|
||||
unsigned char buffer[P_SIZE];
|
||||
|
||||
while(i!=-1) {
|
||||
--- a/src/lib/ans.c
|
||||
+++ b/src/lib/ans.c
|
||||
@@ -41,7 +41,7 @@
|
||||
static int ans(const char *text,int wanted,void *result,int res_len)
|
||||
{
|
||||
unsigned char answer[MAX_ANSWER];
|
||||
- unsigned char name[MAX_NAME];
|
||||
+ char name[MAX_NAME];
|
||||
unsigned char *pos,*data,*found;
|
||||
int answer_len,name_len,data_len,found_len;
|
||||
int questions,answers;
|
||||
--- a/src/lib/sdu2cell.c
|
||||
+++ b/src/lib/sdu2cell.c
|
||||
@@ -15,7 +15,8 @@ int sdu2cell(int s,int sizes,const int *
|
||||
{
|
||||
struct atm_qos qos;
|
||||
int trailer,total,cells;
|
||||
- int size,i;
|
||||
+ int i;
|
||||
+ socklen_t size;
|
||||
|
||||
size = sizeof(qos);
|
||||
if (getsockopt(s,SOL_AAL,SO_ATMQOS,&qos,&size) < 0) return -1;
|
||||
--- a/src/lib/unix.c
|
||||
+++ b/src/lib/unix.c
|
||||
@@ -63,8 +63,8 @@ int un_attach(const char *path)
|
||||
int un_recv_connect(int s,void *buf,int size)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
- int addr_size;
|
||||
int len;
|
||||
+ socklen_t addr_size;
|
||||
|
||||
addr_size = sizeof(addr);
|
||||
len = recvfrom(s,buf,size,0,(struct sockaddr *) &addr,&addr_size);
|
||||
--- a/src/maint/atmtcp.c
|
||||
+++ b/src/maint/atmtcp.c
|
||||
@@ -817,7 +817,8 @@ int main(int argc,char **argv)
|
||||
}
|
||||
else if (!strcmp(ARG,"listen") ||
|
||||
(do_background = !strcmp(ARG,"listen-bg"))) {
|
||||
- int fd,port,addr_len;
|
||||
+ int fd,port;
|
||||
+ socklen_t addr_len;
|
||||
int *fd2 = alloc_t(int);
|
||||
|
||||
if ((fd = socket(PF_INET,SOCK_STREAM,0)) < 0) {
|
||||
--- a/src/maint/hediag.c
|
||||
+++ b/src/maint/hediag.c
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
--- a/src/mpoad/io.c
|
||||
+++ b/src/mpoad/io.c
|
||||
@@ -521,7 +521,8 @@ static int msg_from_mps(int slot)
|
||||
static int accept_conn(int slot)
|
||||
{
|
||||
struct sockaddr_atmsvc sa;
|
||||
- int i, new_fd, sa_len;
|
||||
+ int i, new_fd;
|
||||
+ socklen_t sa_len;
|
||||
|
||||
sa_len = sizeof(sa);
|
||||
new_fd = accept(fds[slot].fd, (struct sockaddr *)&sa, &sa_len);
|
||||
--- a/src/sigd/io.c
|
||||
+++ b/src/sigd/io.c
|
||||
@@ -355,7 +355,7 @@ int get_pvc(int itf,int *vci)
|
||||
error = 0;
|
||||
if (bind(s,(struct sockaddr *) &addr,sizeof(addr)) < 0) error = errno;
|
||||
else {
|
||||
- int size;
|
||||
+ socklen_t size;
|
||||
|
||||
size = sizeof(addr);
|
||||
if (getsockname(s,(struct sockaddr *) &addr,&size) < 0)
|
||||
--- a/src/test/ttcp.c
|
||||
+++ b/src/test/ttcp.c
|
||||
@@ -92,7 +92,8 @@ struct sockaddr_in frominet;
|
||||
struct sockaddr_atmsvc satm;
|
||||
struct atm_qos qos;
|
||||
|
||||
-int domain, fromlen;
|
||||
+int domain;
|
||||
+socklen_t fromlen;
|
||||
int fd; /* fd of network socket */
|
||||
|
||||
int buflen = 8 * 1024; /* length of buffer */
|
||||
@@ -466,7 +467,7 @@ int no_check = 0;
|
||||
|
||||
{
|
||||
struct sockaddr_atmsvc peer;
|
||||
- int peerlen = sizeof(peer);
|
||||
+ socklen_t peerlen = sizeof(peer);
|
||||
if (getpeername(fd, (struct sockaddr *) &peer,
|
||||
&peerlen) < 0) {
|
||||
err("getpeername");
|
||||
@@ -498,7 +499,7 @@ int no_check = 0;
|
||||
/* set socket buffer size */
|
||||
#if defined(SO_SNDBUF) || defined(SO_RCVBUF)
|
||||
if (sockbufsize) {
|
||||
- int len;
|
||||
+ socklen_t len;
|
||||
|
||||
if (trans) {
|
||||
/* set send socket buffer if we are transmitting */
|
||||
@@ -663,7 +664,7 @@ int no_check = 0;
|
||||
exit(0);
|
||||
|
||||
usage:
|
||||
- fprintf(stderr, Usage);
|
||||
+ fprintf(stderr, "%s", Usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
--- a/src/arpd/arp.c
|
||||
+++ b/src/arpd/arp.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <netinet/in.h> /* for ntohs, etc. */
|
||||
#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */
|
||||
#include <linux/types.h>
|
||||
+#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <atm.h>
|
||||
--- a/src/arpd/itf.c
|
||||
+++ b/src/arpd/itf.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <sys/socket.h>
|
||||
#define _LINUX_NETDEVICE_H /* glibc2 */
|
||||
#include <linux/types.h>
|
||||
+#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
#include "atmd.h"
|
||||
--- a/src/maint/atmdump.c
|
||||
+++ b/src/maint/atmdump.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <linux/sockios.h>
|
||||
#include <netinet/in.h> /* for htonl and ntohl */
|
||||
#include <atm.h>
|
||||
|
||||
--- a/src/maint/saaldump.c
|
||||
+++ b/src/maint/saaldump.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <linux/sockios.h>
|
||||
#include <atm.h>
|
||||
|
||||
#include "pdu.h"
|
||||
179
package/network/utils/linux-atm/patches/200-no_libfl.patch
Normal file
179
package/network/utils/linux-atm/patches/200-no_libfl.patch
Normal file
@@ -0,0 +1,179 @@
|
||||
--- a/src/qgen/Makefile.am
|
||||
+++ b/src/qgen/Makefile.am
|
||||
@@ -2,7 +2,7 @@ noinst_PROGRAMS = qgen
|
||||
|
||||
qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \
|
||||
qgen.h second.c third.c
|
||||
-qgen_LDADD = -lfl
|
||||
+qgen_LDADD =
|
||||
|
||||
COMPILE = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@
|
||||
LINK = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@ -o $@
|
||||
--- a/src/qgen/Makefile.in
|
||||
+++ b/src/qgen/Makefile.in
|
||||
@@ -204,7 +204,7 @@ top_srcdir = @top_srcdir@
|
||||
qgen_SOURCES = common.c common.h file.c file.h first.c ql_y.y ql_l.l qgen.c \
|
||||
qgen.h second.c third.c
|
||||
|
||||
-qgen_LDADD = -lfl
|
||||
+qgen_LDADD =
|
||||
COMPILE = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@
|
||||
LINK = @CC_FOR_BUILD@ @CFLAGS_FOR_BUILD@ -o $@
|
||||
|
||||
--- a/src/sigd/Makefile.am
|
||||
+++ b/src/sigd/Makefile.am
|
||||
@@ -8,7 +8,7 @@ atmsigd_XTRAS = mess.o $(top_builddir)/s
|
||||
$(top_builddir)/src/q2931/qd.dump.o \
|
||||
$(top_builddir)/src/lib/libatm.la \
|
||||
$(top_builddir)/src/saal/libsaal.a
|
||||
-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl
|
||||
+atmsigd_LDADD = $(atmsigd_XTRAS)
|
||||
atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS)
|
||||
|
||||
CLEANFILES = mess.c
|
||||
--- a/src/sigd/Makefile.in
|
||||
+++ b/src/sigd/Makefile.in
|
||||
@@ -245,7 +245,7 @@ atmsigd_XTRAS = mess.o $(top_builddir)/s
|
||||
$(top_builddir)/src/lib/libatm.la \
|
||||
$(top_builddir)/src/saal/libsaal.a
|
||||
|
||||
-atmsigd_LDADD = $(atmsigd_XTRAS) -lfl
|
||||
+atmsigd_LDADD = $(atmsigd_XTRAS)
|
||||
atmsigd_DEPENDENCIES = mess.c $(atmsigd_XTRAS)
|
||||
CLEANFILES = mess.c
|
||||
sysconf_DATA = atmsigd.conf
|
||||
--- a/src/switch/debug/debug.c
|
||||
+++ b/src/switch/debug/debug.c
|
||||
@@ -20,6 +20,11 @@
|
||||
|
||||
#define PRV(call) ((FAB *) (call)->fab)
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
|
||||
typedef struct _fab {
|
||||
CALL *next; /* relay.c may not keep track of calls, but WE are */
|
||||
--- a/src/switch/debug/Makefile.am
|
||||
+++ b/src/switch/debug/Makefile.am
|
||||
@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/../../q2931
|
||||
sw_debug_SOURCES = debug.c
|
||||
sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \
|
||||
$(top_builddir)/src/lib/libatm.la
|
||||
-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl
|
||||
+sw_debug_LDADD = $(sw_debug_XTRAS)
|
||||
|
||||
sw_debug_DEPENDENCIES = $(sw_debug_XTRAS)
|
||||
|
||||
--- a/src/switch/debug/Makefile.in
|
||||
+++ b/src/switch/debug/Makefile.in
|
||||
@@ -200,7 +200,8 @@ sw_debug_SOURCES = debug.c
|
||||
sw_debug_XTRAS = $(top_builddir)/src/switch/libsw.a \
|
||||
$(top_builddir)/src/lib/libatm.la
|
||||
|
||||
-sw_debug_LDADD = $(sw_debug_XTRAS) -lfl
|
||||
+sw_debug_LDADD = $(sw_debug_XTRAS)
|
||||
+
|
||||
sw_debug_DEPENDENCIES = $(sw_debug_XTRAS)
|
||||
EXTRA_DIST = demo README
|
||||
all: all-am
|
||||
--- a/src/switch/tcp/Makefile.am
|
||||
+++ b/src/switch/tcp/Makefile.am
|
||||
@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/../../q2931
|
||||
sw_tcp_SOURCES = tcpsw.c
|
||||
sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \
|
||||
$(top_builddir)/src/lib/libatm.la
|
||||
-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl
|
||||
+sw_tcp_LDADD = $(sw_tcp_XTRAS)
|
||||
sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS)
|
||||
|
||||
EXTRA_DIST = mkfiles README
|
||||
--- a/src/switch/tcp/Makefile.in
|
||||
+++ b/src/switch/tcp/Makefile.in
|
||||
@@ -200,7 +200,7 @@ sw_tcp_SOURCES = tcpsw.c
|
||||
sw_tcp_XTRAS = $(top_builddir)/src/switch/libsw.a \
|
||||
$(top_builddir)/src/lib/libatm.la
|
||||
|
||||
-sw_tcp_LDADD = $(sw_tcp_XTRAS) -lfl
|
||||
+sw_tcp_LDADD = $(sw_tcp_XTRAS)
|
||||
sw_tcp_DEPENDENCIES = $(sw_tcp_XTRAS)
|
||||
EXTRA_DIST = mkfiles README
|
||||
all: all-am
|
||||
--- a/src/switch/tcp/tcpsw.c
|
||||
+++ b/src/switch/tcp/tcpsw.c
|
||||
@@ -35,6 +35,10 @@
|
||||
#define MAX_PACKET (ATM_MAX_AAL5_PDU+sizeof(struct atmtcp_hdr))
|
||||
#define BUFFER_SIZE (MAX_PACKET*2)
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
|
||||
typedef struct _table {
|
||||
struct _link *out; /* output port */
|
||||
--- a/src/test/Makefile.am
|
||||
+++ b/src/test/Makefile.am
|
||||
@@ -20,7 +20,7 @@ br_SOURCES = br.c
|
||||
bw_SOURCES = bw.c
|
||||
isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l
|
||||
isp_XTRAS = $(LDADD)
|
||||
-isp_LDADD = $(isp_XTRAS) -lfl
|
||||
+isp_LDADD = $(isp_XTRAS)
|
||||
isp_DEPENDENCIES = $(isp_XTRAS)
|
||||
window_SOURCES = window.c
|
||||
|
||||
--- a/src/test/Makefile.in
|
||||
+++ b/src/test/Makefile.in
|
||||
@@ -283,7 +283,7 @@ br_SOURCES = br.c
|
||||
bw_SOURCES = bw.c
|
||||
isp_SOURCES = isp.c isp.h ispl_y.y ispl_l.l
|
||||
isp_XTRAS = $(LDADD)
|
||||
-isp_LDADD = $(isp_XTRAS) -lfl
|
||||
+isp_LDADD = $(isp_XTRAS)
|
||||
isp_DEPENDENCIES = $(isp_XTRAS)
|
||||
window_SOURCES = window.c
|
||||
CLEANFILES = errnos.inc
|
||||
--- a/src/test/ispl_l.l
|
||||
+++ b/src/test/ispl_l.l
|
||||
@@ -18,6 +18,11 @@
|
||||
#include "ispl_y.h"
|
||||
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static int lineno = 1;
|
||||
|
||||
%}
|
||||
--- a/src/qgen/ql_l.l
|
||||
+++ b/src/qgen/ql_l.l
|
||||
@@ -11,6 +11,11 @@
|
||||
#include "ql_y.h"
|
||||
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
typedef struct _tree {
|
||||
struct _tree *left,*right;
|
||||
const char str[0];
|
||||
--- a/src/sigd/cfg_l.l
|
||||
+++ b/src/sigd/cfg_l.l
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
#include "cfg_y.h"
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
|
||||
static int lineno = 1;
|
||||
static int token; /* f@#%ing flex doesn't grok return after BEGIN */
|
||||
@@ -0,0 +1,40 @@
|
||||
--- a/src/extra/Makefile.am
|
||||
+++ b/src/extra/Makefile.am
|
||||
@@ -7,6 +7,8 @@ EXTRA_DIST = linux-atm.spec.in \
|
||||
BUILT_SOURCES = pca200e.bin pca200e_ecd.bin2 sba200e_ecd.bin2
|
||||
CLEANFILES = pca200e.bin pca200e_ecd.bin2 sba200e_ecd.bin2
|
||||
|
||||
+OBJCOPY = objcopy
|
||||
+
|
||||
install-exec-hook:
|
||||
$(MKDIR_P) $(DESTDIR)/lib/firmware
|
||||
$(INSTALL_DATA) $(srcdir)/pca200e.bin $(DESTDIR)/lib/firmware
|
||||
@@ -14,7 +16,7 @@ install-exec-hook:
|
||||
$(INSTALL_DATA) $(srcdir)/sba200e_ecd.bin2 $(DESTDIR)/lib/firmware
|
||||
|
||||
%.bin %.bin2: %.data
|
||||
- objcopy -Iihex $< -Obinary $@.gz
|
||||
+ $(OBJCOPY) -Iihex $< -Obinary $@.gz
|
||||
gzip -n -df $@.gz
|
||||
|
||||
|
||||
--- a/src/extra/Makefile.in
|
||||
+++ b/src/extra/Makefile.in
|
||||
@@ -187,6 +187,8 @@ CLEANFILES = pca200e.bin pca200e_ecd.bin
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
+OBJCOPY = objcopy
|
||||
+
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
@@ -385,7 +387,7 @@ install-exec-hook:
|
||||
$(INSTALL_DATA) $(srcdir)/sba200e_ecd.bin2 $(DESTDIR)/lib/firmware
|
||||
|
||||
%.bin %.bin2: %.data
|
||||
- objcopy -Iihex $< -Obinary $@.gz
|
||||
+ $(OBJCOPY) -Iihex $< -Obinary $@.gz
|
||||
gzip -n -df $@.gz
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
@@ -0,0 +1,70 @@
|
||||
--- a/src/ilmid/io.c
|
||||
+++ b/src/ilmid/io.c
|
||||
@@ -48,6 +48,14 @@
|
||||
be manually configured (after ilmid has
|
||||
registered the "official" address) - HACK */
|
||||
|
||||
+#ifndef SUN_LEN
|
||||
+# include <string.h> /* For prototype of `strlen'. */
|
||||
+
|
||||
+/* Evaluate to actual length of the `sockaddr_un' structure. */
|
||||
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
+ + strlen ((ptr)->sun_path))
|
||||
+#endif
|
||||
+
|
||||
extern SysGroup *remsys;
|
||||
extern State ilmi_state;
|
||||
static short atm_itf = -1; /* bad value */
|
||||
--- a/src/mpoad/io.c
|
||||
+++ b/src/mpoad/io.c
|
||||
@@ -10,14 +10,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h> /* for OPEN_MAX */
|
||||
-#if __GLIBC__ >= 2
|
||||
#include <sys/poll.h>
|
||||
-#else /* ugly hack to make it compile on RH 4.2 - WA */
|
||||
-#include <syscall.h>
|
||||
-#include <linux/poll.h>
|
||||
-#define SYS_poll 168
|
||||
-_syscall3(int,poll,struct pollfd *,ufds,unsigned int,nfds,int,timeout);
|
||||
-#endif
|
||||
#include <atm.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/atmioc.h>
|
||||
--- a/src/sigd/atmsigd.c
|
||||
+++ b/src/sigd/atmsigd.c
|
||||
@@ -283,12 +283,11 @@ static void setup_signals(void)
|
||||
/* ------------------------------- main ... ------------------------------- */
|
||||
|
||||
|
||||
-static void trace_on_exit(int status,void *dummy)
|
||||
+static void trace_on_exit(void)
|
||||
{
|
||||
char path[PATH_MAX+1];
|
||||
FILE *file;
|
||||
|
||||
- if (!status) return;
|
||||
if (!dump_dir) file = stderr;
|
||||
else {
|
||||
sprintf(path,"atmsigd.%d.trace.exit",getpid());
|
||||
@@ -517,7 +516,7 @@ int main(int argc,char **argv)
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
- (void) on_exit(trace_on_exit,NULL);
|
||||
+ (void) atexit(trace_on_exit);
|
||||
poll_loop();
|
||||
close_all();
|
||||
for (sig = entities; sig; sig = sig->next) stop_saal(&sig->saal);
|
||||
--- a/src/test/align.c
|
||||
+++ b/src/test/align.c
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
-#include <sys/errno.h>
|
||||
+#include <errno.h>
|
||||
#include <atm.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
--- a/src/br2684/br2684ctl.c
|
||||
+++ b/src/br2684/br2684ctl.c
|
||||
@@ -1,3 +1,4 @@
|
||||
+#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -43,6 +44,7 @@ struct br2684_params {
|
||||
|
||||
|
||||
int lastsock, lastitf;
|
||||
+static char *up_script;
|
||||
|
||||
|
||||
void fatal(const char *str, int err)
|
||||
@@ -185,6 +187,8 @@ int assign_vcc(char *astr, int encap, in
|
||||
|
||||
void start_interface(struct br2684_params* params)
|
||||
{
|
||||
+ char *cmd;
|
||||
+
|
||||
if (params->astr==NULL) {
|
||||
syslog(LOG_ERR, "Required ATM parameters not specified.");
|
||||
exit(1);
|
||||
@@ -193,13 +197,18 @@ void start_interface(struct br2684_param
|
||||
create_br(params->itfnum, params->payload);
|
||||
assign_vcc(params->astr, params->encap, params->payload, params->sndbuf,
|
||||
params->reqqos);
|
||||
+ if (up_script) {
|
||||
+ asprintf(&cmd, "%s nas%d", up_script, lastitf);
|
||||
+ system(cmd);
|
||||
+ free(cmd);
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
void usage(char *s)
|
||||
{
|
||||
printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
|
||||
- "[-a [itf.]vpi.vci]*]*\n", s);
|
||||
+ "[-a [itf.]vpi.vci]*]* [-S script]\n", s);
|
||||
printf(" encapsulations: 0=llc, 1=vcmux\n payloads: 0=routed, 1=bridged\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -225,7 +234,7 @@ int main (int argc, char **argv)
|
||||
|
||||
openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
|
||||
if (argc>1)
|
||||
- while ((c = getopt(argc, argv,"q:a:bc:e:s:p:?h")) !=EOF)
|
||||
+ while ((c = getopt(argc, argv,"q:a:bc:e:s:S:p:?h")) !=EOF)
|
||||
switch (c) {
|
||||
case 'q':
|
||||
printf ("optarg : %s",optarg);
|
||||
@@ -258,6 +267,9 @@ int main (int argc, char **argv)
|
||||
params.sndbuf=8192;
|
||||
}
|
||||
break;
|
||||
+ case 'S':
|
||||
+ up_script = optarg;
|
||||
+ break;
|
||||
case 'p': /* payload type: routed (0) or bridged (1) */
|
||||
#ifdef BR2684_FLAG_ROUTED
|
||||
params.payload = atoi(optarg);
|
||||
@@ -0,0 +1,74 @@
|
||||
--- a/src/br2684/br2684ctl.c
|
||||
+++ b/src/br2684/br2684ctl.c
|
||||
@@ -45,6 +45,7 @@ struct br2684_params {
|
||||
|
||||
int lastsock, lastitf;
|
||||
static char *up_script;
|
||||
+const char *itfname = "nas";
|
||||
|
||||
|
||||
void fatal(const char *str, int err)
|
||||
@@ -73,7 +74,7 @@ int create_pidfile(int num)
|
||||
|
||||
if (num < 0) return -1;
|
||||
|
||||
- snprintf(name, 32, "/var/run/br2684ctl-nas%d.pid", num);
|
||||
+ snprintf(name, 32, "/var/run/br2684ctl-%s%d.pid", itfname, num);
|
||||
pidfile = fopen(name, "w");
|
||||
if (pidfile == NULL) return -1;
|
||||
fprintf(pidfile, "%d", getpid());
|
||||
@@ -102,7 +103,7 @@ int create_br(int itfnum, int payload)
|
||||
ni.media |= BR2684_FLAG_ROUTED;
|
||||
#endif
|
||||
ni.mtu = 1500;
|
||||
- sprintf(ni.ifname, "nas%d", itfnum);
|
||||
+ sprintf(ni.ifname, "%s%d", itfname, itfnum);
|
||||
err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
|
||||
|
||||
if (err == 0)
|
||||
@@ -167,7 +168,7 @@ int assign_vcc(char *astr, int encap, in
|
||||
|
||||
be.backend_num = ATM_BACKEND_BR2684;
|
||||
be.ifspec.method = BR2684_FIND_BYIFNAME;
|
||||
- sprintf(be.ifspec.spec.ifname, "nas%d", lastitf);
|
||||
+ sprintf(be.ifspec.spec.ifname, "%s%d", itfname, lastitf);
|
||||
be.fcs_in = BR2684_FCSIN_NO;
|
||||
be.fcs_out = BR2684_FCSOUT_NO;
|
||||
be.fcs_auto = 0;
|
||||
@@ -198,7 +199,7 @@ void start_interface(struct br2684_param
|
||||
assign_vcc(params->astr, params->encap, params->payload, params->sndbuf,
|
||||
params->reqqos);
|
||||
if (up_script) {
|
||||
- asprintf(&cmd, "%s nas%d", up_script, lastitf);
|
||||
+ asprintf(&cmd, "%s %s%d", up_script, itfname, lastitf);
|
||||
system(cmd);
|
||||
free(cmd);
|
||||
}
|
||||
@@ -207,7 +208,7 @@ void start_interface(struct br2684_param
|
||||
|
||||
void usage(char *s)
|
||||
{
|
||||
- printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
|
||||
+ printf("usage: %s [-b] [-n name] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
|
||||
"[-a [itf.]vpi.vci]*]* [-S script]\n", s);
|
||||
printf(" encapsulations: 0=llc, 1=vcmux\n payloads: 0=routed, 1=bridged\n");
|
||||
exit(1);
|
||||
@@ -234,7 +235,7 @@ int main (int argc, char **argv)
|
||||
|
||||
openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
|
||||
if (argc>1)
|
||||
- while ((c = getopt(argc, argv,"q:a:bc:e:s:S:p:?h")) !=EOF)
|
||||
+ while ((c = getopt(argc, argv,"q:a:bn:c:e:s:S:p:?h")) !=EOF)
|
||||
switch (c) {
|
||||
case 'q':
|
||||
printf ("optarg : %s",optarg);
|
||||
@@ -247,6 +248,9 @@ int main (int argc, char **argv)
|
||||
case 'b':
|
||||
background=1;
|
||||
break;
|
||||
+ case 'n':
|
||||
+ itfname = optarg;
|
||||
+ break;
|
||||
case 'c':
|
||||
/* temporary, to make it work with multiple interfaces: */
|
||||
if (params.itfnum>=0) start_interface(¶ms);
|
||||
@@ -0,0 +1,52 @@
|
||||
This fixes the following compile problem with kernel 4.20:
|
||||
|
||||
In file included from arp.c:20:0:
|
||||
include/linux/if_arp.h:121:16: error: 'IFNAMSIZ' undeclared here (not in a function)
|
||||
char arp_dev[IFNAMSIZ];
|
||||
^~~~~~~~
|
||||
make[7]: *** [Makefile:459: arp.o] Error 1
|
||||
|
||||
This is caused by commit 6a12709da354 ("net: if_arp: use define instead
|
||||
of hard-coded value") in the upstream Linux kernel which is integrated
|
||||
in Linux 4.20.
|
||||
|
||||
--- a/src/oamd/io.c
|
||||
+++ b/src/oamd/io.c
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <atm.h>
|
||||
-#define _LINUX_NETDEVICE_H /* glibc2 */
|
||||
#include <linux/types.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
--- a/src/arpd/itf.c
|
||||
+++ b/src/arpd/itf.c
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <linux/atmclip.h>
|
||||
#include <sys/socket.h>
|
||||
-#define _LINUX_NETDEVICE_H /* glibc2 */
|
||||
#include <linux/types.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
--- a/src/arpd/io.c
|
||||
+++ b/src/arpd/io.c
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <atm.h>
|
||||
#include <linux/atmclip.h> /* for CLIP_DEFAULT_IDLETIMER */
|
||||
#include <linux/atmarp.h>
|
||||
-#define _LINUX_NETDEVICE_H /* glibc2 */
|
||||
#include <linux/types.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
--- a/src/arpd/arp.c
|
||||
+++ b/src/arpd/arp.c
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h> /* for linux/if_arp.h */
|
||||
#include <netinet/in.h> /* for ntohs, etc. */
|
||||
-#define _LINUX_NETDEVICE_H /* very crude hack for glibc2 */
|
||||
#include <linux/types.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/src/include/atmd.h
|
||||
+++ b/src/include/atmd.h
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
--- a/src/lib/unix.c
|
||||
+++ b/src/lib/unix.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
--- a/src/sigd/kernel.c
|
||||
+++ b/src/sigd/kernel.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
--- a/src/arpd/io.c
|
||||
+++ b/src/arpd/io.c
|
||||
@@ -615,7 +615,7 @@ int ip_itf_info(int number,uint32_t *ip,
|
||||
int get_local(int fd,struct sockaddr_atmsvc *addr)
|
||||
{
|
||||
int result;
|
||||
- size_t length;
|
||||
+ socklen_t length;
|
||||
|
||||
length = sizeof(struct sockaddr_atmsvc);
|
||||
result = getsockname(fd,(struct sockaddr *) addr,&length);
|
||||
--- a/src/led/conn.c
|
||||
+++ b/src/led/conn.c
|
||||
@@ -405,7 +405,7 @@ Conn_t *accept_conn(Conn_t *conn)
|
||||
{
|
||||
Conn_t *new;
|
||||
struct sockaddr_atmsvc addr;
|
||||
- size_t len;
|
||||
+ socklen_t len;
|
||||
int fd;
|
||||
char buff[MAX_ATM_ADDR_LEN+1];
|
||||
|
||||
@@ -538,7 +538,7 @@ static int handle_accept(Conn_t *conn)
|
||||
*/
|
||||
static int handle_data(Conn_t *conn)
|
||||
{
|
||||
- char buff[MAX_CTRL_FRAME];
|
||||
+ unsigned char buff[MAX_CTRL_FRAME];
|
||||
int retval;
|
||||
|
||||
retval = recv_frame(conn, buff, sizeof(buff));
|
||||
--- a/src/led/frames.c
|
||||
+++ b/src/led/frames.c
|
||||
@@ -312,7 +312,7 @@ static void handle_ready_ind(Conn_t *con
|
||||
* dependant handler functions.
|
||||
* Returns < 0 for serious error
|
||||
*/
|
||||
-int handle_frame(Conn_t *conn, char *buff, int size)
|
||||
+int handle_frame(Conn_t *conn, unsigned char *buff, int size)
|
||||
{
|
||||
struct ctrl_frame *frame;
|
||||
|
||||
--- a/src/led/frames.h
|
||||
+++ b/src/led/frames.h
|
||||
@@ -13,7 +13,7 @@ int validate_frame(unsigned char *buff,
|
||||
void send_ready_ind(Conn_t *conn);
|
||||
void send_register_req(void);
|
||||
|
||||
-int handle_frame(Conn_t *conn, char *buff, int size);
|
||||
+int handle_frame(Conn_t *conn, unsigned char *buff, int size);
|
||||
uint32_t send_flush_req(Conn_t *conn);
|
||||
|
||||
void parse_tlvs(uint16_t opcode, unsigned char *tlvp, int numtlvs, int sizeoftlvs);
|
||||
--- a/src/led/join.c
|
||||
+++ b/src/led/join.c
|
||||
@@ -43,7 +43,7 @@ static int read_join_rsp(char *buff, int
|
||||
static int parse_join_rsp(unsigned char *buff, int size);
|
||||
|
||||
static int get_bus_addr(struct sockaddr_atmsvc *addr);
|
||||
-static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, char *buff, int buffsize);
|
||||
+static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, unsigned char *buff, int buffsize);
|
||||
|
||||
/*
|
||||
* 5.1, Initial state
|
||||
@@ -693,7 +693,7 @@ static int get_bus_addr(struct sockaddr_
|
||||
fd_set rfds;
|
||||
struct timeval tv;
|
||||
int n = 0, retval, timeout;
|
||||
- char buff[MAX_CTRL_FRAME];
|
||||
+ unsigned char buff[MAX_CTRL_FRAME];
|
||||
|
||||
timeout = 4; /* wait response for 4 seconds */
|
||||
lec_params.c7c_current_timeout = 1;
|
||||
@@ -740,7 +740,7 @@ static int get_bus_addr(struct sockaddr_
|
||||
* Tries to read BUS ATM address in *addr
|
||||
* returns < 0 for error, 0 for not found > 0 for success
|
||||
*/
|
||||
-static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, char *buff, int buffsize)
|
||||
+static int read_bus_arp(Conn_t *conn, struct sockaddr_atmsvc *addr, unsigned char *buff, int buffsize)
|
||||
{
|
||||
int frame_size;
|
||||
struct ctrl_frame *frame;
|
||||
34
package/network/utils/ltq-dsl-base/Makefile
Normal file
34
package/network/utils/ltq-dsl-base/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ltq-dsl-base
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ltq-dsl-base
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=DSL related files for Intel/Lantiq DSL Chipsets
|
||||
URL:=http://openwrt.org/
|
||||
DEPENDS:=@(TARGET_lantiq||TARGET_ipq40xx) +jshn
|
||||
endef
|
||||
|
||||
define Package/ltq-dsl-base/description
|
||||
This package contains DSL related files for Intel/Lantiq DSL Chipsets.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ltq-dsl-base/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ltq-dsl-base))
|
||||
32
package/network/utils/ltq-dsl-base/files/etc/hotplug.d/dsl/led_dsl.sh
Executable file
32
package/network/utils/ltq-dsl-base/files/etc/hotplug.d/dsl/led_dsl.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$DSL_NOTIFICATION_TYPE" = "DSL_INTERFACE_STATUS" ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/leds.sh
|
||||
|
||||
led_dsl_up() {
|
||||
case "$(config_get led_dsl trigger)" in
|
||||
"netdev")
|
||||
led_set_attr $1 "trigger" "netdev"
|
||||
led_set_attr $1 "device_name" "$(config_get led_dsl dev)"
|
||||
for m in $(config_get led_dsl mode); do
|
||||
led_set_attr $1 "$m" "1"
|
||||
done
|
||||
;;
|
||||
*)
|
||||
led_on $1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
config_load system
|
||||
config_get led led_dsl sysfs
|
||||
if [ -n "$led" ]; then
|
||||
case "$DSL_INTERFACE_STATUS" in
|
||||
"HANDSHAKE") led_timer $led 500 500;;
|
||||
"TRAINING") led_timer $led 200 200;;
|
||||
"UP") led_dsl_up $led;;
|
||||
*) led_off $led
|
||||
esac
|
||||
fi
|
||||
37
package/network/utils/ltq-dsl-base/files/etc/hotplug.d/dsl/pppoa.sh
Executable file
37
package/network/utils/ltq-dsl-base/files/etc/hotplug.d/dsl/pppoa.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$DSL_NOTIFICATION_TYPE" = "DSL_INTERFACE_STATUS" ] || exit 0
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
|
||||
interfaces=$(ubus list network.interface.\* | cut -d"." -f3)
|
||||
for ifc in $interfaces; do
|
||||
|
||||
json_load "$(ifstatus $ifc)"
|
||||
|
||||
json_get_var proto proto
|
||||
if [ "$proto" != "pppoa" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
json_get_var up up
|
||||
config_get_bool auto "$ifc" auto 1
|
||||
if [ "$DSL_INTERFACE_STATUS" = "UP" ]; then
|
||||
if [ "$up" != 1 ] && [ "$auto" = 1 ]; then
|
||||
( sleep 1; ifup "$ifc" ) &
|
||||
fi
|
||||
else
|
||||
if [ "$up" = 1 ] && [ "$auto" = 1 ]; then
|
||||
( sleep 1; ifdown "$ifc" ) &
|
||||
else
|
||||
json_get_var autostart autostart
|
||||
if [ "$up" != 1 ] && [ "$autostart" = 1 ]; then
|
||||
( sleep 1; ifdown "$ifc" ) &
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
6
package/network/utils/ltq-dsl-base/files/sbin/dsl_notify.sh
Executable file
6
package/network/utils/ltq-dsl-base/files/sbin/dsl_notify.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script is called by dsl_cpe_control whenever there is a DSL event
|
||||
# and calls any available hotplug script(s) in /etc/hotplug.d/dsl.
|
||||
|
||||
exec /sbin/hotplug-call dsl
|
||||
85
package/network/utils/nftables/Makefile
Normal file
85
package/network/utils/nftables/Makefile
Normal file
@@ -0,0 +1,85 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=nftables
|
||||
PKG_VERSION:=1.0.9
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
|
||||
PKG_HASH:=a3c304cd9ba061239ee0474f9afb938a9bb99d89b960246f66f0c3a0a85e14cd
|
||||
|
||||
PKG_MAINTAINER:=
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_BUILD_FLAGS:=lto
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
DISABLE_NLS:=
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-debug \
|
||||
--disable-man-doc \
|
||||
--with-mini-gmp \
|
||||
--without-cli \
|
||||
--disable-python
|
||||
|
||||
define Package/nftables/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
TITLE:=nftables userspace utility
|
||||
DEPENDS:=+kmod-nft-core +libnftnl
|
||||
URL:=http://netfilter.org/projects/nftables/
|
||||
PROVIDES:=nftables
|
||||
endef
|
||||
|
||||
define Package/nftables-nojson
|
||||
$(Package/nftables/Default)
|
||||
TITLE+= no JSON support
|
||||
VARIANT:=nojson
|
||||
DEFAULT_VARIANT:=1
|
||||
CONFLICTS:=nftables-json
|
||||
endef
|
||||
|
||||
define Package/nftables-json
|
||||
$(Package/nftables/Default)
|
||||
TITLE+= with JSON support
|
||||
VARIANT:=json
|
||||
DEPENDS+=+jansson
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),json)
|
||||
CONFIGURE_ARGS += --with-json
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/nftables $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnftables.pc \
|
||||
$(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/nftables/install/Default
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/nft $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
Package/nftables-nojson/install = $(Package/nftables/install/Default)
|
||||
Package/nftables-json/install = $(Package/nftables/install/Default)
|
||||
|
||||
$(eval $(call BuildPackage,nftables-nojson))
|
||||
$(eval $(call BuildPackage,nftables-json))
|
||||
41
package/network/utils/resolveip/Makefile
Normal file
41
package/network/utils/resolveip/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2011-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=resolveip
|
||||
PKG_RELEASE:=2
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/resolveip
|
||||
SECTION:=utils
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Simple DNS resolver with configurable timeout
|
||||
MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
endef
|
||||
|
||||
define Package/resolveip/description
|
||||
This package contains the small resolveip utility which
|
||||
can be used by scripts to turn host names into numeric
|
||||
IP addresses. It supports IPv4 and IPv6 resolving and
|
||||
has a configurable timeout to guarantee a certain maximum
|
||||
runtime in case of slow or defunct DNS servers.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) $(TARGET_CFLAGS) -Wall \
|
||||
-o $(PKG_BUILD_DIR)/resolveip $(PKG_BUILD_DIR)/resolveip.c
|
||||
endef
|
||||
|
||||
define Package/resolveip/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/resolveip $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,resolveip))
|
||||
98
package/network/utils/resolveip/src/resolveip.c
Normal file
98
package/network/utils/resolveip/src/resolveip.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Based on code found at https://dev.openwrt.org/ticket/4876 .
|
||||
* Extended by Jo-Philipp Wich <jo@mein.io> for use in OpenWrt.
|
||||
*
|
||||
* You may use this program under the terms of the GPLv2 license.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
static void abort_query(int sig)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void show_usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" resolveip -h\n");
|
||||
printf(" resolveip [-t timeout] hostname\n");
|
||||
printf(" resolveip -4 [-t timeout] hostname\n");
|
||||
printf(" resolveip -6 [-t timeout] hostname\n");
|
||||
exit(255);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int timeout = 3;
|
||||
int opt;
|
||||
char ipaddr[INET6_ADDRSTRLEN];
|
||||
void *addr;
|
||||
struct addrinfo *res, *rp;
|
||||
struct sigaction sa = { .sa_handler = &abort_query };
|
||||
struct addrinfo hints = {
|
||||
.ai_family = AF_UNSPEC,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
.ai_protocol = IPPROTO_TCP,
|
||||
.ai_flags = 0
|
||||
};
|
||||
|
||||
while ((opt = getopt(argc, argv, "46t:h")) > -1)
|
||||
{
|
||||
switch ((char)opt)
|
||||
{
|
||||
case '4':
|
||||
hints.ai_family = AF_INET;
|
||||
break;
|
||||
|
||||
case '6':
|
||||
hints.ai_family = AF_INET6;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
timeout = atoi(optarg);
|
||||
if (timeout <= 0)
|
||||
show_usage();
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!argv[optind])
|
||||
show_usage();
|
||||
|
||||
sigaction(SIGALRM, &sa, NULL);
|
||||
alarm(timeout);
|
||||
|
||||
if (getaddrinfo(argv[optind], NULL, &hints, &res))
|
||||
exit(2);
|
||||
|
||||
for (rp = res; rp != NULL; rp = rp->ai_next)
|
||||
{
|
||||
addr = (rp->ai_family == AF_INET)
|
||||
? (void *)&((struct sockaddr_in *)rp->ai_addr)->sin_addr
|
||||
: (void *)&((struct sockaddr_in6 *)rp->ai_addr)->sin6_addr
|
||||
;
|
||||
|
||||
if (!inet_ntop(rp->ai_family, addr, ipaddr, INET6_ADDRSTRLEN - 1))
|
||||
exit(3);
|
||||
|
||||
printf("%s\n", ipaddr);
|
||||
}
|
||||
|
||||
freeaddrinfo(res);
|
||||
exit(0);
|
||||
}
|
||||
47
package/network/utils/rssileds/Makefile
Normal file
47
package/network/utils/rssileds/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# Copyright (C) 2011-2012 Daniel Golle <dgolle@allnet.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rssileds
|
||||
PKG_RELEASE:=4
|
||||
PKG_LICNESE:=GPL-2.0+
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/rssileds
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=RSSI real-time LED indicator
|
||||
DEPENDS:=+libiwinfo +libnl-tiny +libubox +libuci
|
||||
MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
endef
|
||||
|
||||
define Package/rssileds/description
|
||||
A small process written in C to update the signal-strength indicator LEDs
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS += -liwinfo -luci -lubox -lnl-tiny
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -Wall \
|
||||
-o $(PKG_BUILD_DIR)/rssileds $(PKG_BUILD_DIR)/rssileds.c $(TARGET_LDFLAGS)
|
||||
endef
|
||||
|
||||
define Package/rssileds/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/rssileds.init $(1)/etc/init.d/rssileds
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rssileds $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/led-trigger
|
||||
$(INSTALL_BIN) ./files/rssi $(1)/usr/libexec/led-trigger/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,rssileds))
|
||||
3
package/network/utils/rssileds/files/rssi
Normal file
3
package/network/utils/rssileds/files/rssi
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
logger -t led-trigger "LED trigger rssi is handled by /etc/init.d/rssileds"
|
||||
75
package/network/utils/rssileds/files/rssileds.init
Normal file
75
package/network/utils/rssileds/files/rssileds.init
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# (C) 2012 Daniel Golle, Allnet GmbH <dgolle@allnet.de>
|
||||
|
||||
START=96
|
||||
STOP=89
|
||||
RSSILEDS_BIN="/usr/sbin/rssileds"
|
||||
|
||||
SERVICE_DAEMONIZE=1
|
||||
SERVICE_WRITE_PID=1
|
||||
|
||||
start_rssid() {
|
||||
local name
|
||||
local dev
|
||||
local threshold
|
||||
local refresh
|
||||
local leds
|
||||
config_get name $1 name
|
||||
config_get dev $1 dev
|
||||
config_get threshold $1 threshold
|
||||
config_get refresh $1 refresh
|
||||
leds="$( cur_iface=$1 ; config_foreach get_led led )"
|
||||
SERVICE_PID_FILE=/var/run/rssileds-$dev.pid
|
||||
service_start $RSSILEDS_BIN $dev $refresh $threshold $leds
|
||||
}
|
||||
|
||||
stop_rssid() {
|
||||
local dev
|
||||
config_get dev $1 dev
|
||||
SERVICE_PID_FILE=/var/run/rssileds-$dev.pid
|
||||
service_stop $RSSILEDS_BIN
|
||||
}
|
||||
|
||||
get_led() {
|
||||
local name
|
||||
local sysfs
|
||||
local trigger
|
||||
local iface
|
||||
config_get sysfs $1 sysfs
|
||||
config_get name $1 name "$sysfs"
|
||||
config_get trigger $1 trigger "none"
|
||||
config_get iface $1 iface
|
||||
config_get minq $1 minq
|
||||
config_get maxq $1 maxq
|
||||
config_get offset $1 offset
|
||||
config_get factor $1 factor
|
||||
[ "$trigger" = "rssi" ] || return
|
||||
[ "$iface" = "$cur_iface" ] || return
|
||||
[ ! "$minq" ] || [ ! "$maxq" ] || [ ! "$offset" ] || [ ! "$factor" ] && return
|
||||
echo "none" > /sys/class/leds/$sysfs/trigger
|
||||
echo "$sysfs $minq $maxq $offset $factor"
|
||||
}
|
||||
|
||||
off_led() {
|
||||
local name
|
||||
local sysfs
|
||||
local trigger
|
||||
config_get sysfs $1 sysfs
|
||||
config_get name $1 name "$sysfs"
|
||||
config_get trigger $1 trigger "none"
|
||||
[ "$trigger" = "rssi" ] || return
|
||||
echo "0" > /sys/class/leds/$sysfs/brightness
|
||||
}
|
||||
|
||||
start() {
|
||||
[ -e /sys/class/leds/ ] && [ -x "$RSSILEDS_BIN" ] && {
|
||||
config_load system
|
||||
config_foreach start_rssid rssid
|
||||
}
|
||||
}
|
||||
|
||||
stop() {
|
||||
config_load system
|
||||
config_foreach stop_rssid rssid
|
||||
config_foreach off_led led
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user