Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    OSPFd + OpenVPN collision again - function openvpn_clear_route()

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    2 Posts 1 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      ssheikh
      last edited by

      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 192.168.240.40/30. So the server interface is 192.168.240.41 and the client is 192.168.240.42.

      On the client in the routing table I see:

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

      I do not see 192.168.240.42 in there anywhere.

      But looking at  function openvpn_clear_route():

      
      function openvpn_clear_route($mode, $settings) {
      	if (empty($settings['tunnel_network']))
      		return;
      	list($ip, $cidr) = explode('/', $settings['tunnel_network']);
      	$mask = gen_subnet_mask($cidr);
      	$clear_route = false;
      
      	switch($settings['mode']) {
      		case 'shared_key':
      			$clear_route = true;
      			break;
      		case 'p2p_tls':
      		case 'p2p_shared_key':
      			if ($cidr == 30)
      				$clear_route = true;
      			break;
      	}
      
      	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?

      Thanks,

      Shahid

      1 Reply Last reply Reply Quote 0
      • S
        ssheikh
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.