openvpn: move tun-mtu/fragment/mssfix to instances (part 1)

This commit is contained in:
Franco Fichtner 2023-08-29 08:16:53 +02:00
parent 2973d3b3f0
commit efd15f70c3
5 changed files with 38 additions and 40 deletions

View File

@ -135,27 +135,4 @@
<advanced>true</advanced>
<help>Set primary WINS server address (NetBIOS over TCP/IP Name Server). Repeat this option to set secondary WINS server addresses.</help>
</field>
<field>
<type>header</type>
<label>Advanced Settings</label>
<collapse>true</collapse>
</field>
<field>
<id>cso.tun_mtu</id>
<label>TUN device MTU</label>
<type>text</type>
<help>Take the TUN device MTU to be tun-mtu and derive the link MTU from it.</help>
</field>
<field>
<id>cso.fragment</id>
<label>Fragment size</label>
<type>text</type>
<help>Enable internal datagram fragmentation so that no UDP datagrams are sent which are larger than the specified byte size.</help>
</field>
<field>
<id>cso.mssfix</id>
<label>MSS fix</label>
<type>checkbox</type>
<help>Announce to TCP sessions running over the tunnel that they should limit their send packet sizes such that after OpenVPN has encapsulated them, the resulting UDP packet size that OpenVPN sends to its peer will not exceed the recommended size.</help>
</field>
</fields>

View File

@ -362,4 +362,25 @@ Set to 0 to disable, remember to change your client as well.
Set primary NTP server address (Network Time Protocol). Repeat this option to set secondary NTP server addresses.
</help>
</field>
<field>
<id>instane.tun_mtu</id>
<label>TUN device MTU</label>
<type>text</type>
<advanced>true</advanced>
<help>Take the TUN device MTU to be tun-mtu and derive the link MTU from it.</help>
</field>
<field>
<id>instane.fragment</id>
<label>Fragment size</label>
<type>text</type>
<advanced>true</advanced>
<help>Enable internal datagram fragmentation so that no UDP datagrams are sent which are larger than the specified byte size.</help>
</field>
<field>
<id>instance.mssfix</id>
<label>MSS fix</label>
<type>checkbox</type>
<advanced>true</advanced>
<help>Announce to TCP sessions running over the tunnel that they should limit their send packet sizes such that after OpenVPN has encapsulated them, the resulting UDP packet size that OpenVPN sends to its peer will not exceed the recommended size.</help>
</field>
</fields>

View File

@ -143,9 +143,6 @@ class OpenVPN extends BaseModel
'description',
'dns_domain',
'dns_domain_search',
'fragment',
'mssfix',
'tun_mtu',
'tunnel_network',
'tunnel_networkv6',
];

View File

@ -91,19 +91,6 @@
<description type="TextField">
<Required>N</Required>
</description>
<tun_mtu type="IntegerField">
<Required>N</Required>
<MinimumValue>60</MinimumValue>
<MaximumValue>65535</MaximumValue>
</tun_mtu>
<fragment type="IntegerField">
<Required>N</Required>
<MinimumValue>0</MinimumValue>
<MaximumValue>65528</MaximumValue>
</fragment>
<mssfix type="BooleanField">
<Required>N</Required>
</mssfix>
</Overwrite>
</Overwrites>
<Instances>
@ -381,6 +368,19 @@
<FieldSeparator>,</FieldSeparator>
<asList>Y</asList>
</ntp_servers>
<tun_mtu type="IntegerField">
<Required>N</Required>
<MinimumValue>60</MinimumValue>
<MaximumValue>65535</MaximumValue>
</tun_mtu>
<fragment type="IntegerField">
<Required>N</Required>
<MinimumValue>0</MinimumValue>
<MaximumValue>65528</MaximumValue>
</fragment>
<mssfix type="BooleanField">
<Required>N</Required>
</mssfix>
<carp_depend_on type="VirtualIPField">
<type>carp</type>
<Required>N</Required>

View File

@ -112,7 +112,6 @@ function get_vhid_status()
return $vhids;
}
$opts = getopt('ah', [], $optind);
$args = array_slice($argv, $optind);
@ -130,8 +129,10 @@ if (isset($opts['h']) || empty($args) || !in_array($args[0], ['start', 'stop', '
if ($action != 'stop') {
$mdl->generateInstanceConfig($instance_id);
}
$vhids = $action == 'configure' ? get_vhid_status() : [];
$instance_ids = [];
foreach ($mdl->Instances->Instance->iterateItems() as $key => $node) {
if (empty((string)$node->enabled)) {
continue;
@ -177,6 +178,7 @@ if (isset($opts['h']) || empty($args) || !in_array($args[0], ['start', 'stop', '
}
fclose($statHandle);
}
/**
* When -a is specified, cleaup up old or disabled instances
*/
@ -208,5 +210,6 @@ if (isset($opts['h']) || empty($args) || !in_array($args[0], ['start', 'stop', '
}
}
}
closelog();
}