From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 4 12:20:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAD711065673 for ; Sun, 4 Jan 2009 12:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B74288FC19 for ; Sun, 4 Jan 2009 12:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n04CK3RC036793 for ; Sun, 4 Jan 2009 12:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n04CK3aQ036792; Sun, 4 Jan 2009 12:20:03 GMT (envelope-from gnats) Resent-Date: Sun, 4 Jan 2009 12:20:03 GMT Resent-Message-Id: <200901041220.n04CK3aQ036792@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Luiz Otavio O Souza Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CAF1106564A for ; Sun, 4 Jan 2009 12:15:57 +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 50C418FC08 for ; Sun, 4 Jan 2009 12:15:57 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n04CFvRx089037 for ; Sun, 4 Jan 2009 12:15:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n04CFveA089036; Sun, 4 Jan 2009 12:15:57 GMT (envelope-from nobody) Message-Id: <200901041215.n04CFveA089036@www.freebsd.org> Date: Sun, 4 Jan 2009 12:15:57 GMT From: Luiz Otavio O Souza To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/130159: [patch] ppp fail to correctly set routes X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jan 2009 12:20:04 -0000 >Number: 130159 >Category: bin >Synopsis: [patch] ppp fail to correctly set routes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 04 12:20:03 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Luiz Otavio O Souza >Release: 7_STABLE >Organization: >Environment: FreeBSD server.rede.int.br 7.0-STABLE FreeBSD 7.0-STABLE #1: Tue Jul 8 22:05:33 BRT 2008 root@server.rede.int.br:/usr/src/sys/i386/compile/FW i386 >Description: When ppp is used on server side, it is mangling the route table, preventing connections from work. When ppp receive and accept a new connection (after the protocol handshake) it allocate a new tun interface and set the connection IP on this interface. Until here everything is ok, even the route to this new connection is correct (the route is inserted when ppp set an ip on tun). But then the ppp tries to set the correct mtu on interface (need by pppoe and others protocols - l2tp). This is done on rtUpdate() and the actual code does not set the interface on route message and this brake the route (that was correct). This patch fix this and fix another two ppp pr: kern/125079 and kern/122068 (and may be bin/126892). >How-To-Repeat: Any ppp server config is generating bad routes at connection >Fix: apply this patch Patch attached with submission follows: diff -u ipcp.c.orig ipcp.c --- ipcp.c.orig 2005-01-27 12:09:33.000000000 -0200 +++ ipcp.c 2008-12-02 19:12:49.000000000 -0200 @@ -690,7 +690,7 @@ 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)) diff -ur ipv6cp.c.orig ipv6cp.c --- ipv6cp.c.orig 2005-01-27 12:09:33.000000000 -0200 +++ ipv6cp.c 2008-12-02 19:12:58.000000000 -0200 @@ -245,7 +245,7 @@ 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)) diff -ur route.c.orig route.c --- route.c.orig 2005-01-10 09:12:36.000000000 -0200 +++ route.c 2008-12-03 10:09:09.000000000 -0200 @@ -524,7 +524,8 @@ " 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]); } } @@ -862,7 +863,8 @@ 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; @@ -909,6 +911,13 @@ p += memcpy_roundup(p, mask, mask->sa_len); } + if (ifp && ifp->sa_family == AF_LINK && ifa) { + 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); diff -ur route.h.orig route.h --- route.h.orig 2001-08-15 23:01:05.000000000 -0300 +++ route.h 2008-12-03 10:07:30.000000000 -0200 @@ -70,4 +70,5 @@ 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 *); >Release-Note: >Audit-Trail: >Unformatted: