OSPFd + OpenVPN collision again - function openvpn_clear_route()

  • Trying to setup full mesh OpenVPN between three sites that have CARP clusters and Multi-WAN.

    Having the problem on the client side. The p-to-p network is So the server interface is and the client is

    On the client in the routing table I see:

    | | link#22 | UH | 0 | 0 | 1500 | ovpnc2 |

    I do not see in there anywhere.

    But looking at  function openvpn_clear_route():

    function openvpn_clear_route($mode, $settings) {
    	if (empty($settings['tunnel_network']))
    	list($ip, $cidr) = explode('/', $settings['tunnel_network']);
    	$mask = gen_subnet_mask($cidr);
    	$clear_route = false;
    	switch($settings['mode']) {
    		case 'shared_key':
    			$clear_route = true;
    		case 'p2p_tls':
    		case 'p2p_shared_key':
    			if ($cidr == 30)
    				$clear_route = true;
    	if ($clear_route && !empty($ip) && !empty($mask)) {
    		list($ip1, $ip2) = openvpn_get_interface_ip($ip, $mask);
    		$ip_to_clear = ($mode == "server") ? $ip1 : $ip2;
    		mwexec("/sbin/route -q delete {$ip_to_clear}");

    I see that $ip_to_clear is selective which route it removes based on if its a server or client.

    In my case its a client. But the route stuck in the routing table is with the server's IP.

    Why not wack both routes in this function?



  • Oh wait! the interface is ovpnc2 which is this very tunnel OpenVPN client is trying to bring up. How is that route still there when the VPN tunnel is down.

Log in to reply