From nobody@FreeBSD.org  Tue Mar 25 14:25:45 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05B9F1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 14:25:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id F1D4D8FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 14:25:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m2PEPWrE097428
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 25 Mar 2008 14:25:32 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m2PEPW9R097427;
	Tue, 25 Mar 2008 14:25:32 GMT
	(envelope-from nobody)
Message-Id: <200803251425.m2PEPW9R097427@www.freebsd.org>
Date: Tue, 25 Mar 2008 14:25:32 GMT
From: Chun-Tien Chang <tcs@kitty.2y.idv.tw>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ppp can not set the correct interface with pptpd
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         122068
>Category:       kern
>Synopsis:       [ppp] ppp can not set the correct interface with pptpd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 25 14:30:01 UTC 2008
>Closed-Date:    Sun Jan 04 15:47:03 UTC 2009
>Last-Modified:  Mon Apr 20 14:40:07 UTC 2009
>Originator:     Chun-Tien Chang
>Release:        FreeBSD 7.0 i386 Release
>Organization:
National Tsing Hua University
>Environment:
FreeBSD NAT.NTHUCC.2y.idv.tw 7.0-RELEASE FreeBSD 7.0-RELEASE #2: Sat Mar 22 02:38:46 CST 2008     root@NAT.NTHUCC.2y.idv.tw:/usr/obj/usr/src/sys/NAT.NTHUCC  i386
>Description:
When the Windows PPTP Client dial to the poptop vpn server,
the user-ppp can not set the routing table to the correct interface.


>How-To-Repeat:
install ports/net/poptop (poptop-1.3.4_1)

==ppp config==

/etc/ppp/ppp.conf
pptp:
 set timeout 0
 set log phase chat connect lcp ipcp command
 set dial
 set login
 set ifaddr 10.2.1.254 10.2.1.100-10.2.1.199 255.255.255.255
 set server /tmp/loop "" 0177
 set accmap  ffffffff
 enable proxy
 enable proxyall
 enable mschapv2
 accept mschapv2
 enable mppe
 enable lqr
 enable dns
 accept dns
 set dns 10.2.1.254
 allow mode direct

# ifconfig -a
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:50:56:a1:56:c7
        inet6 fe80::250:56ff:fea1:56c7%em0 prefixlen 64 scopeid 0x1
        inet 140.114.60.105 netmask 0xffffff00 broadcast 140.114.60.255
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:50:56:a1:38:13
        inet6 fe80::250:56ff:fea1:3813%em1 prefixlen 64 scopeid 0x2
        inet 10.2.1.254 netmask 0xffffff00 broadcast 10.2.1.255
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active


===the original routing table===

# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use    Mtu    Netif Expire
default            140.114.60.254     UGS         0  1741539   1500      em0
10.2.1.0/24        link#2             UC          0        0   1500      em1
10.2.1.242         00:50:56:a1:0d:ce  UHLW        1       77   1500      em1    948
10.2.1.251         00:50:56:a1:2e:32  UHLW        1        4   1500      em1    297
10.2.1.254         00:50:56:a1:38:13  UHLW        1     9395  16384      lo0
127.0.0.1          127.0.0.1          UH          0    14555  16384      lo0
140.114.60.0/24    link#1             UC          0        0   1500      em0
140.114.60.254     00:0f:8f:7e:dc:40  UHLW        2        0   1500      em0   1029


===after dial up to pptpd routing table===

# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use    Mtu    Netif Expire
default            140.114.60.254     UGS         0  1741769   1500      em0
10.2.1.0/24        link#2             UC          0        0   1500      em1
10.2.1.144         10.2.1.254         UGH         0        0   1398      em1
10.2.1.242         00:50:56:a1:0d:ce  UHLW        1       77   1500      em1    786
10.2.1.250         00:50:56:b9:43:25  UHLW        1        8   1500      em1   1197
10.2.1.251         00:50:56:a1:2e:32  UHLW        1        4   1500      em1    135
10.2.1.254         00:50:56:a1:38:13  UHLW        2     9395  16384      lo0
127.0.0.1          127.0.0.1          UH          0    14555  16384      lo0
140.114.60.0/24    link#1             UC          0        0   1500      em0
140.114.60.254     00:0f:8f:7e:dc:40  UHLW        2        0   1500      em0   1199

the result is different with freeebsd 6.2 release,
in freebsd 6.2 , the 10.2.1.144 will route to interface tun0
in freebsd 7.0 , it routes to em1 ????why?

# ifconfig -a
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:50:56:a1:56:c7
        inet6 fe80::250:56ff:fea1:56c7%em0 prefixlen 64 scopeid 0x1
        inet 140.114.60.105 netmask 0xffffff00 broadcast 140.114.60.255
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:50:56:a1:38:13
        inet6 fe80::250:56ff:fea1:3813%em1 prefixlen 64 scopeid 0x2
        inet 10.2.1.254 netmask 0xffffff00 broadcast 10.2.1.255
        media: Ethernet autoselect (1000baseTX <full-duplex>)
        status: active
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1398
        inet 10.2.1.254 --> 10.2.1.144 netmask 0xffffffff
        inet6 fe80::250:56ff:fea1:56c7%tun0 prefixlen 64 scopeid 0x7
        Opened by PID 4408

>Fix:
there are two way to fix it.
1. use differenet subnet for vpn. Don't use the same subnet for vpn routing.
   user-ppp will set the correct routing table.

