Skip to content

Commit

Permalink
system-ip: T5449: add TCP MSS probing options
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbaturin committed Aug 8, 2023
1 parent 0e92ee2 commit b4a55ed
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
58 changes: 58 additions & 0 deletions interface-definitions/system-ip.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,64 @@
</leafNode>
</children>
</node>
<node name="tcp">
<properties>
<help>IPv4 TCP parameters</help>
</properties>
<children>
<node name="mss">
<properties>
<help>IPv4 TCP MSS probing options</help>
</properties>
<children>
<leafNode name="probing">
<properties>
<help>Attempt to lower the MSS if TCP connections fail to establish</help>
<completionHelp>
<list>enable force</list>
</completionHelp>
<valueHelp>
<format>enable</format>
<description>Attempt TCP MSS probing when an ICMP black hole is detected</description>
</valueHelp>
<valueHelp>
<format>force</format>
<description>Attempt TCP MSS probing by default</description>
</valueHelp>
<constraint>
<regex>(enable|force)</regex>
</constraint>
<constraintErrorMessage>Must be enable or force</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="base">
<properties>
<help>Base MSS to start probing from (applicable to "probing force")</help>
<valueHelp>
<format>u32:48-1460</format>
<description>Base MSS value for probing (default: 1024)</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 48-1460"/>
</constraint>
</properties>
</leafNode>
<leafNode name="floor">
<properties>
<help>Minimum MSS to stop probing at (default: 48)</help>
<valueHelp>
<format>u32:48-1460</format>
<description>Minimum MSS value to probe</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 48-1460"/>
</constraint>
</properties>
</leafNode>
</children>
</node>
</children>
</node>
#include <include/system-ip-protocol.xml.i>
</children>
</node>
Expand Down
21 changes: 21 additions & 0 deletions src/conf_mode/system-ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,27 @@ def apply(opt):
value = '1' if (tmp != None) else '0'
sysctl_write('net.ipv4.fib_multipath_hash_policy', value)

# configure TCP options (defaults as of Linux 6.4)
tmp = dict_search('tcp.mss.probing', opt)
if tmp is None:
value = 0
elif tmp == 'enable':
value = 1
elif tmp == 'force':
value = 2
else:
# Shouldn't happen
raise ValueError("TCP MSS probing is neither 'enable' nor 'force'!")
sysctl_write('net.ipv4.tcp_mtu_probing', value)

tmp = dict_search('tcp.mss.base', opt)
value = '1024' if (tmp is None) else tmp
sysctl_write('net.ipv4.tcp_base_mss', value)

tmp = dict_search('tcp.mss.floor', opt)
value = '48' if (tmp is None) else tmp
sysctl_write('net.ipv4.tcp_mtu_probe_floor', value)

if 'protocol' in opt:
zebra_daemon = 'zebra'
# Save original configuration prior to starting any commit actions
Expand Down

0 comments on commit b4a55ed

Please sign in to comment.