Thank you! Assigning a proper ppp netmask solved this issue. I'll see
if I can get arround to testing the patch. Is there a chance of
including it in the "current"?

> By the way why do you use the same src and dst address?

I've been wondering about that myself, but that's how the client
interface ends up when server is running with "subnet" topology. It
seems to work well with bsd/linux/macos/windows clients, so I haven't
gone digging deeper.

Regards,

Mart

On Wed, Apr 13, 2016 at 10:45 AM, Martin Pieuchot <m...@openbsd.org> wrote:
> Hello Mart,
>
> On 13/04/16(Wed) 09:22, Mart Tõnso wrote:
>> Ah, yes, sorry about that. Here's the full routing info with ifconfig
output:
>>
>> # ifconfig
>> [...]
>> ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
>>         priority: 0
>>         groups: ppp egress
>>         inet 10.128.195.179 --> 10.64.64.64 netmask 0xff000000
>                                                       ^^^^^^^^^^
> Here is the problem.  For historical reasons the code that finds
> a matching interface to attach your route matches your gateway
> with ppp0's address/netmask.
>
> A workaround would be to change your ppp0 setup to use a /32 mask.
>
> A correct fix is included below, I'll be interested to hear if it
> works for you.
>
>> tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
>>         priority: 0
>>         groups: tun
>>         status: active
>>         inet 10.88.0.124 --> 10.88.0.124 netmask 0xffffff00
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
> By the way why do you use the same src and dst address?
>
> Index: net/route.c
> ===================================================================
> RCS file: /cvs/src/sys/net/route.c,v
> retrieving revision 1.298
> diff -u -p -r1.298 route.c
> --- net/route.c 26 Mar 2016 21:56:04 -0000      1.298
> +++ net/route.c 13 Apr 2016 07:38:11 -0000
> @@ -740,20 +740,16 @@ ifa_ifwithroute(int flags, struct sockad
>                                 ifa = ifaof_ifpforaddr(dst, ifp);
>                         if_put(ifp);
>                 } else {
> -                       ifa = ifa_ifwithnet(gateway, rtableid);
> -               }
> -       }
> -       if (ifa == NULL) {
> -               struct rtentry  *rt = rtalloc(gateway, 0, rtableid);
> -               /* The gateway must be local if the same address family. */
> -               if (!rtisvalid(rt) || ((rt->rt_flags & RTF_GATEWAY) &&
> -                   rt_key(rt)->sa_family == dst->sa_family)) {
> +                       struct rtentry *rt;
> +
> +                       rt = rtalloc(gateway, RT_RESOLVE, rtableid);
> +                       if (rt != NULL)
> +                               ifa = rt->rt_ifa;
>                         rtfree(rt);
> -                       return (NULL);
>                 }
> -               ifa = rt->rt_ifa;
> -               rtfree(rt);
>         }
> +       if (ifa == NULL)
> +               return (NULL);
>         if (ifa->ifa_addr->sa_family != dst->sa_family) {
>                 struct ifaddr   *oifa = ifa;
>                 ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp);

Reply via email to