Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpeVPN - Enhance keepalive parameters for client overrides #7574

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/etc/inc/plugins.inc.d/openvpn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,14 @@ function openvpn_csc_conf_write($settings, $server, $target_filename = null)
$conf .= "push-reset\n";
}

if (!empty($settings['push_register_dns'])) {
$conf .= "push \"register-dns\"\n";
}

// since "keepalive 10 60\n"; is fixed added to configation in line #528
// the GUI based "Keep alive interval" and "Keep alive timeout" were not used??
$conf .= "push \"keepalive 10 60\"\n";

if (!empty($settings['tunnel_network'])) {
list($ip, $mask) = explode('/', $settings['tunnel_network']);
if ($server['dev_mode'] == 'tun' && empty($server['topology_subnet'])) {
Expand All @@ -1001,6 +1009,9 @@ function openvpn_csc_conf_write($settings, $server, $target_filename = null)
$clientip = long2ip32($baselong + 2);
$conf .= "ifconfig-push {$clientip} {$serverip}\n";
} else {
if (!empty($server['topology_subnet'])) {
$conf .= "push \"topology subnet\"\n";
}
$conf .= "ifconfig-push {$ip} " . gen_subnet_mask($mask) . "\n";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@
<label>Client Settings</label>
<collapse>true</collapse>
</field>
<field>
<id>cso.keepalive_interval</id>
<label>Keep alive interval</label>
<advanced>true</advanced>
<type>text</type>
<help>Ping interval in seconds. 0 to disable keep alive</help>
</field>
<field>
<id>cso.keepalive_timeout</id>
<label>Keep alive timeout</label>
<advanced>true</advanced>
<type>text</type>
<help>Causes OpenVPN to restart after n seconds pass without reception of a ping or other packet from remote.</help>
</field>
<field>
<id>cso.register_dns</id>
<label>Register DNS</label>
Expand Down
6 changes: 6 additions & 0 deletions src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
<route_gateway type="NetworkField">
<NetMaskAllowed>N</NetMaskAllowed>
</route_gateway>
<keepalive_interval type="IntegerField">
<MinimumValue>0</MinimumValue>
</keepalive_interval>
<keepalive_timeout type="IntegerField">
<MinimumValue>0</MinimumValue>
</keepalive_timeout>
<redirect_gateway type="OptionField">
<Multiple>Y</Multiple>
<OptionValues>
Expand Down