Developing lightweight computation at the DSG edge

Commit 4da2b261 authored by p4u's avatar p4u
Browse files

Add function to create/remove TCP clamp MSS rule. It is executed when a...

Add function to create/remove TCP clamp MSS rule. It is executed when a network device is configured as WAN.
parent 1e492f3d
......@@ -738,6 +738,7 @@ qmp_configure_lan() {
local device
for device in $(qmp_get_devices lan) ; do
qmp_attach_device_to_interface $device lan
qmp_set_mss_clamping $device remove
done
}
......@@ -771,13 +772,14 @@ qmp_configure_network() {
# WAN devices
for i in $(qmp_get_devices wan) ; do
echo "Configuring $i in WAN mode"
echo "Configuring $i in WAN mode"
local viface="$(qmp_get_virtual_iface $i)"
qmp_uci_set_raw network.$viface="interface"
qmp_attach_device_to_interface $i $viface
qmp_uci_set_raw network.$viface.proto="dhcp"
metric="$(qmp_uci_get network.wan_metric)"
qmp_uci_set_raw network.$viface.metric="${metric:-2048}"
qmp_set_mss_clamping $i
done
# LAN devices configuration
......
......@@ -30,6 +30,26 @@ QMPINFO="/etc/qmp/qmpinfo"
SOURCE_NET=1
[ -z "$SOURCE_COMMON" ] && . $QMP_PATH/qmp_common.sh
# Adds the iptables mss clamping rule for descovering maximum MSS
# <device> [remove]
qmp_set_mss_clamping() {
local dev="$1"
local rm="$2"
local fw="/etc/firewall.user"
local rule="iptables -A FORWARD -p tcp -o $dev -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu"
[ -z "$dev" ] && return
if [ "$rm" == "remove" ]; then
sed -i /"${rule}"/d $fw
else if [ $(cat $fw | grep "$rule" -c) -eq 0 ]; then
qmp_log Adding TCP ClampMSS rule for $dev
echo "$rule" >> $fw
fi;fi
}
qmp_configure_prepare_network() {
local toRemove="$(uci show network | egrep "network.(lan|wan|mesh_).*=interface" | cut -d. -f2 | cut -d= -f1)"
echo "Removing current network configuration"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment