summaryrefslogtreecommitdiff
path: root/src/conf_mode/firewall_options.py
diff options
context:
space:
mode:
authorinitramfs <initramfs@initramfs.io>2022-09-26 11:01:02 +0800
committerinitramfs <initramfs@initramfs.io>2022-09-26 11:01:02 +0800
commit7709663c61f988cc60444fa932164f4931dfa7e3 (patch)
tree872363bf9534053a127d1aae13f5cf401531410b /src/conf_mode/firewall_options.py
parent435016fdb353b79577c40baa23af8e01fcadd098 (diff)
downloadvyos-1x-7709663c61f988cc60444fa932164f4931dfa7e3.tar.gz
vyos-1x-7709663c61f988cc60444fa932164f4931dfa7e3.zip
firewall: T4709: adjust TCP MSS clamping ranges and options
This commit fixes MSS clamping ranges as well as reintroduces the clamp-mss-to-pmtu option value to clamp to PMTU instead.
Diffstat (limited to 'src/conf_mode/firewall_options.py')
-rwxr-xr-xsrc/conf_mode/firewall_options.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/conf_mode/firewall_options.py b/src/conf_mode/firewall_options.py
index 67bf5d0e2..b7f4aa82c 100755
--- a/src/conf_mode/firewall_options.py
+++ b/src/conf_mode/firewall_options.py
@@ -115,9 +115,12 @@ def apply(tcp):
continue
# adjust TCP MSS per interface
- if mss:
+ if mss == 'clamp-mss-to-pmtu':
call('iptables --table mangle --append {} --out-interface {} --protocol tcp '
- '--tcp-flags SYN,RST SYN --jump TCPMSS --set-mss {} >&/dev/null'.format(target, intf, mss))
+ '--tcp-flags SYN,RST SYN --jump TCPMSS --clamp-mss-to-pmtu >&/dev/null'.format(target, intf))
+ elif mss:
+ call('iptables --table mangle --append {} --out-interface {} --protocol tcp '
+ '--tcp-flags SYN,RST SYN --jump TCPMSS --set-mss {} >&/dev/null'.format(target, intf, mss))
# Setup new ip6tables rules
if tcp['new_chain6']:
@@ -133,9 +136,12 @@ def apply(tcp):
continue
# adjust TCP MSS per interface
- if mss:
+ if mss == 'clamp-mss-to-pmtu':
+ call('ip6tables --table mangle --append {} --out-interface {} --protocol tcp '
+ '--tcp-flags SYN,RST SYN --jump TCPMSS --clamp-mss-to-pmtu >&/dev/null'.format(target, intf))
+ elif mss:
call('ip6tables --table mangle --append {} --out-interface {} --protocol tcp '
- '--tcp-flags SYN,RST SYN --jump TCPMSS --set-mss {} >&/dev/null'.format(target, intf, mss))
+ '--tcp-flags SYN,RST SYN --jump TCPMSS --set-mss {} >&/dev/null'.format(target, intf, mss))
return None