[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

Re: [Openvpn-users] Route add fail with IPAPI and PPP.


  • Subject: Re: [Openvpn-users] Route add fail with IPAPI and PPP.
  • From: James Yonan <jim@xxxxxxxxx>
  • Date: Sat, 22 Jan 2005 00:19:56 -0700 (MST)

On Fri, 21 Jan 2005, Mathias Sundman wrote:

> Before I start digging into the problem that seems to occur when OpenVPN 
> tries to add routes on Windows via IPAPI when using a PPP or PPPoE 
> adapter, there's something I'd like to have explained to me.

I think I figured it out!  The endpoint of the PPP link is considered to 
be "local" by Windows, so dwForwardType in the MIB_IPFORWARDROW struct 
must be set to 3 instead of 4 prior to the CreateIpForwardEntry call.

Patch attached.

James
--- openvpn-2.0_rc8/route.c	2005-01-09 18:46:27.000000000 -0600
+++ ./route.c	2005-01-21 01:12:33.266032376 -0600
@@ -1112,8 +1112,19 @@
       if (status == NO_ERROR)
 	ret = true;
       else
-	msg (M_WARN, "ROUTE: route addition failed using CreateIpForwardEntry: %s",
-	     strerror_win32 (status, &gc));
+	{
+	  /* failed, try a different forward type (--redirect-gateway over RRAS seems to need this) */
+	  fr.dwForwardType = 3;  /* the next hop is the final dest */
+
+	  status = CreateIpForwardEntry (&fr);
+
+	  if (status == NO_ERROR)
+	    ret = true;
+	  else
+	    msg (M_WARN, "ROUTE: route addition failed using CreateIpForwardEntry: %s [if_index=%u]",
+		 strerror_win32 (status, &gc),
+		 (unsigned int)if_index);
+	}
     }
 
   gc_free (&gc);