Initial commit
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 ) &
|
||||
}
|
||||
|
||||
40
package/network/utils/arptables/Makefile
Normal file
40
package/network/utils/arptables/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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
|
||||
|
||||
PKG_NAME:=arptables
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://git.netfilter.org/arptables
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2015-05-20
|
||||
PKG_SOURCE_VERSION:=f4ab8f63f11a72f14687a6646d04ae1bae3fa45f
|
||||
PKG_MIRROR_HASH:=84bc660be4c9f70be91046acfd87785add930eceab7c543036058e1a9de2e9d9
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/arptables
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
TITLE:=ARP firewalling software
|
||||
DEPENDS:=+kmod-arptables
|
||||
URL:=https://git.netfilter.org/arptables/
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
COPT_FLAGS="$(TARGET_CFLAGS) -D__OPTIMIZE__=1" \
|
||||
KERNEL_DIR="$(LINUX_DIR)"
|
||||
|
||||
define Package/arptables/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,arptables))
|
||||
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:=33
|
||||
|
||||
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_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_DATA) ./files/runcommand.gcom $(1)/etc/gcom/runcommand.gcom
|
||||
$(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 ' '
|
||||
116
package/network/utils/comgt/files/3g.sh
Normal file
116
package/network/utils/comgt/files/3g.sh
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/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"
|
||||
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
|
||||
33
package/network/utils/comgt/files/3g.usb
Normal file
33
package/network/utils/comgt/files/3g.usb
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
}
|
||||
|
||||
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
|
||||
78
package/network/utils/comgt/files/ncm.json
Normal file
78
package/network/utils/comgt/files/ncm.json
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"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}"
|
||||
}
|
||||
}
|
||||
225
package/network/utils/comgt/files/ncm.sh
Normal file
225
package/network/utils/comgt/files/ncm.sh
Normal file
@@ -0,0 +1,225 @@
|
||||
#!/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 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_int profile
|
||||
proto_config_add_defaults
|
||||
}
|
||||
|
||||
proto_ncm_setup() {
|
||||
local interface="$1"
|
||||
|
||||
local manufacturer initialize setmode connect finalize ifname devname devpath
|
||||
|
||||
local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
|
||||
json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
|
||||
|
||||
[ "$metric" = "" ] && metric="0"
|
||||
|
||||
[ -n "$profile" ] || profile=1
|
||||
|
||||
pdptype=`echo "$pdptype" | awk '{print toupper($0)}'`
|
||||
[ "$pdptype" = "IP" -o "$pdptype" = "IPV6" -o "$pdptype" = "IPV4V6" ] || pdptype="IP"
|
||||
|
||||
[ -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
|
||||
}
|
||||
|
||||
devname="$(basename "$device")"
|
||||
case "$devname" in
|
||||
'tty'*)
|
||||
devpath="$(readlink -f /sys/class/tty/$devname/device)"
|
||||
ifname="$( ls "$devpath"/../../*/net )"
|
||||
;;
|
||||
*)
|
||||
devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
|
||||
ifname="$( ls "$devpath"/net )"
|
||||
;;
|
||||
esac
|
||||
[ -n "$ifname" ] || {
|
||||
echo "The interface could not be found."
|
||||
proto_notify_error "$interface" NO_IFACE
|
||||
proto_set_available "$interface" 0
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$delay" ] && sleep "$delay"
|
||||
|
||||
manufacturer=`gcom -d "$device" -s /etc/gcom/getcardinfo.gcom | awk 'NF && $0 !~ /AT\+CGMI/ { sub(/\+CGMI: /,""); print tolower($1); exit; }'`
|
||||
[ $? -ne 0 ] && {
|
||||
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"
|
||||
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
|
||||
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
|
||||
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 "$profile" ] || profile=1
|
||||
|
||||
echo "Stopping network $interface"
|
||||
|
||||
json_load "$(ubus call network.interface.$interface status)"
|
||||
json_select data
|
||||
json_get_vars 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
|
||||
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
|
||||
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;
|
||||
160
package/network/utils/curl/Config.in
Normal file
160
package/network/utils/curl/Config.in
Normal file
@@ -0,0 +1,160 @@
|
||||
if PACKAGE_libcurl
|
||||
|
||||
comment "SSL support"
|
||||
|
||||
choice
|
||||
prompt "Selected SSL library"
|
||||
default LIBCURL_MBEDTLS
|
||||
|
||||
config LIBCURL_MBEDTLS
|
||||
bool "mbed TLS"
|
||||
|
||||
config LIBCURL_WOLFSSL
|
||||
bool "wolfSSL"
|
||||
|
||||
config LIBCURL_OPENSSL
|
||||
bool "OpenSSL"
|
||||
|
||||
config LIBCURL_GNUTLS
|
||||
bool "GNUTLS"
|
||||
|
||||
config LIBCURL_NOSSL
|
||||
bool "No SSL support"
|
||||
|
||||
endchoice
|
||||
|
||||
comment "Supported protocols"
|
||||
|
||||
config LIBCURL_DICT
|
||||
bool "DICT protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_FILE
|
||||
bool "FILE protocol"
|
||||
default y
|
||||
|
||||
config LIBCURL_FTP
|
||||
bool "FTP / FTPS protocol"
|
||||
default y
|
||||
|
||||
config LIBCURL_GOPHER
|
||||
bool "Gopher protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_HTTP
|
||||
bool "HTTP / HTTPS protocol"
|
||||
default y
|
||||
|
||||
config LIBCURL_COOKIES
|
||||
bool "Enable Cookies support"
|
||||
depends on LIBCURL_HTTP
|
||||
default y
|
||||
|
||||
config LIBCURL_IMAP
|
||||
bool "IMAP / IMAPS protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_LDAP
|
||||
bool "LDAP protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_LDAPS
|
||||
bool "Enable LDAPS support"
|
||||
depends on LIBCURL_LDAP && !LIBCURL_NOSSL
|
||||
default y
|
||||
|
||||
config LIBCURL_POP3
|
||||
bool "POP3 / POP3S protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_RTSP
|
||||
bool "RTSP protocol"
|
||||
depends on LIBCURL_HTTP
|
||||
default n
|
||||
config LIBCURL_NO_RTSP
|
||||
string "RTSP require HTTP protocol"
|
||||
depends on !LIBCURL_HTTP
|
||||
default "!"
|
||||
|
||||
config LIBCURL_SSH2
|
||||
bool "SCP / SFTP protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_SMB
|
||||
bool "SMB protocol (CIFS)"
|
||||
depends on LIBCURL_CRYPTO_AUTH && (LIBCURL_GNUTLS || LIBCURL_OPENSSL)
|
||||
default n
|
||||
config LIBCURL_NO_SMB
|
||||
string "SMB require 'cryptographic authentication' and either 'GnuTLS' or 'OpenSSL'"
|
||||
depends on !LIBCURL_CRYPTO_AUTH || (!LIBCURL_GNUTLS && !LIBCURL_OPENSSL)
|
||||
default "!"
|
||||
|
||||
config LIBCURL_SMTP
|
||||
bool "SMTP / SMTPS protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_TELNET
|
||||
bool "TELNET protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_TFTP
|
||||
bool "TFTP protocol"
|
||||
default n
|
||||
|
||||
config LIBCURL_NGHTTP2
|
||||
bool "HTTP2 protocol"
|
||||
default n
|
||||
|
||||
comment "Miscellaneous"
|
||||
|
||||
config LIBCURL_PROXY
|
||||
bool "Enable proxy support"
|
||||
default y
|
||||
|
||||
config LIBCURL_CRYPTO_AUTH
|
||||
bool "Enable cryptographic authentication"
|
||||
default n
|
||||
|
||||
config LIBCURL_TLS_SRP
|
||||
bool "Enable TLS-SRP authentication"
|
||||
default n
|
||||
|
||||
config LIBCURL_LIBIDN2
|
||||
bool "Enable IDN2 support"
|
||||
default n
|
||||
|
||||
config LIBCURL_THREADED_RESOLVER
|
||||
bool "Enable threaded DNS resolver"
|
||||
default n
|
||||
help
|
||||
Enable POSIX threaded asynchronous DNS resolution
|
||||
|
||||
config LIBCURL_ZLIB
|
||||
bool "Enable zlib support"
|
||||
default n
|
||||
|
||||
config LIBCURL_UNIX_SOCKETS
|
||||
bool "Enable unix domain socket support"
|
||||
default n
|
||||
help
|
||||
Enable HTTP over unix domain sockets.
|
||||
To use this with the curl command line, you specify the socket path to the new --unix-domain option.
|
||||
This feature is actually not limited to HTTP, you can do all the TCP-based protocols
|
||||
except FTP over the unix domain socket, but it is only HTTP that is regularly used this way.
|
||||
The reason FTP isn't supported is of course its use of two connections
|
||||
which would be even weirder to do like this.
|
||||
|
||||
config LIBCURL_LIBCURL_OPTION
|
||||
bool "Enable generation of C code"
|
||||
default n
|
||||
|
||||
config LIBCURL_VERBOSE
|
||||
bool "Enable verbose error strings"
|
||||
default n
|
||||
|
||||
config LIBCURL_NTLM
|
||||
bool "Enable NTLM support"
|
||||
depends on LIBCURL_CRYPTO_AUTH && !LIBCURL_NOSSL
|
||||
default n
|
||||
|
||||
endif
|
||||
184
package/network/utils/curl/Makefile
Normal file
184
package/network/utils/curl/Makefile
Normal file
@@ -0,0 +1,184 @@
|
||||
#
|
||||
# Copyright (C) 2007-2016 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:=curl
|
||||
PKG_VERSION:=7.66.0
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \
|
||||
https://curl.mirror.anstey.ca/ \
|
||||
https://curl.askapache.com/download/ \
|
||||
https://curl.haxx.se/download/
|
||||
PKG_HASH:=dbb48088193016d079b97c5c3efde8efa56ada2ebf336e8a97d04eb8e2ed98c1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:haxx:libcurl
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_IPV6 \
|
||||
\
|
||||
CONFIG_LIBCURL_WOLFSSL \
|
||||
CONFIG_LIBCURL_GNUTLS \
|
||||
CONFIG_LIBCURL_OPENSSL \
|
||||
CONFIG_LIBCURL_MBEDTLS \
|
||||
CONFIG_LIBCURL_NOSSL \
|
||||
\
|
||||
CONFIG_LIBCURL_LIBIDN2 \
|
||||
CONFIG_LIBCURL_SSH2 \
|
||||
CONFIG_LIBCURL_ZLIB \
|
||||
\
|
||||
CONFIG_LIBCURL_DICT \
|
||||
CONFIG_LIBCURL_FILE \
|
||||
CONFIG_LIBCURL_FTP \
|
||||
CONFIG_LIBCURL_GOPHER \
|
||||
CONFIG_LIBCURL_HTTP \
|
||||
CONFIG_LIBCURL_IMAP \
|
||||
CONFIG_LIBCURL_LDAP \
|
||||
CONFIG_LIBCURL_LDAPS \
|
||||
CONFIG_LIBCURL_POP3 \
|
||||
CONFIG_LIBCURL_RTSP \
|
||||
CONFIG_LIBCURL_NO_RTSP \
|
||||
CONFIG_LIBCURL_SMB \
|
||||
CONFIG_LIBCURL_NO_SMB \
|
||||
CONFIG_LIBCURL_SMTP \
|
||||
CONFIG_LIBCURL_TELNET \
|
||||
CONFIG_LIBCURL_TFTP \
|
||||
CONFIG_LIBCURL_NGHTTP2 \
|
||||
\
|
||||
CONFIG_LIBCURL_COOKIES \
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH \
|
||||
CONFIG_LIBCURL_LIBCURL_OPTION \
|
||||
CONFIG_LIBCURL_PROXY \
|
||||
CONFIG_LIBCURL_THREADED_RESOLVER \
|
||||
CONFIG_LIBCURL_TLS_SRP \
|
||||
CONFIG_LIBCURL_UNIX_SOCKETS \
|
||||
CONFIG_LIBCURL_VERBOSE \
|
||||
CONFIG_LIBCURL_NTLM
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/curl/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://curl.haxx.se/
|
||||
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
|
||||
endef
|
||||
|
||||
define Package/curl
|
||||
$(call Package/curl/Default)
|
||||
SUBMENU:=File Transfer
|
||||
DEPENDS:=+libcurl
|
||||
TITLE:=A client-side URL transfer utility
|
||||
endef
|
||||
|
||||
define Package/libcurl
|
||||
$(call Package/curl/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
|
||||
DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN2:libidn2
|
||||
DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle
|
||||
TITLE:=A client-side URL transfer library
|
||||
MENU:=1
|
||||
ABI_VERSION:=4
|
||||
endef
|
||||
|
||||
define Package/libcurl/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(FPIC) -ffunction-sections -fdata-sections
|
||||
TARGET_CPPFLAGS += $(if $(CONFIG_LIBCURL_NTLM),,-DCURL_DISABLE_NTLM)
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-debug \
|
||||
--disable-ares \
|
||||
--enable-shared \
|
||||
--enable-static \
|
||||
--disable-manual \
|
||||
--without-nss \
|
||||
--without-libmetalink \
|
||||
--without-librtmp \
|
||||
--without-libidn \
|
||||
--without-ca-path \
|
||||
--without-libpsl \
|
||||
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
|
||||
\
|
||||
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
|
||||
\
|
||||
$(if $(CONFIG_LIBCURL_WOLFSSL),--with-cyassl="$(STAGING_DIR)/usr",--without-cyassl) \
|
||||
$(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \
|
||||
$(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr",--without-ssl) \
|
||||
$(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr",--without-mbedtls) \
|
||||
\
|
||||
$(if $(CONFIG_LIBCURL_LIBIDN2),--with-libidn2="$(STAGING_DIR)/usr",--without-libidn2) \
|
||||
$(if $(CONFIG_LIBCURL_SSH2),--with-libssh2="$(STAGING_DIR)/usr",--without-libssh2) \
|
||||
$(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
|
||||
$(if $(CONFIG_LIBCURL_NGHTTP2),--with-nghttp2="$(STAGING_DIR)/usr",--without-nghttp2) \
|
||||
\
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_DICT,dict) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_FILE,file) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_FTP,ftp) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_GOPHER,gopher) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_HTTP,http) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_IMAP,imap) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_LDAP,ldap) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_LDAPS,ldaps) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_POP3,pop3) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_RTSP,rtsp) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_SMB,smb) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_SMTP,smtp) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_TELNET,telnet) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_TFTP,tftp) \
|
||||
\
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_COOKIES,cookies) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_CRYPTO_AUTH,crypto-auth) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_LIBCURL_OPTION,libcurl-option) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_PROXY,proxy) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_THREADED_RESOLVER,threaded-resolver) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_TLS_SRP,tls-srp) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_UNIX_SOCKETS,unix-sockets) \
|
||||
$(call autoconf_bool,CONFIG_LIBCURL_VERBOSE,verbose) \
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
CC="$(TARGET_CC)" \
|
||||
install
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
|
||||
$(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
|
||||
[ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
|
||||
$(LN) $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
|
||||
endef
|
||||
|
||||
define Package/curl/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/libcurl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,curl))
|
||||
$(eval $(call BuildPackage,libcurl))
|
||||
@@ -0,0 +1,44 @@
|
||||
From 1b71bc532bde8621fd3260843f8197182a467ff2 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Thu, 7 Nov 2019 10:13:01 +0100
|
||||
Subject: [PATCH] file: on Windows, refuse paths that start with \\
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
... as that might cause an unexpected SMB connection to a given host
|
||||
name.
|
||||
|
||||
Reported-by: Fernando Muñoz
|
||||
CVE-2019-15601
|
||||
Bug: https://curl.haxx.se/docs/CVE-2019-15601.html
|
||||
|
||||
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
||||
---
|
||||
lib/file.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/file.c b/lib/file.c
|
||||
index d349cd9241cd..166931d7f1ba 100644
|
||||
--- a/lib/file.c
|
||||
+++ b/lib/file.c
|
||||
@@ -136,7 +136,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||
struct Curl_easy *data = conn->data;
|
||||
char *real_path;
|
||||
struct FILEPROTO *file = data->req.protop;
|
||||
- int fd;
|
||||
+ int fd = -1;
|
||||
#ifdef DOS_FILESYSTEM
|
||||
size_t i;
|
||||
char *actual_path;
|
||||
@@ -181,7 +181,9 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||
return CURLE_URL_MALFORMAT;
|
||||
}
|
||||
|
||||
- fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
|
||||
+ if(strncmp("\\\\", actual_path, 2))
|
||||
+ /* refuse to open path that starts with two backslashes */
|
||||
+ fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
|
||||
file->path = actual_path;
|
||||
#else
|
||||
if(memchr(real_path, 0, real_path_len)) {
|
||||
38
package/network/utils/curl/patches/101-CVE-2020-8169.patch
Normal file
38
package/network/utils/curl/patches/101-CVE-2020-8169.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 600a8cded447cd7118ed50142c576567c0cf5158 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Thu, 14 May 2020 14:37:12 +0200
|
||||
Subject: [PATCH] url: make the updated credentials URL-encoded in the URL
|
||||
|
||||
Found-by: Gregory Jefferis
|
||||
Reported-by: Jeroen Ooms
|
||||
Added test 1168 to verify. Bug spotted when doing a redirect.
|
||||
Bug: https://github.com/jeroen/curl/issues/224
|
||||
Closes #5400
|
||||
---
|
||||
lib/url.c | 6 ++--
|
||||
tests/data/Makefile.inc | 1 +
|
||||
tests/data/test1168 | 78 +++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 83 insertions(+), 2 deletions(-)
|
||||
create mode 100644 tests/data/test1168
|
||||
|
||||
diff --git a/lib/url.c b/lib/url.c
|
||||
index f250f2ff20a..9b8b2bdde64 100644
|
||||
--- a/lib/url.c
|
||||
+++ b/lib/url.c
|
||||
@@ -2788,12 +2788,14 @@ static CURLcode override_login(struct Curl_easy *data,
|
||||
|
||||
/* for updated strings, we update them in the URL */
|
||||
if(user_changed) {
|
||||
- uc = curl_url_set(data->state.uh, CURLUPART_USER, *userp, 0);
|
||||
+ uc = curl_url_set(data->state.uh, CURLUPART_USER, *userp,
|
||||
+ CURLU_URLENCODE);
|
||||
if(uc)
|
||||
return Curl_uc_to_curlcode(uc);
|
||||
}
|
||||
if(passwd_changed) {
|
||||
- uc = curl_url_set(data->state.uh, CURLUPART_PASSWORD, *passwdp, 0);
|
||||
+ uc = curl_url_set(data->state.uh, CURLUPART_PASSWORD, *passwdp,
|
||||
+ CURLU_URLENCODE);
|
||||
if(uc)
|
||||
return Curl_uc_to_curlcode(uc);
|
||||
}
|
||||
22
package/network/utils/curl/patches/200-no_docs_tests.patch
Normal file
22
package/network/utils/curl/patches/200-no_docs_tests.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -179,7 +179,7 @@ CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP)
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
SUBDIRS = lib src
|
||||
-DIST_SUBDIRS = $(SUBDIRS) tests packages scripts include docs
|
||||
+DIST_SUBDIRS = $(SUBDIRS) packages include
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libcurl.pc
|
||||
@@ -290,8 +290,8 @@ cygwinbin:
|
||||
# We extend the standard install with a custom hook:
|
||||
install-data-hook:
|
||||
cd include && $(MAKE) install
|
||||
- cd docs && $(MAKE) install
|
||||
- cd docs/libcurl && $(MAKE) install
|
||||
+ #cd docs && $(MAKE) install
|
||||
+ #cd docs/libcurl && $(MAKE) install
|
||||
|
||||
# We extend the standard uninstall with a custom hook:
|
||||
uninstall-hook:
|
||||
118
package/network/utils/dante/Makefile
Normal file
118
package/network/utils/dante/Makefile
Normal file
@@ -0,0 +1,118 @@
|
||||
#
|
||||
# Copyright (C) 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:=dante
|
||||
PKG_VERSION:=1.4.1
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.inet.no/dante/files/
|
||||
PKG_HASH:=b6d232bd6fefc87d14bf97e447e4fcdeef4b28b16b048d804b50b48f261c4f53
|
||||
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=BSD-4-Clause
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--without-upnp \
|
||||
--without-pam \
|
||||
--disable-libwrap
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
ac_cv_search_pam_start="" \
|
||||
ac_cv_func_sched_setscheduler=no
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{a,so*,la} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/dante/default
|
||||
TITLE:=Dante SOCKS
|
||||
URL:=http://www.inet.no/dante/
|
||||
endef
|
||||
|
||||
define Package/dante/default/description
|
||||
Dante is a circuit-level firewall/proxy that can be used to provide convenient
|
||||
and secure network connectivity, requiring only that the server Dante runs on
|
||||
has external network connectivity. Dante is used daily by Fortune 100 companies
|
||||
and large international organizations, either as a standard SOCKS server or as
|
||||
a "reverse proxy".
|
||||
endef
|
||||
|
||||
define Package/libsocks
|
||||
$(call Package/dante/default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE+= Library
|
||||
ABI_VERSION:=0
|
||||
endef
|
||||
|
||||
define Package/libsocks/description
|
||||
$(call Package/dante/default/description)
|
||||
This package provides the shared libsocks library.
|
||||
endef
|
||||
|
||||
define Package/libsocks/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsocks.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/sockd
|
||||
$(call Package/dante/default)
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE+= Daemon
|
||||
endef
|
||||
|
||||
define Package/sockd/description
|
||||
$(call Package/dante/default/description)
|
||||
This package provides the Dante sockd daemon.
|
||||
endef
|
||||
|
||||
define Package/sockd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/sockd $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
|
||||
define Package/socksify
|
||||
$(call Package/dante/default)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE+= Client
|
||||
endef
|
||||
|
||||
define Package/socksify/description
|
||||
$(call Package/dante/default/description)
|
||||
This package provides the Dante socksify client.
|
||||
endef
|
||||
|
||||
define Package/socksify/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/socksify $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libdsocks.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,libsocks))
|
||||
$(eval $(call BuildPackage,sockd))
|
||||
$(eval $(call BuildPackage,socksify))
|
||||
36
package/network/utils/dante/patches/200-fix-RTLD_NEXT.patch
Normal file
36
package/network/utils/dante/patches/200-fix-RTLD_NEXT.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
--- a/lib/address.c
|
||||
+++ b/lib/address.c
|
||||
@@ -48,11 +48,12 @@
|
||||
|
||||
#include "upnp.h"
|
||||
|
||||
-#ifndef __USE_GNU
|
||||
-#define __USE_GNU /* XXX for RTLD_NEXT on Linux */
|
||||
-#endif /* !__USE_GNU */
|
||||
#include <dlfcn.h>
|
||||
|
||||
+#ifndef RTLD_NEXT
|
||||
+#define RTLD_NEXT ((void *) -1l)
|
||||
+#endif
|
||||
+
|
||||
static const char rcsid[] =
|
||||
"$Id: address.c,v 1.288.4.4 2014/08/15 18:16:40 karls Exp $";
|
||||
|
||||
--- a/dlib/interposition.c
|
||||
+++ b/dlib/interposition.c
|
||||
@@ -93,11 +93,12 @@ write$NOCANCEL(HAVE_PROT_WRITE_1, HAVE_P
|
||||
|
||||
#endif /* HAVE_DARWIN */
|
||||
|
||||
-#ifndef __USE_GNU
|
||||
-#define __USE_GNU /* XXX for RTLD_NEXT on Linux */
|
||||
-#endif /* !__USE_GNU */
|
||||
#include <dlfcn.h>
|
||||
|
||||
+#ifndef RTLD_NEXT
|
||||
+#define RTLD_NEXT ((void *) -1l)
|
||||
+#endif
|
||||
+
|
||||
#ifdef __COVERITY__
|
||||
/*
|
||||
* Coverity naturally has no idea what the function sys_foo calls does,
|
||||
@@ -0,0 +1,53 @@
|
||||
When compiled with glibc the config_scan.c wants to use the
|
||||
cpupolicy2numeric() function which is only available when
|
||||
HAVE_SCHED_SETSCHEDULER is set. It looks like the wrong define was used here.
|
||||
|
||||
This fixes a build problem with glibc in combination with the force
|
||||
ac_cv_func_sched_setscheduler=no in the OpenWrt CONFIGURE_VARS.
|
||||
|
||||
--- a/lib/config_scan.c
|
||||
+++ b/lib/config_scan.c
|
||||
@@ -3891,7 +3891,7 @@ YY_RULE_SETUP
|
||||
SERRX(0);
|
||||
|
||||
#else /* !SOCKS_CLIENT */
|
||||
-#if HAVE_SCHED_SETAFFINITY
|
||||
+#if HAVE_SCHED_SETSCHEDULER
|
||||
|
||||
BEGIN(0);
|
||||
|
||||
@@ -3899,9 +3899,9 @@ YY_RULE_SETUP
|
||||
yyerrorx("unknown scheduling policy \"%s\"", yytext);
|
||||
|
||||
return SCHEDULEPOLICY;
|
||||
-#else /* !HAVE_SCHED_SETAFFINITY */
|
||||
+#else /* !HAVE_SCHED_SETSCHEDULER */
|
||||
yyerrorx("setting cpu scheduling policy is not supported on this platform");
|
||||
-#endif /* !HAVE_SCHED_SETAFFINITY */
|
||||
+#endif /* !HAVE_SCHED_SETSCHEDULER */
|
||||
|
||||
#endif /* SOCKS_CLIENT */
|
||||
}
|
||||
--- a/lib/config_scan.l
|
||||
+++ b/lib/config_scan.l
|
||||
@@ -456,7 +456,7 @@ cpu {
|
||||
SERRX(0);
|
||||
|
||||
#else /* !SOCKS_CLIENT */
|
||||
-#if HAVE_SCHED_SETAFFINITY
|
||||
+#if HAVE_SCHED_SETSCHEDULER
|
||||
|
||||
BEGIN(0);
|
||||
|
||||
@@ -464,9 +464,9 @@ cpu {
|
||||
yyerrorx("unknown scheduling policy \"%s\"", yytext);
|
||||
|
||||
return SCHEDULEPOLICY;
|
||||
-#else /* !HAVE_SCHED_SETAFFINITY */
|
||||
+#else /* !HAVE_SCHED_SETSCHEDULER */
|
||||
yyerrorx("setting cpu scheduling policy is not supported on this platform");
|
||||
-#endif /* !HAVE_SCHED_SETAFFINITY */
|
||||
+#endif /* !HAVE_SCHED_SETSCHEDULER */
|
||||
|
||||
#endif /* SOCKS_CLIENT */
|
||||
}
|
||||
72
package/network/utils/ebtables/Makefile
Normal file
72
package/network/utils/ebtables/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# 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:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://git.netfilter.org/ebtables
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=48cff25dfea5b37e16ba5dc6601e98ab140f5f99
|
||||
PKG_MIRROR_HASH:=1327cdc3402e5e3056819e4e9b6f9d4a5bfd401f2c4f58447afb2c3c73fc8aac
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ebtables
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Firewall
|
||||
DEPENDS:=+kmod-ebtables
|
||||
TITLE:=Ethernet bridge firewall administration utility
|
||||
URL:=http://ebtables.sourceforge.net/
|
||||
endef
|
||||
|
||||
define Package/ebtables-utils
|
||||
$(call Package/ebtables)
|
||||
DEPENDS += ebtables
|
||||
TITLE:=ebtables save/restore utilities
|
||||
endef
|
||||
|
||||
define Package/ebtables/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-utils/description
|
||||
$(call Package/ebtables/description)
|
||||
endef
|
||||
|
||||
MAKE_VARS += EXT_LIBSI="$(LIBGCC_S)"
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LIBDIR="/usr/lib/ebtables"
|
||||
|
||||
define Package/ebtables/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/
|
||||
endef
|
||||
|
||||
define Package/ebtables-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-save $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ebtables-restore $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ebtables))
|
||||
$(eval $(call BuildPackage,ebtables-utils))
|
||||
10
package/network/utils/ebtables/patches/100-musl_fix.patch
Normal file
10
package/network/utils/ebtables/patches/100-musl_fix.patch
Normal file
@@ -0,0 +1,10 @@
|
||||
--- a/include/ebtables_u.h
|
||||
+++ b/include/ebtables_u.h
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#ifndef EBTABLES_U_H
|
||||
#define EBTABLES_U_H
|
||||
+#define _NETINET_IF_ETHER_H
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <linux/netfilter_bridge/ebtables.h>
|
||||
@@ -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);
|
||||
}
|
||||
59
package/network/utils/ethtool/Makefile
Normal file
59
package/network/utils/ethtool/Makefile
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# 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:=5.2
|
||||
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:=665fd70841860d6cb974387e3ab97e0dde7745f95cb3ef35b98ef9aace137805
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_ETHTOOL_PRETTY_DUMP
|
||||
|
||||
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/
|
||||
endef
|
||||
|
||||
define Package/ethtool/description
|
||||
ethtool is a small utility for examining and tuning your ethernet-based
|
||||
network interface
|
||||
endef
|
||||
|
||||
define Package/ethtool/config
|
||||
config ETHTOOL_PRETTY_DUMP
|
||||
depends on PACKAGE_ethtool
|
||||
bool "Enable pretty printing"
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
|
||||
CONFIGURE_ARGS += --enable-pretty-dump
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-pretty-dump
|
||||
endif
|
||||
|
||||
define Package/ethtool/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ethtool))
|
||||
45
package/network/utils/iftop/Makefile
Normal file
45
package/network/utils/iftop/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (C) 2006 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:=iftop
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://code.blinkace.com/pdw/iftop.git
|
||||
PKG_SOURCE_DATE:=2018-10-03
|
||||
PKG_SOURCE_VERSION:=77901c8c53e01359d83b8090aacfe62214658183
|
||||
PKG_MIRROR_HASH:=219231541a437f5aecd497796be0202d337e13f141359a93595bf2cd8c5c5544
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iftop
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libpcap +libncurses +libpthread
|
||||
TITLE:=display bandwith usage on an interface
|
||||
URL:=http://www.ex-parrot.com/~pdw/iftop/
|
||||
endef
|
||||
|
||||
define Package/iftop/description
|
||||
iftop does for network usage what top(1) does for CPU usage. It
|
||||
listens to network traffic on a named interface and displays a
|
||||
table of current bandwidth usage by pairs of hosts. Handy for
|
||||
answering the question 'why is our ADSL link so slow?'.
|
||||
endef
|
||||
|
||||
define Package/iftop/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/iftop $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iftop))
|
||||
55
package/network/utils/iperf/Makefile
Normal file
55
package/network/utils/iperf/Makefile
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# Copyright (C) 2007-2010 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:=iperf
|
||||
PKG_VERSION:=2.0.13
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_HASH:=c88adec966096a81136dda91b4bd19c27aae06df4d45a7f547a8e50d723778ad
|
||||
PKG_SOURCE_URL:=@SF/iperf2
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iperf
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:= $(CXX_DEPENDS) +libpthread
|
||||
TITLE:=Internet Protocol bandwidth measuring tool
|
||||
URL:=http://sourceforge.net/projects/iperf2/
|
||||
endef
|
||||
|
||||
define Package/iperf/description
|
||||
Iperf is a modern alternative for measuring TCP and UDP bandwidth
|
||||
performance, allowing the tuning of various parameters and
|
||||
characteristics.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -D_GNU_SOURCE
|
||||
CONFIGURE_ARGS += --disable-multicast
|
||||
|
||||
ifeq ($(CONFIG_IPV6),)
|
||||
CONFIGURE_ARGS += --disable-ipv6
|
||||
endif
|
||||
|
||||
CONFIGURE_VARS += CXXFLAGS="$$$$CXXFLAGS -fno-rtti"
|
||||
CONFIGURE_VARS += LIBS="-lpthread -lm"
|
||||
|
||||
define Package/iperf/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/iperf $(1)/usr/bin/iperf
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iperf))
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/src/Listener.cpp
|
||||
+++ b/src/Listener.cpp
|
||||
@@ -723,6 +723,7 @@ int Listener::L2_setup (void) {
|
||||
|
||||
// Now optimize packet flow up the raw socket
|
||||
// Establish the flow BPF to forward up only "connected" packets to this raw socket
|
||||
+#ifdef HAVE_IPV6
|
||||
if (l->sa_family == AF_INET6) {
|
||||
#ifdef HAVE_IPV6
|
||||
struct in6_addr *v6peer = SockAddr_get_in6_addr(&server->peer);
|
||||
@@ -740,6 +741,9 @@ int Listener::L2_setup (void) {
|
||||
return -1;
|
||||
#endif /* HAVE_IPV6 */
|
||||
} else {
|
||||
+#else
|
||||
+ {
|
||||
+#endif
|
||||
rc = SockAddr_v4_Connect_BPF(server->mSock, ((struct sockaddr_in *)(l))->sin_addr.s_addr, ((struct sockaddr_in *)(p))->sin_addr.s_addr, ((struct sockaddr_in *)(l))->sin_port, ((struct sockaddr_in *)(p))->sin_port);
|
||||
WARN_errno( rc == SOCKET_ERROR, "l2 connect ip bpf");
|
||||
}
|
||||
83
package/network/utils/iperf3/Makefile
Normal file
83
package/network/utils/iperf3/Makefile
Normal file
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# Copyright (C) 2007-2010 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:=iperf
|
||||
PKG_VERSION:=3.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf
|
||||
PKG_HASH:=d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
DISABLE_NLS:=
|
||||
|
||||
define Package/iperf3/default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Internet Protocol bandwidth measuring tool
|
||||
URL:=https://github.com/esnet/iperf
|
||||
endef
|
||||
|
||||
define Package/iperf3
|
||||
$(call Package/iperf3/default)
|
||||
VARIANT:=nossl
|
||||
endef
|
||||
|
||||
define Package/iperf3-ssl
|
||||
$(call Package/iperf3/default)
|
||||
TITLE+= with iperf_auth support
|
||||
VARIANT:=ssl
|
||||
DEPENDS:= +libopenssl
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -D_GNU_SOURCE
|
||||
CONFIGURE_ARGS += --disable-shared
|
||||
|
||||
ifeq ($(BUILD_VARIANT),ssl)
|
||||
CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS += --without-openssl
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += noinst_PROGRAMS=
|
||||
|
||||
define Package/iperf3/description
|
||||
Iperf is a modern alternative for measuring TCP and UDP bandwidth
|
||||
performance, allowing the tuning of various parameters and
|
||||
characteristics.
|
||||
endef
|
||||
|
||||
# autoreconf fails if the README file isn't present
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
touch $(PKG_BUILD_DIR)/README
|
||||
endef
|
||||
|
||||
define Package/iperf3/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iperf3-ssl/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iperf3 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iperf3))
|
||||
$(eval $(call BuildPackage,iperf3-ssl))
|
||||
209
package/network/utils/iproute2/Makefile
Normal file
209
package/network/utils/iproute2/Makefile
Normal file
@@ -0,0 +1,209 @@
|
||||
#
|
||||
# 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:=5.0.0
|
||||
PKG_RELEASE:=2.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
||||
PKG_HASH:=df047302a39650ef832c07e8dab5df7a23218cd398bd310c8628e386161d20ba
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=iptables
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
|
||||
|
||||
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:=tiny
|
||||
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:=full
|
||||
PROVIDES:=ip
|
||||
ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
|
||||
DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libcap
|
||||
endef
|
||||
|
||||
define Package/tc
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Traffic control utility
|
||||
VARIANT:=tc
|
||||
PROVIDES:=tc
|
||||
DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/genl
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=General netlink utility frontend
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/ip-bridge
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Bridge configuration utility from iproute2
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/ss
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Socket statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/nstat
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network statistics utility
|
||||
DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/devlink
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network devlink utility
|
||||
DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
define Package/rdma
|
||||
$(call Package/iproute2/Default)
|
||||
TITLE:=Network rdma utility
|
||||
DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tiny)
|
||||
IP_CONFIG_TINY:=y
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
HAVE_ELF:=y
|
||||
HAVE_CAP:=y
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),tc)
|
||||
HAVE_ELF:=y
|
||||
SHARED_LIBS:=y
|
||||
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_CFLAGS += -ffunction-sections -fdata-sections
|
||||
TARGET_LDFLAGS += -Wl,--gc-sections
|
||||
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||
|
||||
MAKE_FLAGS += \
|
||||
KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
|
||||
SHARED_LIBS=$(SHARED_LIBS) \
|
||||
IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
|
||||
HAVE_ELF=$(HAVE_ELF) \
|
||||
HAVE_MNL=$(HAVE_MNL) \
|
||||
HAVE_CAP=$(HAVE_CAP) \
|
||||
IPT_LIB_DIR=/usr/lib/iptables \
|
||||
XT_LIB_DIR=/usr/lib/iptables \
|
||||
FPIC="$(FPIC)"
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(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/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
|
||||
ifeq ($(SHARED_LIBS),y)
|
||||
$(INSTALL_DIR) $(1)/usr/lib/tc
|
||||
$(CP) $(PKG_BUILD_DIR)/tc/*.so $(1)/usr/lib/tc
|
||||
endif
|
||||
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))
|
||||
$(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))
|
||||
23
package/network/utils/iproute2/files/15-teql
Normal file
23
package/network/utils/iproute2/files/15-teql
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
config_load network
|
||||
|
||||
config_get teql $INTERFACE teql
|
||||
|
||||
if [ "$teql" != "" ]; then
|
||||
logger Adding device $DEVICE to TEQL master $teql
|
||||
insmod sch_teql
|
||||
tc qdisc add dev $DEVICE root $teql
|
||||
|
||||
# The kernel doesn't let us bring it up until it has at least one
|
||||
# slave. So bring it up now, if it isn't already.
|
||||
if ! cat /sys/class/net/$teql/carrier &>/dev/null; then
|
||||
ifup $teql &
|
||||
fi
|
||||
fi
|
||||
152
package/network/utils/iproute2/patches/010-cake-fwmark.patch
Normal file
152
package/network/utils/iproute2/patches/010-cake-fwmark.patch
Normal file
@@ -0,0 +1,152 @@
|
||||
From a7cd7badedcb643dc1adb41edeb4cf8e4d9ec063 Mon Sep 17 00:00:00 2001
|
||||
From: Stephen Hemminger <stephen@networkplumber.org>
|
||||
Date: Tue, 19 Mar 2019 10:36:56 -0700
|
||||
Subject: uapi: add CAKE FWMARK
|
||||
|
||||
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
||||
---
|
||||
include/uapi/linux/pkt_sched.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
|
||||
index 1eb572e..7ee74c3 100644
|
||||
--- a/include/uapi/linux/pkt_sched.h
|
||||
+++ b/include/uapi/linux/pkt_sched.h
|
||||
@@ -1021,6 +1021,7 @@ enum {
|
||||
TCA_CAKE_INGRESS,
|
||||
TCA_CAKE_ACK_FILTER,
|
||||
TCA_CAKE_SPLIT_GSO,
|
||||
+ TCA_CAKE_FWMARK,
|
||||
__TCA_CAKE_MAX
|
||||
};
|
||||
#define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1)
|
||||
|
||||
From 5ebfe1f6fea2bb3bfccf4cf93829516caaa0233d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
|
||||
Date: Mon, 18 Mar 2019 01:30:45 +0100
|
||||
Subject: [PATCH] q_cake: Add support for setting the fwmark option
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This adds support for the newly added fwmark option to CAKE, which allows
|
||||
overriding the tin selection from the per-packet firewall marks. The fwmark
|
||||
field is a bitmask that is applied to the fwmark to select the tin.
|
||||
|
||||
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
|
||||
---
|
||||
man/man8/tc-cake.8 | 16 ++++++++++++++++
|
||||
tc/q_cake.c | 24 ++++++++++++++++++++++++
|
||||
2 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/man/man8/tc-cake.8 b/man/man8/tc-cake.8
|
||||
index eda436e1..8c57eadd 100644
|
||||
--- a/man/man8/tc-cake.8
|
||||
+++ b/man/man8/tc-cake.8
|
||||
@@ -91,6 +91,10 @@ TIME |
|
||||
LIMIT ]
|
||||
.br
|
||||
[
|
||||
+.BR fwmark
|
||||
+MASK ]
|
||||
+.br
|
||||
+[
|
||||
.BR ptm
|
||||
|
|
||||
.BR atm
|
||||
@@ -524,6 +528,18 @@ preset on the modern Internet is firmly discouraged.
|
||||
.br
|
||||
Voice (CS7, CS6, EF, VA, TOS4), 25% threshold, reduced Codel interval.
|
||||
|
||||
+.PP
|
||||
+.B fwmark
|
||||
+MASK
|
||||
+.br
|
||||
+ This options turns on fwmark-based overriding of CAKE's tin selection.
|
||||
+If set, the option specifies a bitmask that will be applied to the fwmark
|
||||
+associated with each packet. If the result of this masking is non-zero, the
|
||||
+result will be right-shifted by the number of least-significant unset bits in
|
||||
+the mask value, and the result will be used as a the tin number for that packet.
|
||||
+This can be used to set policies in a firewall script that will override CAKE's
|
||||
+built-in tin selection.
|
||||
+
|
||||
.SH OTHER PARAMETERS
|
||||
.B memlimit
|
||||
LIMIT
|
||||
diff --git a/tc/q_cake.c b/tc/q_cake.c
|
||||
index e827e3f1..307a12c0 100644
|
||||
--- a/tc/q_cake.c
|
||||
+++ b/tc/q_cake.c
|
||||
@@ -82,6 +82,7 @@ static void explain(void)
|
||||
" [ split-gso* | no-split-gso ]\n"
|
||||
" [ ack-filter | ack-filter-aggressive | no-ack-filter* ]\n"
|
||||
" [ memlimit LIMIT ]\n"
|
||||
+" [ fwmark MASK ]\n"
|
||||
" [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n"
|
||||
" [ mpu N ] [ ingress | egress* ]\n"
|
||||
" (* marks defaults)\n");
|
||||
@@ -106,6 +107,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
int autorate = -1;
|
||||
int ingress = -1;
|
||||
int overhead = 0;
|
||||
+ int fwmark = -1;
|
||||
int wash = -1;
|
||||
int nat = -1;
|
||||
int atm = -1;
|
||||
@@ -332,6 +334,16 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
"Illegal value for \"memlimit\": \"%s\"\n", *argv);
|
||||
return -1;
|
||||
}
|
||||
+ } else if (strcmp(*argv, "fwmark") == 0) {
|
||||
+ unsigned int fwm;
|
||||
+
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u32(&fwm, *argv, 0)) {
|
||||
+ fprintf(stderr,
|
||||
+ "Illegal value for \"fwmark\": \"%s\"\n", *argv);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ fwmark = fwm;
|
||||
} else if (strcmp(*argv, "help") == 0) {
|
||||
explain();
|
||||
return -1;
|
||||
@@ -376,6 +388,9 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||
if (memlimit)
|
||||
addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit,
|
||||
sizeof(memlimit));
|
||||
+ if (fwmark != -1)
|
||||
+ addattr_l(n, 1024, TCA_CAKE_FWMARK, &fwmark,
|
||||
+ sizeof(fwmark));
|
||||
if (nat != -1)
|
||||
addattr_l(n, 1024, TCA_CAKE_NAT, &nat, sizeof(nat));
|
||||
if (wash != -1)
|
||||
@@ -409,6 +424,7 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
struct rtattr *tb[TCA_CAKE_MAX + 1];
|
||||
unsigned int interval = 0;
|
||||
unsigned int memlimit = 0;
|
||||
+ unsigned int fwmark = 0;
|
||||
__u64 bandwidth = 0;
|
||||
int ack_filter = 0;
|
||||
int split_gso = 0;
|
||||
@@ -507,6 +523,10 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
RTA_PAYLOAD(tb[TCA_CAKE_RTT]) >= sizeof(__u32)) {
|
||||
interval = rta_getattr_u32(tb[TCA_CAKE_RTT]);
|
||||
}
|
||||
+ if (tb[TCA_CAKE_FWMARK] &&
|
||||
+ RTA_PAYLOAD(tb[TCA_CAKE_FWMARK]) >= sizeof(__u32)) {
|
||||
+ fwmark = rta_getattr_u32(tb[TCA_CAKE_FWMARK]);
|
||||
+ }
|
||||
|
||||
if (wash)
|
||||
print_string(PRINT_FP, NULL, "wash ", NULL);
|
||||
@@ -559,6 +579,10 @@ static int cake_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
|
||||
sprint_size(memlimit, b1));
|
||||
}
|
||||
|
||||
+ if (fwmark)
|
||||
+ print_uint(PRINT_FP, NULL, "fwmark 0x%x ", fwmark);
|
||||
+ print_0xhex(PRINT_JSON, "fwmark", NULL, fwmark);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,589 @@
|
||||
From dff8eadcab33209e040e77a5d56d5def04808144 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Date: Fri, 15 Mar 2019 09:35:37 +0000
|
||||
Subject: [PATCH] tc: add support for action act_ctinfo
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
ctinfo is a tc action restoring data stored in conntrack marks to
|
||||
various fields. At present it has two independent modes of operation,
|
||||
restoration of DSCP into IPv4/v6 diffserv and restoration of conntrack
|
||||
marks into packet skb marks.
|
||||
|
||||
It understands a number of parameters specific to this action in
|
||||
additional to the usual action syntax. Each operating mode is
|
||||
independent of the other so all options are optional, however not
|
||||
specifying at least one mode is a bit pointless.
|
||||
|
||||
Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
|
||||
[CONTROL] [index <INDEX>]
|
||||
|
||||
DSCP mode
|
||||
|
||||
dscp enables copying of a DSCP stored in the conntrack mark into the
|
||||
ipv4/v6 diffserv field. The mask is a 32bit field and specifies where
|
||||
in the conntrack mark the DSCP value is located. It must be 6
|
||||
contiguous bits long. eg. 0xfc000000 would restore the DSCP from the
|
||||
upper 6 bits of the conntrack mark.
|
||||
|
||||
The DSCP copying may be optionally controlled by a statemask. The
|
||||
statemask is a 32bit field, usually with a single bit set and must not
|
||||
overlap the dscp mask. The DSCP restore operation will only take place
|
||||
if the corresponding bit/s in conntrack mark ANDed with the statemask
|
||||
yield a non zero result.
|
||||
|
||||
eg. dscp 0xfc000000 0x01000000 would retrieve the DSCP from the top 6
|
||||
bits, whilst using bit 25 as a flag to do so. Bit 26 is unused in this
|
||||
example.
|
||||
|
||||
CPMARK mode
|
||||
|
||||
cpmark enables copying of the conntrack mark to the packet skb mark. In
|
||||
this mode it is completely equivalent to the existing act_connmark
|
||||
action. Additional functionality is provided by the optional mask
|
||||
parameter, whereby the stored conntrack mark is logically ANDed with the
|
||||
cpmark mask before being stored into skb mark. This allows shared usage
|
||||
of the conntrack mark between applications.
|
||||
|
||||
eg. cpmark 0x00ffffff would restore only the lower 24 bits of the
|
||||
conntrack mark, thus may be useful in the event that the upper 8 bits
|
||||
are used by the DSCP function.
|
||||
|
||||
Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE]
|
||||
[CONTROL] [index <INDEX>]
|
||||
where :
|
||||
dscp MASK is the bitmask to restore DSCP
|
||||
STATEMASK is the bitmask to determine conditional restoring
|
||||
cpmark MASK mask applied to restored packet mark
|
||||
ZONE is the conntrack zone
|
||||
CONTROL := reclassify | pipe | drop | continue | ok |
|
||||
goto chain <CHAIN_INDEX>
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
|
||||
---
|
||||
include/uapi/linux/pkt_cls.h | 3 +-
|
||||
include/uapi/linux/tc_act/tc_ctinfo.h | 29 +++
|
||||
man/man8/tc-ctinfo.8 | 170 ++++++++++++++++
|
||||
tc/Makefile | 1 +
|
||||
tc/m_ctinfo.c | 268 ++++++++++++++++++++++++++
|
||||
5 files changed, 470 insertions(+), 1 deletion(-)
|
||||
create mode 100644 include/uapi/linux/tc_act/tc_ctinfo.h
|
||||
create mode 100644 man/man8/tc-ctinfo.8
|
||||
create mode 100644 tc/m_ctinfo.c
|
||||
|
||||
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
|
||||
index 95d0db2a..a6e7e176 100644
|
||||
--- a/include/uapi/linux/pkt_cls.h
|
||||
+++ b/include/uapi/linux/pkt_cls.h
|
||||
@@ -68,7 +68,8 @@ enum {
|
||||
TCA_ID_UNSPEC=0,
|
||||
TCA_ID_POLICE=1,
|
||||
/* other actions go here */
|
||||
- __TCA_ID_MAX=255
|
||||
+ TCA_ID_CTINFO=27,
|
||||
+ __TCA_ID_MAX = 255
|
||||
};
|
||||
|
||||
#define TCA_ID_MAX __TCA_ID_MAX
|
||||
diff --git a/include/uapi/linux/tc_act/tc_ctinfo.h b/include/uapi/linux/tc_act/tc_ctinfo.h
|
||||
new file mode 100644
|
||||
index 00000000..f5f26d95
|
||||
--- /dev/null
|
||||
+++ b/include/uapi/linux/tc_act/tc_ctinfo.h
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
+#ifndef __UAPI_TC_CTINFO_H
|
||||
+#define __UAPI_TC_CTINFO_H
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/pkt_cls.h>
|
||||
+
|
||||
+struct tc_ctinfo {
|
||||
+ tc_gen;
|
||||
+};
|
||||
+
|
||||
+enum {
|
||||
+ TCA_CTINFO_UNSPEC,
|
||||
+ TCA_CTINFO_PAD,
|
||||
+ TCA_CTINFO_TM,
|
||||
+ TCA_CTINFO_ACT,
|
||||
+ TCA_CTINFO_ZONE,
|
||||
+ TCA_CTINFO_PARMS_DSCP_MASK,
|
||||
+ TCA_CTINFO_PARMS_DSCP_STATEMASK,
|
||||
+ TCA_CTINFO_PARMS_CPMARK_MASK,
|
||||
+ TCA_CTINFO_STATS_DSCP_SET,
|
||||
+ TCA_CTINFO_STATS_DSCP_ERROR,
|
||||
+ TCA_CTINFO_STATS_CPMARK_SET,
|
||||
+ __TCA_CTINFO_MAX
|
||||
+};
|
||||
+
|
||||
+#define TCA_CTINFO_MAX (__TCA_CTINFO_MAX - 1)
|
||||
+
|
||||
+#endif
|
||||
diff --git a/man/man8/tc-ctinfo.8 b/man/man8/tc-ctinfo.8
|
||||
new file mode 100644
|
||||
index 00000000..096590d1
|
||||
--- /dev/null
|
||||
+++ b/man/man8/tc-ctinfo.8
|
||||
@@ -0,0 +1,170 @@
|
||||
+.TH "ctinfo action in tc" 8 "4 Jun 2019" "iproute2" "Linux"
|
||||
+.SH NAME
|
||||
+ctinfo \- tc connmark processing action
|
||||
+.SH SYNOPSIS
|
||||
+.B tc ... action ctinfo
|
||||
+[
|
||||
+.B dscp
|
||||
+MASK [STATEMASK] ] [
|
||||
+.B cpmark
|
||||
+[MASK] ] [
|
||||
+.B zone
|
||||
+ZONE ] [
|
||||
+.B CONTROL
|
||||
+] [
|
||||
+.B index
|
||||
+<INDEX>
|
||||
+]
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+CTINFO (Conntrack Information) is a tc action for retrieving data from
|
||||
+conntrack marks into various fields. At present it has two independent
|
||||
+processing modes which may be viewed as sub-functions.
|
||||
+
|
||||
+DSCP mode copies a DSCP stored in conntrack's connmark into the IPv4/v6 diffserv
|
||||
+field. The copying may conditionally occur based on a flag also stored in the
|
||||
+connmark. DSCP mode was designed to assist in restoring packet classifications on
|
||||
+ingress, classifications which may then be used by qdiscs such as CAKE. It may be
|
||||
+used in any circumstance where ingress classification needs to be maintained across
|
||||
+links that otherwise bleach or remap according to their own policies.
|
||||
+
|
||||
+CPMARK (copymark) mode copies the conntrack connmark into the packet's mark field. Without
|
||||
+additional parameters it is functionally completely equivalent to the existing
|
||||
+connmark action. An optional mask may be specified to mask which bits of the
|
||||
+connmark are restored. This may be useful when DSCP and CPMARK modes are combined.
|
||||
+
|
||||
+Simple statistics (tc -s) on DSCP restores and CPMARK copies are maintained where values for
|
||||
+set indicate a count of packets altered for that mode. DSCP includes an error count
|
||||
+where the destination packet's diffserv field was unwriteable.
|
||||
+.SH PARAMETERS
|
||||
+.SS DSCP mode parameters:
|
||||
+.IP mask
|
||||
+A mask of 6 contiguous bits indicating where the DSCP value is located in the 32 bit
|
||||
+conntrack mark field. A mask must be provided for this mode. mask is a 32 bit
|
||||
+unsigned value.
|
||||
+.IP statemask
|
||||
+A mask of at least 1 bit indicating where a conditional restore flag is located in the
|
||||
+32 bit conntrack mark field. The statemask bit/s must NOT overlap the mask bits. The
|
||||
+DSCP will be restored if the conntrack mark logically ANDed with the statemask yields
|
||||
+a non-zero result. statemask is an optional unsigned 32 bit value.
|
||||
+.SS CPMARK mode parameters:
|
||||
+.IP mask
|
||||
+Store the logically ANDed result of conntrack mark and mask into the packet's mark
|
||||
+field. Default is 0xffffffff i.e. the whole mark field. mask is an optional unsigned 32 bit
|
||||
+value
|
||||
+.SS Overall action parameters:
|
||||
+.IP zone
|
||||
+Specify the conntrack zone when doing conntrack lookups for packets.
|
||||
+zone is a 16bit unsigned decimal value.
|
||||
+Default is 0.
|
||||
+.IP CONTROL
|
||||
+The following keywords allow to control how the tree of qdisc, classes,
|
||||
+filters and actions is further traversed after this action.
|
||||
+.RS
|
||||
+.TP
|
||||
+.B reclassify
|
||||
+Restart with the first filter in the current list.
|
||||
+.TP
|
||||
+.B pipe
|
||||
+Continue with the next action attached to the same filter.
|
||||
+.TP
|
||||
+.B drop
|
||||
+Drop the packet.
|
||||
+.TP
|
||||
+.B shot
|
||||
+synonym for
|
||||
+.B drop
|
||||
+.TP
|
||||
+.B continue
|
||||
+Continue classification with the next filter in line.
|
||||
+.TP
|
||||
+.B pass
|
||||
+Finish classification process and return to calling qdisc for further packet
|
||||
+processing. This is the default.
|
||||
+.RE
|
||||
+.IP index
|
||||
+Specify an index for this action in order to being able to identify it in later
|
||||
+commands. index is a 32bit unsigned decimal value.
|
||||
+.SH EXAMPLES
|
||||
+Example showing conditional restoration of DSCP on ingress via an IFB
|
||||
+.RS
|
||||
+.EX
|
||||
+
|
||||
+#Set up the IFB interface
|
||||
+.br
|
||||
+tc qdisc add dev ifb4eth0 handle ffff: ingress
|
||||
+
|
||||
+#Put CAKE qdisc on it
|
||||
+.br
|
||||
+tc qdisc add dev ifb4eth0 root cake bandwidth 40mbit
|
||||
+
|
||||
+#Set interface UP
|
||||
+.br
|
||||
+ip link set dev ifb4eth0 up
|
||||
+
|
||||
+#Add 2 actions, ctinfo to restore dscp & mirred to redirect the packets to IFB
|
||||
+.br
|
||||
+tc filter add dev eth0 parent ffff: protocol all prio 10 u32 \\
|
||||
+ match u32 0 0 flowid 1:1 action \\
|
||||
+ ctinfo dscp 0xfc000000 0x01000000 \\
|
||||
+ mirred egress redirect dev ifb4eth0
|
||||
+
|
||||
+tc -s qdisc show dev eth0 ingress
|
||||
+
|
||||
+ filter parent ffff: protocol all pref 10 u32 chain 0
|
||||
+ filter parent ffff: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
|
||||
+ filter parent ffff: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw
|
||||
+ match 00000000/00000000 at 0
|
||||
+ action order 1: ctinfo zone 0 pipe
|
||||
+ index 2 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 72 sec used 0 sec DSCP set 1333 error 0 CPMARK set 0
|
||||
+ Action statistics:
|
||||
+ Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0)
|
||||
+ backlog 0b 0p requeues 0
|
||||
+
|
||||
+ action order 2: mirred (Egress Redirect to device ifb4eth0) stolen
|
||||
+ index 1 ref 1 bind 1 installed 72 sec used 0 sec
|
||||
+ Action statistics:
|
||||
+ Sent 658484 bytes 1833 pkt (dropped 0, overlimits 0 requeues 0)
|
||||
+ backlog 0b 0p requeues 0
|
||||
+.EE
|
||||
+.RE
|
||||
+
|
||||
+Example showing conditional restoration of DSCP on egress
|
||||
+
|
||||
+This may appear nonsensical since iptables marking of egress packets is easy
|
||||
+to achieve, however the iptables flow classification rules may be extensive
|
||||
+and so some sort of set once and forget may be useful especially on cpu
|
||||
+constrained devices.
|
||||
+.RS
|
||||
+.EX
|
||||
+
|
||||
+# Send unmarked connections to a marking chain which needs to store a DSCP
|
||||
+and set statemask bit in the connmark
|
||||
+.br
|
||||
+iptables -t mangle -A POSTROUTING -o eth0 -m connmark \\
|
||||
+ --mark 0x00000000/0x01000000 -g CLASS_MARKING_CHAIN
|
||||
+
|
||||
+# Apply marked DSCP to the packets
|
||||
+.br
|
||||
+tc filter add dev eth0 protocol all prio 10 u32 \\
|
||||
+ match u32 0 0 flowid 1:1 action \\
|
||||
+ ctinfo dscp 0xfc000000 0x01000000
|
||||
+
|
||||
+tc -s filter show dev eth0
|
||||
+ filter parent 800e: protocol all pref 10 u32 chain 0
|
||||
+ filter parent 800e: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
|
||||
+ filter parent 800e: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 not_in_hw
|
||||
+ match 00000000/00000000 at 0
|
||||
+ action order 1: ctinfo zone 0 pipe
|
||||
+ index 1 ref 1 bind 1 dscp 0xfc000000 0x01000000 installed 7414 sec used 0 sec DSCP set 53404 error 0 CPMARK set 0
|
||||
+ Action statistics:
|
||||
+ Sent 32890260 bytes 120441 pkt (dropped 0, overlimits 0 requeues 0)
|
||||
+ backlog 0b 0p requeues 0
|
||||
+.br
|
||||
+.SH SEE ALSO
|
||||
+.BR tc (8),
|
||||
+.BR tc-cake (8)
|
||||
+.BR tc-connmark (8)
|
||||
+.BR tc-mirred (8)
|
||||
+.SH AUTHORS
|
||||
+ctinfo was written by Kevin Darbyshire-Bryant.
|
||||
diff --git a/tc/Makefile b/tc/Makefile
|
||||
index 2edaf2c8..ec93a9a1 100644
|
||||
--- a/tc/Makefile
|
||||
+++ b/tc/Makefile
|
||||
@@ -48,6 +48,7 @@ TCMODULES += m_csum.o
|
||||
TCMODULES += m_simple.o
|
||||
TCMODULES += m_vlan.o
|
||||
TCMODULES += m_connmark.o
|
||||
+TCMODULES += m_ctinfo.o
|
||||
TCMODULES += m_bpf.o
|
||||
TCMODULES += m_tunnel_key.o
|
||||
TCMODULES += m_sample.o
|
||||
diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c
|
||||
new file mode 100644
|
||||
index 00000000..5e451f87
|
||||
--- /dev/null
|
||||
+++ b/tc/m_ctinfo.c
|
||||
@@ -0,0 +1,268 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * m_ctinfo.c netfilter ctinfo mark action
|
||||
+ *
|
||||
+ * Copyright (c) 2019 Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
+ */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include "utils.h"
|
||||
+#include "tc_util.h"
|
||||
+#include <linux/tc_act/tc_ctinfo.h>
|
||||
+
|
||||
+static void
|
||||
+explain(void)
|
||||
+{
|
||||
+ fprintf(stderr,
|
||||
+ "Usage: ... ctinfo [dscp mask [statemask]] [cpmark [mask]] [zone ZONE] [CONTROL] [index <INDEX>]\n"
|
||||
+ "where :\n"
|
||||
+ "\tdscp MASK bitmask location of stored DSCP\n"
|
||||
+ "\t STATEMASK bitmask to determine conditional restoring\n"
|
||||
+ "\tcpmark MASK mask applied to mark on restoration\n"
|
||||
+ "\tZONE is the conntrack zone\n"
|
||||
+ "\tCONTROL := reclassify | pipe | drop | continue | ok |\n"
|
||||
+ "\t goto chain <CHAIN_INDEX>\n");
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+usage(void)
|
||||
+{
|
||||
+ explain();
|
||||
+ exit(-1);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+parse_ctinfo(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
||||
+ struct nlmsghdr *n)
|
||||
+{
|
||||
+ unsigned int cpmarkmask = 0, dscpmask = 0, dscpstatemask = 0;
|
||||
+ struct tc_ctinfo sel = {};
|
||||
+ unsigned short zone = 0;
|
||||
+ char **argv = *argv_p;
|
||||
+ struct rtattr *tail;
|
||||
+ int argc = *argc_p;
|
||||
+ int ok = 0;
|
||||
+ __u8 i;
|
||||
+
|
||||
+ while (argc > 0) {
|
||||
+ if (matches(*argv, "ctinfo") == 0) {
|
||||
+ ok = 1;
|
||||
+ NEXT_ARG_FWD();
|
||||
+ } else if (matches(*argv, "help") == 0) {
|
||||
+ usage();
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ if (!ok) {
|
||||
+ explain();
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (argc) {
|
||||
+ if (matches(*argv, "dscp") == 0) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u32(&dscpmask, *argv, 0)) {
|
||||
+ fprintf(stderr,
|
||||
+ "ctinfo: Illegal dscp \"mask\"\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (NEXT_ARG_OK()) {
|
||||
+ NEXT_ARG_FWD();
|
||||
+ if (!get_u32(&dscpstatemask, *argv, 0))
|
||||
+ NEXT_ARG_FWD(); /* was a statemask */
|
||||
+ } else {
|
||||
+ NEXT_ARG_FWD();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* cpmark has optional mask parameter, so the next arg might not */
|
||||
+ /* exist, or it might be the next option, or it may actually be a */
|
||||
+ /* 32bit mask */
|
||||
+ if (argc) {
|
||||
+ if (matches(*argv, "cpmark") == 0) {
|
||||
+ cpmarkmask = ~0;
|
||||
+ if (NEXT_ARG_OK()) {
|
||||
+ NEXT_ARG_FWD();
|
||||
+ if (!get_u32(&cpmarkmask, *argv, 0))
|
||||
+ NEXT_ARG_FWD(); /* was a mask */
|
||||
+ } else {
|
||||
+ NEXT_ARG_FWD();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (argc) {
|
||||
+ if (matches(*argv, "zone") == 0) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u16(&zone, *argv, 10)) {
|
||||
+ fprintf(stderr, "ctinfo: Illegal \"zone\"\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ NEXT_ARG_FWD();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ parse_action_control_dflt(&argc, &argv, &sel.action,
|
||||
+ false, TC_ACT_PIPE);
|
||||
+
|
||||
+ if (argc) {
|
||||
+ if (matches(*argv, "index") == 0) {
|
||||
+ NEXT_ARG();
|
||||
+ if (get_u32(&sel.index, *argv, 10)) {
|
||||
+ fprintf(stderr, "ctinfo: Illegal \"index\"\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ NEXT_ARG_FWD();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (dscpmask & dscpstatemask) {
|
||||
+ fprintf(stderr,
|
||||
+ "ctinfo: dscp mask & statemask must NOT overlap\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ i = ffs(dscpmask);
|
||||
+ if (i && ((~0 & (dscpmask >> (i - 1))) != 0x3f)) {
|
||||
+ fprintf(stderr,
|
||||
+ "ctinfo: dscp mask must be 6 contiguous bits long\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||
+ addattr_l(n, MAX_MSG, TCA_CTINFO_ACT, &sel, sizeof(sel));
|
||||
+ addattr16(n, MAX_MSG, TCA_CTINFO_ZONE, zone);
|
||||
+
|
||||
+ if (dscpmask)
|
||||
+ addattr32(n, MAX_MSG,
|
||||
+ TCA_CTINFO_PARMS_DSCP_MASK, dscpmask);
|
||||
+
|
||||
+ if (dscpstatemask)
|
||||
+ addattr32(n, MAX_MSG,
|
||||
+ TCA_CTINFO_PARMS_DSCP_STATEMASK, dscpstatemask);
|
||||
+
|
||||
+ if (cpmarkmask)
|
||||
+ addattr32(n, MAX_MSG,
|
||||
+ TCA_CTINFO_PARMS_CPMARK_MASK, cpmarkmask);
|
||||
+
|
||||
+ addattr_nest_end(n, tail);
|
||||
+
|
||||
+ *argc_p = argc;
|
||||
+ *argv_p = argv;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1])
|
||||
+{
|
||||
+ struct tcf_t *tm;
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_TM]) {
|
||||
+ tm = RTA_DATA(tb[TCA_CTINFO_TM]);
|
||||
+
|
||||
+ print_tm(f, tm);
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_STATS_DSCP_SET])
|
||||
+ print_lluint(PRINT_ANY, "dscpset", " DSCP set %llu",
|
||||
+ rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_SET]));
|
||||
+ if (tb[TCA_CTINFO_STATS_DSCP_ERROR])
|
||||
+ print_lluint(PRINT_ANY, "dscperror", " error %llu",
|
||||
+ rta_getattr_u64(tb[TCA_CTINFO_STATS_DSCP_ERROR]));
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_STATS_CPMARK_SET])
|
||||
+ print_lluint(PRINT_ANY, "cpmarkset", " CPMARK set %llu",
|
||||
+ rta_getattr_u64(tb[TCA_CTINFO_STATS_CPMARK_SET]));
|
||||
+}
|
||||
+
|
||||
+static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
|
||||
+{
|
||||
+ unsigned int cpmarkmask = ~0, dscpmask = 0, dscpstatemask = 0;
|
||||
+ struct rtattr *tb[TCA_CTINFO_MAX + 1];
|
||||
+ unsigned short zone = 0;
|
||||
+ struct tc_ctinfo *ci;
|
||||
+
|
||||
+ if (arg == NULL)
|
||||
+ return -1;
|
||||
+
|
||||
+ parse_rtattr_nested(tb, TCA_CTINFO_MAX, arg);
|
||||
+ if (!tb[TCA_CTINFO_ACT]) {
|
||||
+ print_string(PRINT_FP, NULL, "%s",
|
||||
+ "[NULL ctinfo action parameters]");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ ci = RTA_DATA(tb[TCA_CTINFO_ACT]);
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) {
|
||||
+ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_MASK]) >=
|
||||
+ sizeof(__u32))
|
||||
+ dscpmask = rta_getattr_u32(
|
||||
+ tb[TCA_CTINFO_PARMS_DSCP_MASK]);
|
||||
+ else
|
||||
+ print_string(PRINT_FP, NULL, "%s",
|
||||
+ "[invalid dscp mask parameter]");
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) {
|
||||
+ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]) >=
|
||||
+ sizeof(__u32))
|
||||
+ dscpstatemask = rta_getattr_u32(
|
||||
+ tb[TCA_CTINFO_PARMS_DSCP_STATEMASK]);
|
||||
+ else
|
||||
+ print_string(PRINT_FP, NULL, "%s",
|
||||
+ "[invalid dscp statemask parameter]");
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_PARMS_CPMARK_MASK]) {
|
||||
+ if (RTA_PAYLOAD(tb[TCA_CTINFO_PARMS_CPMARK_MASK]) >=
|
||||
+ sizeof(__u32))
|
||||
+ cpmarkmask = rta_getattr_u32(
|
||||
+ tb[TCA_CTINFO_PARMS_CPMARK_MASK]);
|
||||
+ else
|
||||
+ print_string(PRINT_FP, NULL, "%s",
|
||||
+ "[invalid cpmark mask parameter]");
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_ZONE] && RTA_PAYLOAD(tb[TCA_CTINFO_ZONE]) >=
|
||||
+ sizeof(__u16))
|
||||
+ zone = rta_getattr_u16(tb[TCA_CTINFO_ZONE]);
|
||||
+
|
||||
+ print_string(PRINT_ANY, "kind", "%s ", "ctinfo");
|
||||
+ print_hu(PRINT_ANY, "zone", "zone %u", zone);
|
||||
+ print_action_control(f, " ", ci->action, "");
|
||||
+
|
||||
+ print_string(PRINT_FP, NULL, "%s", _SL_);
|
||||
+ print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
|
||||
+ print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt);
|
||||
+ print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt);
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_PARMS_DSCP_MASK]) {
|
||||
+ print_0xhex(PRINT_ANY, "dscpmask", " dscp %#010llx", dscpmask);
|
||||
+ print_0xhex(PRINT_ANY, "dscpstatemask", " %#010llx",
|
||||
+ dscpstatemask);
|
||||
+ }
|
||||
+
|
||||
+ if (tb[TCA_CTINFO_PARMS_CPMARK_MASK])
|
||||
+ print_0xhex(PRINT_ANY, "cpmark", " cpmark %#010llx",
|
||||
+ cpmarkmask);
|
||||
+
|
||||
+ if (show_stats)
|
||||
+ print_ctinfo_stats(f, tb);
|
||||
+
|
||||
+ print_string(PRINT_FP, NULL, "%s", _SL_);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+struct action_util ctinfo_action_util = {
|
||||
+ .id = "ctinfo",
|
||||
+ .parse_aopt = parse_ctinfo,
|
||||
+ .print_aopt = print_ctinfo,
|
||||
+};
|
||||
--
|
||||
2.20.1 (Apple Git-117)
|
||||
|
||||
12
package/network/utils/iproute2/patches/100-configure.patch
Normal file
12
package/network/utils/iproute2/patches/100-configure.patch
Normal file
@@ -0,0 +1,12 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -32,7 +32,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
EOF
|
||||
|
||||
- if $CC -I$INCLUDE -o $TMPDIR/atmtest $TMPDIR/atmtest.c -latm >/dev/null 2>&1; then
|
||||
+# OpenWrt: disable ATM support even if present on host system
|
||||
+ if [ 1 -eq 0 ]; then
|
||||
echo "TC_CONFIG_ATM:=y" >>$CONFIG
|
||||
echo yes
|
||||
else
|
||||
@@ -0,0 +1,59 @@
|
||||
--- a/netem/maketable.c
|
||||
+++ b/netem/maketable.c
|
||||
@@ -10,7 +10,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
|
||||
@@ -8,8 +8,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
|
||||
@@ -7,8 +7,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
|
||||
@@ -14,10 +14,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
|
||||
@@ -120,6 +120,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
|
||||
|
||||
YACC := bison
|
||||
LEX := flex
|
||||
15
package/network/utils/iproute2/patches/120-no_arpd.patch
Normal file
15
package/network/utils/iproute2/patches/120-no_arpd.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
--- a/misc/Makefile
|
||||
+++ b/misc/Makefile
|
||||
@@ -6,9 +6,9 @@ TARGETS=ss nstat ifstat rtacct lnstat
|
||||
|
||||
include ../config.mk
|
||||
|
||||
-ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
- TARGETS += arpd
|
||||
-endif
|
||||
+#ifeq ($(HAVE_BERKELEY_DB),y)
|
||||
+# TARGETS += arpd
|
||||
+#endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
11
package/network/utils/iproute2/patches/130-no_netem.patch
Normal file
11
package/network/utils/iproute2/patches/130-no_netem.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -55,7 +55,7 @@ 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 tipc devlink rdma man
|
||||
+SUBDIRS=lib ip tc bridge misc genl tipc devlink rdma man
|
||||
|
||||
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
||||
LDLIBS += $(LIBNETLINK)
|
||||
@@ -0,0 +1,101 @@
|
||||
Description: Sync header from iptables
|
||||
The current versions in several suites have the same content:
|
||||
- 1.6.1-2 (unstable)
|
||||
Bug: https://bugs.debian.org/868059
|
||||
Forwarded: not-needed
|
||||
Author: Cyril Brulebois <cyril@debamax.com>
|
||||
Last-Update: 2017-11-22
|
||||
--- a/include/xtables.h
|
||||
+++ b/include/xtables.h
|
||||
@@ -206,9 +206,24 @@ enum xtables_ext_flags {
|
||||
XTABLES_EXT_ALIAS = 1 << 0,
|
||||
};
|
||||
|
||||
+struct xt_xlate;
|
||||
+
|
||||
+struct xt_xlate_mt_params {
|
||||
+ const void *ip;
|
||||
+ const struct xt_entry_match *match;
|
||||
+ int numeric;
|
||||
+ bool escape_quotes;
|
||||
+};
|
||||
+
|
||||
+struct xt_xlate_tg_params {
|
||||
+ const void *ip;
|
||||
+ const struct xt_entry_target *target;
|
||||
+ int numeric;
|
||||
+ bool escape_quotes;
|
||||
+};
|
||||
+
|
||||
/* Include file for additions: new matches and targets. */
|
||||
-struct xtables_match
|
||||
-{
|
||||
+struct xtables_match {
|
||||
/*
|
||||
* ABI/API version this module requires. Must be first member,
|
||||
* as the rest of this struct may be subject to ABI changes.
|
||||
@@ -270,6 +285,10 @@ struct xtables_match
|
||||
void (*x6_fcheck)(struct xt_fcheck_call *);
|
||||
const struct xt_option_entry *x6_options;
|
||||
|
||||
+ /* Translate iptables to nft */
|
||||
+ int (*xlate)(struct xt_xlate *xl,
|
||||
+ const struct xt_xlate_mt_params *params);
|
||||
+
|
||||
/* Size of per-extension instance extra "global" scratch space */
|
||||
size_t udata_size;
|
||||
|
||||
@@ -281,8 +300,7 @@ struct xtables_match
|
||||
unsigned int loaded; /* simulate loading so options are merged properly */
|
||||
};
|
||||
|
||||
-struct xtables_target
|
||||
-{
|
||||
+struct xtables_target {
|
||||
/*
|
||||
* ABI/API version this module requires. Must be first member,
|
||||
* as the rest of this struct may be subject to ABI changes.
|
||||
@@ -347,6 +365,10 @@ struct xtables_target
|
||||
void (*x6_fcheck)(struct xt_fcheck_call *);
|
||||
const struct xt_option_entry *x6_options;
|
||||
|
||||
+ /* Translate iptables to nft */
|
||||
+ int (*xlate)(struct xt_xlate *xl,
|
||||
+ const struct xt_xlate_tg_params *params);
|
||||
+
|
||||
size_t udata_size;
|
||||
|
||||
/* Ignore these men behind the curtain: */
|
||||
@@ -407,6 +429,17 @@ struct xtables_globals
|
||||
|
||||
#define XT_GETOPT_TABLEEND {.name = NULL, .has_arg = false}
|
||||
|
||||
+/*
|
||||
+ * enum op-
|
||||
+ *
|
||||
+ * For writing clean nftables translations code
|
||||
+ */
|
||||
+enum xt_op {
|
||||
+ XT_OP_EQ,
|
||||
+ XT_OP_NEQ,
|
||||
+ XT_OP_MAX,
|
||||
+};
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -549,6 +582,14 @@ extern void xtables_lmap_free(struct xta
|
||||
extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *);
|
||||
extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int);
|
||||
|
||||
+/* xlate infrastructure */
|
||||
+struct xt_xlate *xt_xlate_alloc(int size);
|
||||
+void xt_xlate_free(struct xt_xlate *xl);
|
||||
+void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...);
|
||||
+void xt_xlate_add_comment(struct xt_xlate *xl, const char *comment);
|
||||
+const char *xt_xlate_get_comment(struct xt_xlate *xl);
|
||||
+const char *xt_xlate_get(struct xt_xlate *xl);
|
||||
+
|
||||
#ifdef XTABLES_INTERNAL
|
||||
|
||||
/* Shipped modules rely on this... */
|
||||
@@ -0,0 +1,9 @@
|
||||
--- a/tc/q_fifo.c
|
||||
+++ b/tc/q_fifo.c
|
||||
@@ -99,5 +99,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
|
||||
@@ -255,7 +255,7 @@ check_selinux()
|
||||
|
||||
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
|
||||
@@ -228,7 +228,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
|
||||
@@ -313,7 +313,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/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 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 \
|
||||
102
package/network/utils/iproute2/patches/170-ip_tiny.patch
Normal file
102
package/network/utils/iproute2/patches/170-ip_tiny.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
--- a/ip/Makefile
|
||||
+++ b/ip/Makefile
|
||||
@@ -16,6 +16,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=ifcfg rtpr routel routef
|
||||
TARGETS=ip rtmon
|
||||
@@ -45,7 +52,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
|
||||
@@ -47,10 +47,16 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
+#ifndef IPROUTE2_TINY
|
||||
"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
|
||||
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
|
||||
" netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
|
||||
" vrf | sr }\n"
|
||||
+#else
|
||||
+"where OBJECT := { link | address | route | rule | neigh | tunnel | maddress |\n"
|
||||
+" mroute | mrule | monitor | netns | macsec | token | ila |\n"
|
||||
+" vrf | sr }\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"
|
||||
@@ -72,32 +78,44 @@ 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 },
|
||||
+#endif
|
||||
{ "ila", do_ipila },
|
||||
{ "macsec", do_ipmacsec },
|
||||
{ "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 },
|
||||
+#endif
|
||||
{ "mroute", do_multiroute },
|
||||
{ "mrule", do_multirule },
|
||||
{ "netns", do_netns },
|
||||
+#ifndef IPROUTE2_TINY
|
||||
{ "netconf", do_ipnetconf },
|
||||
+#endif
|
||||
{ "vrf", do_ipvrf},
|
||||
{ "sr", do_seg6 },
|
||||
{ "help", do_help },
|
||||
--- 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 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 \
|
||||
names.o color.o bpf.o exec.o fs.o
|
||||
@@ -0,0 +1,44 @@
|
||||
--- a/tc/Makefile
|
||||
+++ b/tc/Makefile
|
||||
@@ -107,7 +107,7 @@ LDLIBS += -L. -lm
|
||||
|
||||
ifeq ($(SHARED_LIBS),y)
|
||||
LDLIBS += -ldl
|
||||
-LDFLAGS += -Wl,-export-dynamic
|
||||
+LDFLAGS += -Wl,--dynamic-list=dynsyms.list
|
||||
endif
|
||||
|
||||
TCLIB := tc_core.o
|
||||
@@ -137,7 +137,7 @@ MODDESTDIR := $(DESTDIR)$(LIBDIR)/tc
|
||||
all: tc $(TCSO)
|
||||
|
||||
tc: $(TCOBJ) $(LIBNETLINK) libtc.a
|
||||
- $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@
|
||||
+ $(QUIET_LINK)$(CC) $(filter-out dynsyms.list, $^) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
|
||||
libtc.a: $(TCLIB)
|
||||
$(QUIET_AR)$(AR) rcs $@ $^
|
||||
@@ -159,6 +159,7 @@ install: all
|
||||
clean:
|
||||
rm -f $(TCOBJ) $(TCLIB) libtc.a tc *.so emp_ematch.yacc.h; \
|
||||
rm -f emp_ematch.yacc.*
|
||||
+ rm -f dynsyms.list
|
||||
|
||||
q_atm.so: q_atm.c
|
||||
$(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -shared -fpic -o q_atm.so q_atm.c -latm
|
||||
@@ -198,4 +199,15 @@ static-syms.h: $(wildcard *.c)
|
||||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
||||
done > $@
|
||||
|
||||
+else
|
||||
+
|
||||
+tc: dynsyms.list
|
||||
+dynsyms.list: $(wildcard *.c)
|
||||
+ files="$(filter-out $(patsubst %.so,%.c,$(TCSO)), $^)" ; \
|
||||
+ echo "{" > $@ ; \
|
||||
+ for s in `grep -B 3 '\<dlsym' $$files | sed -n '/snprintf/{s:.*"\([^"]*\)".*:\1:;s:%s::;p}'` ; do \
|
||||
+ sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:\1;:;p}' $$files ; \
|
||||
+ done >> $@ ; \
|
||||
+ echo "show_stats; print_tm; parse_rtattr; get_u32; matches; addattr_l; addattr_nest; addattr_nest_end; };" >> $@
|
||||
+
|
||||
endif
|
||||
@@ -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
|
||||
@@ -48,6 +48,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;
|
||||
@@ -83,6 +85,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
|
||||
@@ -228,6 +228,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,19 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -299,14 +299,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
|
||||
}
|
||||
73
package/network/utils/ipset/Makefile
Normal file
73
package/network/utils/ipset/Makefile
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
# 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.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://ipset.netfilter.org
|
||||
PKG_HASH:=4644c7c5005e90a9b6385d625283eb0b69b34de7192301428665dd909fdaa35a
|
||||
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
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/
|
||||
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,ipset))
|
||||
$(eval $(call BuildPackage,libipset))
|
||||
706
package/network/utils/iptables/Makefile
Normal file
706
package/network/utils/iptables/Makefile
Normal file
@@ -0,0 +1,706 @@
|
||||
#
|
||||
# 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.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_HASH:=a23cac034181206b4545f4e7e730e76e08b5f3dd78771ba9645a6756de9cdd80
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_CPE_ID:=cpe:/a:netfilter_core_team: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:=iptables $(1)
|
||||
endef
|
||||
|
||||
define Package/iptables
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool
|
||||
MENU:=1
|
||||
DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libxtables
|
||||
endef
|
||||
|
||||
define Package/iptables/config
|
||||
config IPTABLES_CONNLABEL
|
||||
bool "Enable Connlabel support"
|
||||
default n
|
||||
help
|
||||
This enable connlabel support in iptables.
|
||||
|
||||
config IPTABLES_NFTABLES
|
||||
bool "Enable Nftables support"
|
||||
default n
|
||||
help
|
||||
This enable nftables support in iptables.
|
||||
endef
|
||||
|
||||
define Package/iptables/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/iptables-nft
|
||||
$(call Package/iptables/Default)
|
||||
TITLE:=IP firewall administration tool nft
|
||||
DEPENDS:=iptables @IPTABLES_NFTABLES +libxtables-nft
|
||||
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 +kmod-ipt-raw)
|
||||
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-ulog
|
||||
$(call Package/iptables/Module, +kmod-ipt-ulog)
|
||||
TITLE:=user-space packet logging
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-ulog/description
|
||||
iptables extensions for user-space packet logging.
|
||||
|
||||
Targets:
|
||||
- ULOG
|
||||
|
||||
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-tproxy
|
||||
$(call Package/iptables/Module, +kmod-ipt-tproxy)
|
||||
TITLE:=Transparent proxy iptables extensions
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-tproxy/description
|
||||
Transparent proxy iptables extensions.
|
||||
|
||||
Matches:
|
||||
- socket
|
||||
|
||||
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
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=@IPV6 +kmod-ip6tables +iptables
|
||||
CATEGORY:=Network
|
||||
TITLE:=IPv6 firewall administration tool
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/ip6tables-nft
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=ip6tables @IPTABLES_NFTABLES +libxtables-nft
|
||||
TITLE:=IP firewall administration tool nft
|
||||
endef
|
||||
|
||||
define Package/ip6tables-nft/description
|
||||
Extra ip6tables nftables nft binaries.
|
||||
iptables-nft
|
||||
iptables-nft-restore
|
||||
iptables-nft-save
|
||||
iptables-translate
|
||||
iptables-restore-translate
|
||||
endef
|
||||
|
||||
define Package/ip6tables-extra
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=ip6tables +kmod-ip6tables-extra
|
||||
TITLE:=IPv6 header matching modules
|
||||
endef
|
||||
|
||||
define Package/ip6tables-mod-extra/description
|
||||
iptables header matching modules for IPv6
|
||||
endef
|
||||
|
||||
define Package/ip6tables-mod-nat
|
||||
$(call Package/iptables/Default)
|
||||
DEPENDS:=ip6tables +kmod-ipt-nat6
|
||||
TITLE:=IPv6 NAT extensions
|
||||
endef
|
||||
|
||||
define Package/ip6tables-mod-nat/description
|
||||
iptables extensions for IPv6-NAT targets.
|
||||
endef
|
||||
|
||||
define Package/libiptc
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libip4tc +libip6tc +libxtables
|
||||
ABI_VERSION:=0
|
||||
TITLE:=IPv4/IPv6 firewall - shared libiptc library (nf compatibility stub)
|
||||
endef
|
||||
|
||||
define Package/libip4tc
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4 firewall - shared libiptc library
|
||||
ABI_VERSION:=2
|
||||
DEPENDS:=+libxtables
|
||||
endef
|
||||
|
||||
define Package/libip6tc
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv6 firewall - shared libiptc library
|
||||
ABI_VERSION:=2
|
||||
DEPENDS:=+libxtables
|
||||
endef
|
||||
|
||||
define Package/libxtables
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4/IPv6 firewall - shared xtables library
|
||||
ABI_VERSION:=12
|
||||
DEPENDS:= \
|
||||
+IPTABLES_CONNLABEL:libnetfilter-conntrack \
|
||||
+IPTABLES_NFTABLES:libnftnl
|
||||
endef
|
||||
|
||||
define Package/libxtables-nft
|
||||
$(call Package/iptables/Default)
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=IPv4/IPv6 firewall - shared xtables nft library
|
||||
ABI_VERSION:=12
|
||||
DEPENDS:=libxtables
|
||||
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 \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-DNO_LEGACY
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-Wl,--gc-sections
|
||||
|
||||
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_IPTABLES_NFTABLES),,--disable-nftables) \
|
||||
$(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/libipulog $(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/iptables/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore,-save} $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
endef
|
||||
|
||||
define Package/iptables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-nft-multi $(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/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables{,-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/libiptc/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libiptc.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libip4tc/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libip4tc.so.* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext4.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/
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext6.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/
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libxtables-nft/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/extensions/libiptext_*.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,iptables))
|
||||
$(eval $(call BuildPackage,iptables-nft))
|
||||
$(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-ulog,$(IPT_ULOG-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-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))
|
||||
$(eval $(call BuildPackage,ip6tables-nft))
|
||||
$(eval $(call BuildPlugin,ip6tables-extra,$(IPT_IPV6_EXTRA-m)))
|
||||
$(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m)))
|
||||
$(eval $(call BuildPackage,libiptc))
|
||||
$(eval $(call BuildPackage,libip4tc))
|
||||
$(eval $(call BuildPackage,libip6tc))
|
||||
$(eval $(call BuildPackage,libxtables))
|
||||
$(eval $(call BuildPackage,libxtables-nft))
|
||||
@@ -0,0 +1,28 @@
|
||||
--- a/libxtables/xtables.c
|
||||
+++ b/libxtables/xtables.c
|
||||
@@ -903,12 +903,6 @@ static void xtables_check_options(const
|
||||
|
||||
void xtables_register_match(struct xtables_match *me)
|
||||
{
|
||||
- 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);
|
||||
@@ -1096,12 +1090,6 @@ void xtables_register_matches(struct xta
|
||||
|
||||
void xtables_register_target(struct xtables_target *me)
|
||||
{
|
||||
- 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,18 @@
|
||||
--- a/libxtables/xtables.c
|
||||
+++ b/libxtables/xtables.c
|
||||
@@ -360,6 +360,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;
|
||||
@@ -394,6 +395,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:
|
||||
|
||||
@@ -148,11 +168,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}
|
||||
@@ -119,7 +119,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
|
||||
|
||||
@@ -151,22 +151,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
|
||||
@@ -8,19 +8,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
|
||||
@@ -30,7 +33,8 @@ if ENABLE_NFTABLES
|
||||
BUILT_SOURCES += xtables-config-parser.h
|
||||
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
|
||||
@@ -45,7 +49,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
|
||||
# yacc and lex generate dirty code
|
||||
xtables_nft_multi-xtables-config-parser.o xtables_nft_multi-xtables-config-syntax.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls
|
||||
xtables_nft_multi_SOURCES += xshared.c
|
||||
@@ -0,0 +1,95 @@
|
||||
--- a/extensions/libxt_conntrack.c
|
||||
+++ b/extensions/libxt_conntrack.c
|
||||
@@ -1389,6 +1389,7 @@ static int conntrack3_mt6_xlate(struct x
|
||||
}
|
||||
|
||||
static struct xtables_match conntrack_mt_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.version = XTABLES_VERSION,
|
||||
.name = "conntrack",
|
||||
@@ -1464,6 +1465,7 @@ static struct xtables_match conntrack_mt
|
||||
.alias = conntrack_print_name_alias,
|
||||
.x6_options = conntrack2_mt_opts,
|
||||
},
|
||||
+#endif
|
||||
{
|
||||
.version = XTABLES_VERSION,
|
||||
.name = "conntrack",
|
||||
@@ -1496,6 +1498,7 @@ static struct xtables_match conntrack_mt
|
||||
.x6_options = conntrack3_mt_opts,
|
||||
.xlate = conntrack3_mt6_xlate,
|
||||
},
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "state",
|
||||
@@ -1526,6 +1529,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",
|
||||
@@ -1555,6 +1560,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
|
||||
@@ -349,6 +349,7 @@ static void notrack_ct2_tg_init(struct x
|
||||
}
|
||||
|
||||
static struct xtables_target ct_target_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "CT",
|
||||
@@ -374,6 +375,7 @@ static struct xtables_target ct_target_r
|
||||
.x6_parse = ct_parse_v1,
|
||||
.x6_options = ct_opts_v1,
|
||||
},
|
||||
+#endif
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "CT",
|
||||
@@ -388,6 +390,7 @@ static struct xtables_target ct_target_r
|
||||
.x6_parse = ct_parse_v1,
|
||||
.x6_options = ct_opts_v1,
|
||||
},
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_UNSPEC,
|
||||
.name = "NOTRACK",
|
||||
@@ -425,6 +428,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
|
||||
@@ -571,6 +571,7 @@ static int multiport_xlate6_v1(struct xt
|
||||
}
|
||||
|
||||
static struct xtables_match multiport_mt_reg[] = {
|
||||
+#ifndef NO_LEGACY
|
||||
{
|
||||
.family = NFPROTO_IPV4,
|
||||
.name = "multiport",
|
||||
@@ -601,6 +602,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 */
|
||||
182
package/network/utils/iputils/Makefile
Normal file
182
package/network/utils/iputils/Makefile
Normal file
@@ -0,0 +1,182 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 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:=iputils
|
||||
PKG_VERSION:=20101006
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-s$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://www.skbuff.net/iputils
|
||||
PKG_HASH:=fd3af46c80ebb99607c2ca1f2a3608b6fe828e25bbec6e54f2afd25f6ddb6ee7
|
||||
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0+
|
||||
PKG_CPE_ID:=cpe:/a:skbuff:iputils
|
||||
|
||||
PKG_BUILD_DEPENDS:=sysfsutils
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-s$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/iputils/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://www.skbuff.net/iputils
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-arping
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - arping
|
||||
DEPENDS+= +libsysfs
|
||||
endef
|
||||
|
||||
define Package/iputils-arping/description
|
||||
Program arping from iputils.
|
||||
Sends ARP REQUEST to a neighbour host.
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-clockdiff
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - clockdiff
|
||||
endef
|
||||
|
||||
define Package/iputils-clockdiff/description
|
||||
Program clockdiff from iputils.
|
||||
Measures clock difference between hosts.
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-ping
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - ping
|
||||
endef
|
||||
|
||||
define Package/iputils-ping/description
|
||||
Program ping from iputils.
|
||||
Sends ICMP ECHO_REQUEST to network hosts (IPv4).
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-ping6
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - ping6
|
||||
DEPENDS+= @IPV6 +USE_GLIBC:libopenssl
|
||||
endef
|
||||
|
||||
define Package/iputils-ping6/description
|
||||
Program ping6 from iputils.
|
||||
Sends ICMP ECHO_REQUEST to network hosts (IPv6).
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-tftpd
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - tftpd
|
||||
endef
|
||||
|
||||
define Package/iputils-tftpd/description
|
||||
Program tftpd from iputils
|
||||
Trivial File Transfer Protocol server.
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-tracepath
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - tracepath
|
||||
endef
|
||||
|
||||
define Package/iputils-tracepath/description
|
||||
Program tracepath from iputils.
|
||||
Traces path to a network host discovering MTU along this path (IPv4).
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-tracepath6
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - tracepath6
|
||||
DEPENDS+= @IPV6
|
||||
endef
|
||||
|
||||
define Package/iputils-tracepath6/description
|
||||
Program tracepath6 from iputils.
|
||||
Traces path to a network host discovering MTU along this path (IPv6).
|
||||
endef
|
||||
|
||||
|
||||
define Package/iputils-traceroute6
|
||||
$(call Package/iputils/Default)
|
||||
TITLE:=iputils - traceroute6
|
||||
DEPENDS+= @IPV6
|
||||
endef
|
||||
|
||||
define Package/iputils-traceroute6/description
|
||||
Program traceroute6 from iputils.
|
||||
Traces path to a network host (IPv6).
|
||||
endef
|
||||
|
||||
ifdef CONFIG_USE_MUSL
|
||||
TARGET_CFLAGS += -D__UCLIBC__
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
|
||||
CONFIG_IPV6="$(CONFIG_IPV6)" \
|
||||
CONFIG_USE_UCLIBC="$(CONFIG_USE_UCLIBC)$(CONFIG_USE_MUSL)" \
|
||||
|
||||
define Package/iputils-arping/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/arping $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-clockdiff/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/clockdiff $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-ping/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_SUID) $(PKG_BUILD_DIR)/ping $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-ping6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_SUID) $(PKG_BUILD_DIR)/ping6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-tftpd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tftpd $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/iputils-tracepath/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tracepath $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-tracepath6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tracepath6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/iputils-traceroute6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_SUID) $(PKG_BUILD_DIR)/traceroute6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iputils-arping))
|
||||
$(eval $(call BuildPackage,iputils-clockdiff))
|
||||
$(eval $(call BuildPackage,iputils-ping))
|
||||
$(eval $(call BuildPackage,iputils-tftpd))
|
||||
$(eval $(call BuildPackage,iputils-tracepath))
|
||||
$(eval $(call BuildPackage,iputils-ping6))
|
||||
$(eval $(call BuildPackage,iputils-tracepath6))
|
||||
$(eval $(call BuildPackage,iputils-traceroute6))
|
||||
14
package/network/utils/iputils/patches/001-iputils.patch
Normal file
14
package/network/utils/iputils/patches/001-iputils.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff -ur a/Makefile b/Makefile
|
||||
--- a/Makefile 2002-09-20 18:23:55.000000000 +0000
|
||||
+++ b/Makefile 2007-05-17 13:59:55.000000000 +0000
|
||||
@@ -16,8 +16,8 @@
|
||||
CCOPT=-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -g
|
||||
CFLAGS=$(CCOPT) $(GLIBCFIX) $(DEFINES)
|
||||
|
||||
-IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd
|
||||
-IPV6_TARGETS=tracepath6 traceroute6 ping6
|
||||
+IPV4_TARGETS=tracepath ping clockdiff arping tftpd
|
||||
+IPV6_TARGETS=tracepath6 traceroute6 ping6
|
||||
TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
|
||||
|
||||
LASTTAG:=`git describe HEAD | sed -e 's/-.*//'`
|
||||
14
package/network/utils/iputils/patches/002-fix-ipv6.patch
Normal file
14
package/network/utils/iputils/patches/002-fix-ipv6.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -18,7 +18,10 @@ CFLAGS=$(CCOPT) $(GLIBCFIX) $(DEFINES)
|
||||
|
||||
IPV4_TARGETS=tracepath ping clockdiff arping tftpd
|
||||
IPV6_TARGETS=tracepath6 traceroute6 ping6
|
||||
-TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
|
||||
+TARGETS=$(IPV4_TARGETS)
|
||||
+ifeq ($(CONFIG_IPV6),y)
|
||||
+ TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS)
|
||||
+endif
|
||||
|
||||
LASTTAG:=`git describe HEAD | sed -e 's/-.*//'`
|
||||
TAG:=`date +s%Y%m%d`
|
||||
18
package/network/utils/iputils/patches/003-fix-makefile.patch
Normal file
18
package/network/utils/iputils/patches/003-fix-makefile.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -30,9 +30,13 @@ all: $(TARGETS)
|
||||
|
||||
|
||||
tftpd: tftpd.o tftpsubs.o
|
||||
-arping: arping.o -lsysfs
|
||||
+arping: arping.o
|
||||
+ $(CC) $(CFLAGS) -o $@ arping.o -lsysfs
|
||||
ping: ping.o ping_common.o
|
||||
-ping6: ping6.o ping_common.o -lresolv -lcrypto
|
||||
+ping6: ping6.o ping_common.o
|
||||
+ifneq ($(CONFIG_USE_UCLIBC),y)
|
||||
+ $(CC) $(CFLAGS) -o $@ ping6.o ping_common.o -lresolv -lcrypto
|
||||
+endif
|
||||
ping.o ping6.o ping_common.o: ping_common.h
|
||||
tftpd.o tftpsubs.o: tftp.h
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
diff --git a/ping6.c b/ping6.c
|
||||
index c5ff881..ef2243f 100644
|
||||
--- a/ping6.c
|
||||
+++ b/ping6.c
|
||||
@@ -71,9 +71,11 @@ char copyright[] =
|
||||
#include <linux/filter.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/icmp6.h>
|
||||
+#ifndef __UCLIBC__
|
||||
#include <resolv.h>
|
||||
|
||||
#include "ping6_niquery.h"
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
#ifndef SOL_IPV6
|
||||
#define SOL_IPV6 IPPROTO_IPV6
|
||||
@@ -154,6 +156,7 @@ int pmtudisc=-1;
|
||||
|
||||
static int icmp_sock;
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
#include <openssl/md5.h>
|
||||
|
||||
/* Node Information query */
|
||||
@@ -165,6 +168,7 @@ int ni_subject_type = 0;
|
||||
char *ni_group;
|
||||
|
||||
__u8 ni_nonce[8];
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
static struct in6_addr in6_anyaddr;
|
||||
static __inline__ int ipv6_addr_any(struct in6_addr *addr)
|
||||
@@ -223,6 +227,7 @@ unsigned int if_name2index(const char *ifname)
|
||||
return i;
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
struct niquery_option {
|
||||
char *name;
|
||||
int namelen;
|
||||
@@ -512,6 +517,7 @@ char *ni_groupaddr(const char *name)
|
||||
strcat(nigroup_buf, q);
|
||||
return nigroup_buf;
|
||||
}
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -595,12 +601,14 @@ int main(int argc, char *argv[])
|
||||
case 'V':
|
||||
printf("ping6 utility, iputils-ss%s\n", SNAPSHOT);
|
||||
exit(0);
|
||||
+#ifndef __UCLIBC__
|
||||
case 'N':
|
||||
if (niquery_option_handler(optarg) < 0) {
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
+#endif /* __UCLIBC__ */
|
||||
COMMON_OPTIONS
|
||||
common_options(ch);
|
||||
break;
|
||||
@@ -663,6 +671,7 @@ int main(int argc, char *argv[])
|
||||
argc--;
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
if (ni_query >= 0) {
|
||||
int i;
|
||||
for (i = 0; i < 8; i++)
|
||||
@@ -674,15 +683,20 @@ int main(int argc, char *argv[])
|
||||
ni_subject_type = NI_SUBJ_IPV6;
|
||||
}
|
||||
}
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
if (argc > 1)
|
||||
usage();
|
||||
else if (argc == 1) {
|
||||
target = *argv;
|
||||
} else {
|
||||
+#ifndef __UCLIBC__
|
||||
if (ni_query < 0 && ni_subject_type != NI_SUBJ_NAME)
|
||||
+#endif /* __UCLIBC__ */
|
||||
usage();
|
||||
+#ifndef __UCLIBC__
|
||||
target = ni_group;
|
||||
+#endif /* __UCLIBC__ */
|
||||
}
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
@@ -817,7 +831,11 @@ int main(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
if (datalen >= sizeof(struct timeval) && (ni_query < 0)) {
|
||||
+#else
|
||||
+ if (datalen >= sizeof(struct timeval)) {
|
||||
+#endif /* __UCLIBC__ */
|
||||
/* can we time transfer */
|
||||
timing = 1;
|
||||
}
|
||||
@@ -866,9 +884,11 @@ int main(int argc, char *argv[])
|
||||
ICMP6_FILTER_SETPASS(ICMP6_PARAM_PROB, &filter);
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
if (ni_query >= 0)
|
||||
ICMP6_FILTER_SETPASS(ICMPV6_NI_REPLY, &filter);
|
||||
else
|
||||
+#endif /* __UCLIBC__ */
|
||||
ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filter);
|
||||
|
||||
err = setsockopt(icmp_sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filter,
|
||||
@@ -1100,6 +1120,7 @@ int build_echo(__u8 *_icmph)
|
||||
return cc;
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
int build_niquery(__u8 *_nih)
|
||||
{
|
||||
struct ni_hdr *nih;
|
||||
@@ -1125,6 +1146,7 @@ int build_niquery(__u8 *_nih)
|
||||
|
||||
return cc;
|
||||
}
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
int send_probe(void)
|
||||
{
|
||||
@@ -1132,9 +1154,11 @@ int send_probe(void)
|
||||
|
||||
CLR((ntransmitted+1) % mx_dup_ck);
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
if (ni_query >= 0)
|
||||
len = build_niquery(outpack);
|
||||
else
|
||||
+#endif /* __UCLIBC__ */
|
||||
len = build_echo(outpack);
|
||||
|
||||
if (cmsglen == 0) {
|
||||
@@ -1176,6 +1200,7 @@ static void putchar_safe(char c)
|
||||
printf("\\%03o", c);
|
||||
}
|
||||
|
||||
+#ifndef __UCLIBC__
|
||||
void pr_niquery_reply_name(struct ni_hdr *nih, int len)
|
||||
{
|
||||
__u8 *h = (__u8 *)(nih + 1);
|
||||
@@ -1304,6 +1329,7 @@ void pr_niquery_reply(__u8 *_nih, int len)
|
||||
}
|
||||
putchar(';');
|
||||
}
|
||||
+#endif /* __UCLIBC__ */
|
||||
|
||||
/*
|
||||
* parse_reply --
|
||||
@@ -1353,6 +1379,7 @@ parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv)
|
||||
hops, 0, tv, pr_addr(&from->sin6_addr),
|
||||
pr_echo_reply))
|
||||
return 0;
|
||||
+#ifndef __UCLIBC__
|
||||
} else if (icmph->icmp6_type == ICMPV6_NI_REPLY) {
|
||||
struct ni_hdr *nih = (struct ni_hdr *)icmph;
|
||||
__u16 seq = ntohs(*(__u16 *)nih->ni_nonce);
|
||||
@@ -1363,6 +1390,7 @@ parse_reply(struct msghdr *msg, int cc, void *addr, struct timeval *tv)
|
||||
hops, 0, tv, pr_addr(&from->sin6_addr),
|
||||
pr_niquery_reply))
|
||||
return 0;
|
||||
+#endif /* __UCLIBC__ */
|
||||
} else {
|
||||
int nexthdr;
|
||||
struct ip6_hdr *iph1 = (struct ip6_hdr*)(icmph+1);
|
||||
@@ -1557,7 +1585,9 @@ void usage(void)
|
||||
"Usage: ping6 [-LUdfnqrvVaAD] [-c count] [-i interval] [-w deadline]\n"
|
||||
" [-p pattern] [-s packetsize] [-t ttl] [-I interface]\n"
|
||||
" [-M pmtudisc-hint] [-S sndbuf] [-F flowlabel] [-Q tclass]\n"
|
||||
+#ifndef __UCLIBC__
|
||||
" [[-N nodeinfo-option] ...]\n"
|
||||
+#endif /* __UCLIBC__ */
|
||||
" [hop1 ...] destination\n");
|
||||
exit(2);
|
||||
}
|
||||
diff --git a/ping6_niquery.h b/ping6_niquery.h
|
||||
index 61a5cfa..34c31f8 100644
|
||||
--- a/ping6_niquery.h
|
||||
+++ b/ping6_niquery.h
|
||||
@@ -1,3 +1,4 @@
|
||||
+#ifndef __UCLIBC__
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* Node Information Query */
|
||||
@@ -45,3 +46,4 @@ struct ni_hdr {
|
||||
#define NI_IPV4ADDR_F_TRUNCATE NI_IPV6ADDR_F_TRUNCATE
|
||||
#define NI_IPV4ADDR_F_ALL NI_IPV6ADDR_F_ALL
|
||||
|
||||
+#endif /* __UCLIBC__ */
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/ping6.c
|
||||
+++ b/ping6.c
|
||||
@@ -66,6 +66,8 @@ char copyright[] =
|
||||
* More statistics could always be gathered.
|
||||
* This program has to run SUID to ROOT to access the ICMP socket.
|
||||
*/
|
||||
+
|
||||
+#define _GNU_SOURCE
|
||||
#include "ping_common.h"
|
||||
|
||||
#include <linux/filter.h>
|
||||
@@ -0,0 +1,71 @@
|
||||
--- a/ping_common.h
|
||||
+++ b/ping_common.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
+#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/sockios.h>
|
||||
@@ -11,7 +12,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/uio.h>
|
||||
-#include <sys/poll.h>
|
||||
+#include <poll.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
@@ -24,6 +25,10 @@
|
||||
|
||||
#include "SNAPSHOT.h"
|
||||
|
||||
+#ifndef HZ
|
||||
+#define HZ 100
|
||||
+#endif
|
||||
+
|
||||
#define DEFDATALEN (64 - 8) /* default data length */
|
||||
|
||||
#define MAXWAIT 10 /* max seconds to wait for response */
|
||||
--- a/clockdiff.c
|
||||
+++ b/clockdiff.c
|
||||
@@ -13,8 +13,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
-#define TSPTYPES
|
||||
-#include <protocols/timed.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
--- a/tracepath.c
|
||||
+++ b/tracepath.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/time.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errqueue.h>
|
||||
#include <errno.h>
|
||||
--- a/ping.c
|
||||
+++ b/ping.c
|
||||
@@ -661,8 +661,15 @@ int send_probe()
|
||||
|
||||
do {
|
||||
static struct iovec iov = {outpack, 0};
|
||||
- static struct msghdr m = { &whereto, sizeof(whereto),
|
||||
- &iov, 1, &cmsg, 0, 0 };
|
||||
+ static struct msghdr m = {
|
||||
+ .msg_name = &whereto,
|
||||
+ .msg_namelen = sizeof(whereto),
|
||||
+ .msg_iov = &iov,
|
||||
+ .msg_iovlen = 1,
|
||||
+ .msg_control = &cmsg,
|
||||
+ .msg_controllen = 0,
|
||||
+ .msg_flags = 0
|
||||
+ };
|
||||
m.msg_controllen = cmsg_len;
|
||||
iov.iov_len = cc;
|
||||
|
||||
72
package/network/utils/iw/Makefile
Normal file
72
package/network/utils/iw/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# 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:=5.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/iw
|
||||
PKG_HASH:=1e38ea794a223525b2ea7fe78fd14f2a56121e62e21ba5f9dbe8c494b35b5c0d
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
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) -ffunction-sections -fdata-sections" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
|
||||
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))
|
||||
45
package/network/utils/iw/patches/001-nl80211_h_sync.patch
Normal file
45
package/network/utils/iw/patches/001-nl80211_h_sync.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
--- a/nl80211.h
|
||||
+++ b/nl80211.h
|
||||
@@ -2299,6 +2299,12 @@ enum nl80211_commands {
|
||||
* This is also used for capability advertisement in the wiphy information,
|
||||
* with the appropriate sub-attributes.
|
||||
*
|
||||
+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
|
||||
+ * scheduler.
|
||||
+ *
|
||||
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
|
||||
+ * transmit power to stay within regulatory limits. u32, dBi.
|
||||
+ *
|
||||
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
@@ -2748,6 +2754,10 @@ enum nl80211_attrs {
|
||||
|
||||
NL80211_ATTR_PEER_MEASUREMENTS,
|
||||
|
||||
+ NL80211_ATTR_AIRTIME_WEIGHT,
|
||||
+
|
||||
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
|
||||
+
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
@@ -3125,6 +3135,9 @@ enum nl80211_sta_bss_param {
|
||||
* might not be fully accurate.
|
||||
* @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a
|
||||
* mesh gate (u8, 0 or 1)
|
||||
+ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
|
||||
+ * sent to the station (u64, usec)
|
||||
+ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
|
||||
* @__NL80211_STA_INFO_AFTER_LAST: internal
|
||||
* @NL80211_STA_INFO_MAX: highest possible station info attribute
|
||||
*/
|
||||
@@ -3168,6 +3181,8 @@ enum nl80211_sta_info {
|
||||
NL80211_STA_INFO_RX_MPDUS,
|
||||
NL80211_STA_INFO_FCS_ERROR_COUNT,
|
||||
NL80211_STA_INFO_CONNECTED_TO_GATE,
|
||||
+ NL80211_STA_INFO_TX_DURATION,
|
||||
+ NL80211_STA_INFO_AIRTIME_WEIGHT,
|
||||
|
||||
/* keep last */
|
||||
__NL80211_STA_INFO_AFTER_LAST,
|
||||
33
package/network/utils/iw/patches/120-antenna_gain.patch
Normal file
33
package/network/utils/iw/patches/120-antenna_gain.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -843,3 +843,30 @@ static int handle_get_txq(struct nl80211
|
||||
COMMAND(get, txq, "",
|
||||
NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
|
||||
"Get TXQ parameters.");
|
||||
+
|
||||
+static int handle_antenna_gain(struct nl80211_state *state,
|
||||
+ struct nl_msg *msg,
|
||||
+ int argc, char **argv,
|
||||
+ enum id_input id)
|
||||
+{
|
||||
+ char *endptr;
|
||||
+ int dbm;
|
||||
+
|
||||
+ /* get the required args */
|
||||
+ if (argc != 1)
|
||||
+ return 1;
|
||||
+
|
||||
+ dbm = strtol(argv[0], &endptr, 10);
|
||||
+ if (*endptr)
|
||||
+ return 2;
|
||||
+
|
||||
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+ nla_put_failure:
|
||||
+ return -ENOBUFS;
|
||||
+}
|
||||
+COMMAND(set, antenna_gain, "<antenna gain in dBm>",
|
||||
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
|
||||
+ "Specify antenna gain.");
|
||||
357
package/network/utils/iw/patches/200-reduce_size.patch
Normal file
357
package/network/utils/iw/patches/200-reduce_size.patch
Normal file
@@ -0,0 +1,357 @@
|
||||
--- a/event.c
|
||||
+++ b/event.c
|
||||
@@ -699,6 +699,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;
|
||||
@@ -734,6 +735,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_REG_CHANGE:
|
||||
printf("regulatory domain change: ");
|
||||
|
||||
@@ -812,6 +814,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);
|
||||
@@ -989,9 +992,9 @@ static int print_event(struct nl_msg *ms
|
||||
parse_nan_match(tb);
|
||||
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
|
||||
@@ -205,6 +205,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) {
|
||||
@@ -221,6 +222,7 @@ next:
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +288,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;
|
||||
@@ -297,6 +300,7 @@ next:
|
||||
cipher_name(ciphers[i]));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX] &&
|
||||
tb_msg[NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX])
|
||||
@@ -316,11 +320,13 @@ next:
|
||||
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
|
||||
}
|
||||
|
||||
+#ifdef IW_FULL
|
||||
if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
|
||||
printf("\tsoftware interface modes (can always be added):\n");
|
||||
nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
|
||||
printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
|
||||
struct nlattr *nl_combi;
|
||||
@@ -417,6 +423,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)
|
||||
@@ -514,6 +521,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");
|
||||
@@ -552,6 +560,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]);
|
||||
|
||||
@@ -616,6 +625,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");
|
||||
@@ -740,6 +750,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)
|
||||
{
|
||||
@@ -751,6 +762,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
|
||||
@@ -1197,6 +1197,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);
|
||||
@@ -1524,6 +1527,14 @@ 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), },
|
||||
+ [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), },
|
||||
@@ -1533,21 +1544,15 @@ static const struct ie_print ieprinters[
|
||||
[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), },
|
||||
[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), },
|
||||
[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), },
|
||||
[111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
|
||||
+#endif
|
||||
};
|
||||
|
||||
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data,
|
||||
@@ -2026,6 +2031,7 @@ void print_ies(unsigned char *ie, int ie
|
||||
ieprinters[ie[0]].flags & BIT(ptype)) {
|
||||
print_ie(&ieprinters[ie[0]],
|
||||
ie[0], ie[1], ie + 2, &ie_buffer);
|
||||
+#ifdef IW_FULL
|
||||
} else if (ie[0] == 221 /* vendor */) {
|
||||
print_vendor(ie[1], ie + 2, unknown, ptype);
|
||||
} else if (unknown) {
|
||||
@@ -2035,6 +2041,7 @@ void print_ies(unsigned char *ie, int ie
|
||||
for (i=0; i<ie[1]; i++)
|
||||
printf(" %.2x", ie[2+i]);
|
||||
printf("\n");
|
||||
+#endif
|
||||
}
|
||||
ielen -= ie[1] + 2;
|
||||
ie += ie[1] + 2;
|
||||
@@ -2075,6 +2082,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)
|
||||
@@ -2103,6 +2111,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)
|
||||
@@ -2187,8 +2196,10 @@ static int print_bss_handler(struct nl_m
|
||||
if (bss[NL80211_BSS_FREQUENCY]) {
|
||||
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
|
||||
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",
|
||||
@@ -2382,6 +2393,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,
|
||||
@@ -2392,3 +2404,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
|
||||
@@ -289,6 +289,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])
|
||||
@@ -296,6 +297,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)
|
||||
{
|
||||
@@ -434,6 +436,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
|
||||
@@ -31,6 +31,12 @@ OBJS-$(HWSIM) += hwsim.o
|
||||
|
||||
OBJS += $(OBJS-y) $(OBJS-Y)
|
||||
|
||||
+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
|
||||
@@ -709,10 +709,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,
|
||||
@@ -807,11 +809,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_dump(struct nl80211_state *state,
|
||||
struct nl_msg *msg,
|
||||
--- a/interface.c
|
||||
+++ b/interface.c
|
||||
@@ -621,9 +621,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,
|
||||
@@ -713,6 +715,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"
|
||||
@@ -721,3 +724,4 @@ COMMAND(switch, freq,
|
||||
"Switch the operating channel by sending a channel switch announcement (CSA).");
|
||||
COMMAND(switch, channel, "<channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
|
||||
NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan, NULL);
|
||||
+#endif
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -359,6 +359,7 @@ static int handle_cac(struct nl80211_sta
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#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>]]",
|
||||
@@ -370,6 +371,7 @@ COMMAND(cac, trigger,
|
||||
NL80211_CMD_RADAR_DETECT, 0, CIB_NETDEV, handle_cac_trigger,
|
||||
"Start or trigger a 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;
|
||||
}
|
||||
120
package/network/utils/iwinfo/Makefile
Normal file
120
package/network/utils/iwinfo/Makefile
Normal file
@@ -0,0 +1,120 @@
|
||||
#
|
||||
# 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:=2019-10-16
|
||||
PKG_SOURCE_VERSION:=07315b6fdb2566a8626d8a1e4de76eb30456fe17
|
||||
PKG_MIRROR_HASH:=924914a51b8a668779e41dc2f40adfc1ae51846ea8b013de3e45999b4d04eecd
|
||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_PACKAGE_kmod-brcm-wl \
|
||||
CONFIG_PACKAGE_kmod-brcm-wl-mini \
|
||||
CONFIG_PACKAGE_kmod-brcm-wl-mimo \
|
||||
CONFIG_PACKAGE_kmod-cfg80211
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/libiwinfo
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Generalized Wireless Information Library (iwinfo)
|
||||
DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny +libuci +libubus
|
||||
ABI_VERSION:=20181126
|
||||
endef
|
||||
|
||||
define Package/libiwinfo/description
|
||||
Wireless information library with consistent interface for proprietary Broadcom,
|
||||
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/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
|
||||
|
||||
IWINFO_BACKENDS := \
|
||||
$(if $(CONFIG_PACKAGE_kmod-brcm-wl),wl) \
|
||||
$(if $(CONFIG_PACKAGE_kmod-brcm-wl-mini),wl) \
|
||||
$(if $(CONFIG_PACKAGE_kmod-brcm-wl-mimo),wl) \
|
||||
$(if $(CONFIG_PACKAGE_kmod-cfg80211),nl80211)
|
||||
|
||||
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="$(IWINFO_BACKENDS)"
|
||||
|
||||
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
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libiwinfo.so $(1)/usr/lib/libiwinfo.so
|
||||
$(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 $(1)/usr/lib/libiwinfo.so
|
||||
$(INSTALL_DIR) $(1)/usr/share/libiwinfo
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/hardware.txt $(1)/usr/share/libiwinfo/hardware.txt
|
||||
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/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,iwinfo))
|
||||
37
package/network/utils/layerscape/restool/Makefile
Normal file
37
package/network/utils/layerscape/restool/Makefile
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# 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:=lsdk-1903
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/restool
|
||||
PKG_SOURCE_VERSION:=8b1dd407bbd48b4f1a50c71b78083112a6397619
|
||||
PKG_MIRROR_HASH:=2bb086dd4fc4975268b89867e7fc95b42a764b56c4a498518ef0d54694ffe40e
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/restool
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Layerscape DPAA2 dynamical management tool
|
||||
DEPENDS:=@TARGET_layerscape
|
||||
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,107 @@
|
||||
From 37f0f1550e7822584b858edde416a694fb902236 Mon Sep 17 00:00:00 2001
|
||||
From: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
Date: Tue, 31 Jul 2018 13:33:20 +0300
|
||||
Subject: [PATCH] restool: fix get_device_file() function
|
||||
|
||||
This patch fixes multiple problems encountered in the
|
||||
get_device_file() function:
|
||||
- The deprecated atoi() function is replaced by strtoul
|
||||
- An invalid memory access was being performed by using
|
||||
memory from dir->d_name even after closedir(). This is
|
||||
fixed by a strdup() on the device filename.
|
||||
- Also, error prints now print any relevant error code.
|
||||
|
||||
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
||||
---
|
||||
restool.c | 44 ++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 28 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/restool.c b/restool.c
|
||||
index 7553659..78fd1bf 100644
|
||||
--- a/restool.c
|
||||
+++ b/restool.c
|
||||
@@ -1185,8 +1185,13 @@ out:
|
||||
|
||||
static int get_device_file(void)
|
||||
{
|
||||
+ int num_dev_files = 0;
|
||||
+ struct dirent *dir;
|
||||
int error = 0;
|
||||
+ char *device;
|
||||
int num_char;
|
||||
+ long val;
|
||||
+ DIR *d;
|
||||
|
||||
memset(restool.device_file, '\0', DEV_FILE_SIZE);
|
||||
|
||||
@@ -1214,10 +1219,6 @@ static int get_device_file(void)
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
- DIR *d;
|
||||
- struct dirent *dir;
|
||||
- int num_dev_files = 0;
|
||||
- char *dprc_index;
|
||||
|
||||
d = opendir("/dev");
|
||||
if (!d) {
|
||||
@@ -1227,26 +1228,34 @@ static int get_device_file(void)
|
||||
}
|
||||
while ((dir = readdir(d)) != NULL) {
|
||||
if (strncmp(dir->d_name, "dprc.", 5) == 0) {
|
||||
- dprc_index = &dir->d_name[5];
|
||||
- num_dev_files += 1;
|
||||
+ if (num_dev_files == 0)
|
||||
+ device = strdup(dir->d_name);
|
||||
+ num_dev_files++;
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
|
||||
if (num_dev_files == 1) {
|
||||
- int temp_len = strlen(dprc_index);
|
||||
+ errno = 0;
|
||||
+ val = strtoul(&device[5], NULL, 0);
|
||||
+ if ((errno == ERANGE && val == LONG_MAX) ||
|
||||
+ ( errno != 0 && val == 0 )) {
|
||||
+ ERROR_PRINTF("error: device file malformed\n");
|
||||
+ error = -1;
|
||||
+ goto out_free_device;;
|
||||
+ }
|
||||
+ restool.root_dprc_id = val;
|
||||
|
||||
- temp_len += 10;
|
||||
- num_char = sprintf(restool.device_file, "/dev/dprc.%s",
|
||||
- dprc_index);
|
||||
- if (num_char != temp_len) {
|
||||
- ERROR_PRINTF("sprintf error\n");
|
||||
+ num_char = snprintf(restool.device_file, DEV_FILE_SIZE,
|
||||
+ "/dev/dprc.%d", restool.root_dprc_id);
|
||||
+ if (num_char < 0 || num_char >= DEV_FILE_SIZE) {
|
||||
+ ERROR_PRINTF("error: device file malformed\n");
|
||||
error = -1;
|
||||
- goto out;
|
||||
+ goto out_free_device;
|
||||
}
|
||||
- restool.root_dprc_id = atoi(dprc_index);
|
||||
- if (access(restool.device_file, F_OK) != 0)
|
||||
- printf("no such dev file\n");
|
||||
+ error = access(restool.device_file, F_OK);
|
||||
+ if (error != 0)
|
||||
+ ERROR_PRINTF("error: access(%s) = %d\n", restool.device_file, error);
|
||||
} else {
|
||||
error = -1;
|
||||
if (num_dev_files == 0)
|
||||
@@ -1255,6 +1264,9 @@ static int get_device_file(void)
|
||||
ERROR_PRINTF("error: multiple root containers\n");
|
||||
}
|
||||
}
|
||||
+
|
||||
+out_free_device:
|
||||
+ free(device);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
||||
197
package/network/utils/linux-atm/Makefile
Normal file
197
package/network/utils/linux-atm/Makefile
Normal file
@@ -0,0 +1,197 @@
|
||||
#
|
||||
# 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:=7
|
||||
|
||||
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
|
||||
|
||||
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))))
|
||||
|
||||
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 "$@"
|
||||
270
package/network/utils/linux-atm/patches/000-debian_16.patch
Normal file
270
package/network/utils/linux-atm/patches/000-debian_16.patch
Normal file
@@ -0,0 +1,270 @@
|
||||
--- 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 */
|
||||
--- 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
|
||||
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,56 @@
|
||||
--- 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
|
||||
@@ -517,7 +517,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_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_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/test/ttcp.c
|
||||
+++ b/src/test/ttcp.c
|
||||
@@ -664,7 +664,7 @@ int no_check = 0;
|
||||
exit(0);
|
||||
|
||||
usage:
|
||||
- fprintf(stderr, Usage);
|
||||
+ fprintf(stderr, "%s", Usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
43
package/network/utils/maccalc/Makefile
Normal file
43
package/network/utils/maccalc/Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (C) 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:=maccalc
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/maccalc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=MAC address calculation
|
||||
endef
|
||||
|
||||
define Package/maccalc/description
|
||||
This package contains a MAC address manipulation utility.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CC="$(TARGET_CC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define Package/maccalc/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/maccalc $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,maccalc))
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user