2. downgrade to FreeBSD 6.2



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: remko 
Responsible-Changed-When: Tue Mar 25 19:42:10 UTC 2008 
Responsible-Changed-Why:  
over to maintainer group (-net) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122068 
State-Changed-From-To: open->closed 
State-Changed-By: vwe 
State-Changed-When: Sun Jan 4 15:46:55 UTC 2009 
State-Changed-Why:  
closing this PR in favour of bin/130159 (seems to be the same issue) 
which contains a patch 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122068 
Responsible-Changed-From-To: freebsd-net->bz 
Responsible-Changed-By: bz 
Responsible-Changed-When: Tue Apr 14 19:44:22 UTC 2009 
Responsible-Changed-Why:  
follow-ups to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122068 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/122068: commit references a PR
Date: Mon, 20 Apr 2009 14:39:04 +0000 (UTC)

 Author: bz
 Date: Mon Apr 20 14:38:48 2009
 New Revision: 191316
 URL: http://svn.freebsd.org/changeset/base/191316
 
 Log:
   Conditionally add the interface name and address if available
   so that a ppp running in `receiver' (server) mode can properly
   update routes, for example to update the MTU.
   
   Submitted by:	loos.br gmail.com (Luiz Otavio O Souza)
   PR:		bin/130159
   PR:		kern/125079, kern/122068, bin/126892
   MFC after:	3 days
 
 Modified:
   head/usr.sbin/ppp/ipcp.c
   head/usr.sbin/ppp/ipv6cp.c
   head/usr.sbin/ppp/route.c
   head/usr.sbin/ppp/route.h
 
 Modified: head/usr.sbin/ppp/ipcp.c
 ==============================================================================
 --- head/usr.sbin/ppp/ipcp.c	Mon Apr 20 14:36:01 2009	(r191315)
 +++ head/usr.sbin/ppp/ipcp.c	Mon Apr 20 14:38:48 2009	(r191316)
 @@ -692,7 +692,7 @@ ipcp_SetIPaddress(struct ipcp *ipcp, str
    if (bundle->ncp.cfg.sendpipe > 0 || bundle->ncp.cfg.recvpipe > 0) {
      ncprange_getsa(&myrange, &ssgw, &ssmask);
      ncpaddr_getsa(&hisncpaddr, &ssdst);
 -    rt_Update(bundle, sadst, sagw, samask);
 +    rt_Update(bundle, sadst, sagw, samask, NULL, NULL);
    }
  
    if (Enabled(bundle, OPT_SROUTES))
 
 Modified: head/usr.sbin/ppp/ipv6cp.c
 ==============================================================================
 --- head/usr.sbin/ppp/ipv6cp.c	Mon Apr 20 14:36:01 2009	(r191315)
 +++ head/usr.sbin/ppp/ipv6cp.c	Mon Apr 20 14:38:48 2009	(r191316)
 @@ -245,7 +245,7 @@ ipcp_SetIPv6address(struct ipv6cp *ipv6c
        ncpaddr_getsa(&ipv6cp->hisaddr, &ssdst);
      else
        sadst = NULL;
 -    rt_Update(bundle, sadst, sagw, samask);
 +    rt_Update(bundle, sadst, sagw, samask, NULL, NULL);
    }
  
    if (Enabled(bundle, OPT_SROUTES))
 
 Modified: head/usr.sbin/ppp/route.c
 ==============================================================================
 --- head/usr.sbin/ppp/route.c	Mon Apr 20 14:36:01 2009	(r191315)
 +++ head/usr.sbin/ppp/route.c	Mon Apr 20 14:38:48 2009	(r191316)
 @@ -532,7 +532,8 @@ route_UpdateMTU(struct bundle *bundle)
                     " mtu %lu\n", rtm->rtm_index, Index2Nam(rtm->rtm_index),
                     ncprange_ntoa(&dst), bundle->iface->mtu);
        }
 -      rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK]);
 +      rt_Update(bundle, sa[RTAX_DST], sa[RTAX_GATEWAY], sa[RTAX_NETMASK],
 +                sa[RTAX_IFP], sa[RTAX_IFA]);
      }
    }
  
 @@ -870,7 +871,8 @@ failed:
  
  void
  rt_Update(struct bundle *bundle, const struct sockaddr *dst,
 -          const struct sockaddr *gw, const struct sockaddr *mask)
 +          const struct sockaddr *gw, const struct sockaddr *mask,
 +          const struct sockaddr *ifp, const struct sockaddr *ifa)
  {
    struct ncprange ncpdst;
    struct rtmsg rtmes;
 @@ -920,6 +922,13 @@ rt_Update(struct bundle *bundle, const s
      p += memcpy_roundup(p, mask, mask->sa_len);
    }
  
 +  if (ifa && ifp && ifp->sa_family == AF_LINK) {
 +    rtmes.m_rtm.rtm_addrs |= RTA_IFP;
 +    p += memcpy_roundup(p, ifp, ifp->sa_len);
 +    rtmes.m_rtm.rtm_addrs |= RTA_IFA;
 +    p += memcpy_roundup(p, ifa, ifa->sa_len);
 +  }
 +
    rtmes.m_rtm.rtm_msglen = p - (char *)&rtmes;
  
    wb = ID0write(s, &rtmes, rtmes.m_rtm.rtm_msglen);
 
 Modified: head/usr.sbin/ppp/route.h
 ==============================================================================
 --- head/usr.sbin/ppp/route.h	Mon Apr 20 14:36:01 2009	(r191315)
 +++ head/usr.sbin/ppp/route.h	Mon Apr 20 14:38:48 2009	(r191316)
 @@ -70,4 +70,5 @@ extern void route_ParseHdr(struct rt_msg
  extern int rt_Set(struct bundle *, int, const struct ncprange *,
                    const struct ncpaddr *, int, int);
  extern void rt_Update(struct bundle *, const struct sockaddr *,
 +                      const struct sockaddr *, const struct sockaddr *,
                        const struct sockaddr *, const struct sockaddr *);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
