Project

General

Profile

« Previous | Next » 

Revision c46d0b12

Added by James Webb about 6 years ago

Update openvpn.inc to allow OpenVPN instances to resync when running on a gateway group.

Implementation now checks if OpenVPN client/server running on gateway group should resync when IP changes occur or if cables are unplugged/replugged.

View differences:

src/etc/inc/openvpn.inc
1575 1575
		log_error(gettext("Resyncing OpenVPN instances."));
1576 1576
	}
1577 1577

  
1578
	// Check if OpenVPN clients and servers are running on the correct interfaces.
1578 1579
	if (is_array($config['openvpn']['openvpn-server'])) {
1579 1580
		foreach ($config['openvpn']['openvpn-server'] as & $settings) {
1580
			if ($interface <> "" && $interface != $settings['interface']) {
1581
				continue;
1581
			$mode_id = "server" . $settings['vpnid'];
1582
			$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
1583
			if (file_exists($fpath)) {
1584
				if (trim(file_get_contents($fpath), " \t\n") != get_failover_interface($settings['interface'])) {
1585
					openvpn_resync('server', $settings);
1586
				}
1582 1587
			}
1583
			openvpn_resync('server', $settings);
1584 1588
		}
1585 1589
	}
1586

  
1587 1590
	if (is_array($config['openvpn']['openvpn-client'])) {
1588 1591
		foreach ($config['openvpn']['openvpn-client'] as & $settings) {
1589
			if ($interface <> "" && $interface != $settings['interface']) {
1590
				continue;
1592
			$mode_id = "client" . $settings['vpnid'];
1593
			$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
1594
			if (file_exists($fpath)) {
1595
				if (trim(file_get_contents($fpath), " \t\n") != get_failover_interface($settings['interface'])) {
1596
					openvpn_resync('client', $settings);
1597
				}
1591 1598
			}
1592
			openvpn_resync('client', $settings);
1593 1599
		}
1594 1600
	}
1595 1601

  

Also available in: Unified diff