bin/130159: [patch] ppp fail to correctly set routes

Luiz Otavio O Souza loos.br at gmail.com
Sun Jan 4 04:20:04 PST 2009


>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 at 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:


More information about the freebsd-bugs mailing list