From: Markus Stumpf <[EMAIL PROTECTED]>
> 
> Thanks a lot! I have applied the patches and it works only partially.

Sorry, it needs more work...

Please revert the previous patches, and try with these attached again.

---
Keiichi SHIMA
IIJ Research Laboratory  <[EMAIL PROTECTED]>
KAME Project <[EMAIL PROTECTED]>

--- in_pcb.c.orig       Thu Mar 28 14:13:23 2002
+++ in_pcb.c    Thu Mar 28 14:15:10 2002
@@ -411,9 +411,10 @@
                 */
                ro = &inp->inp_route;
                if (ro->ro_rt &&
-                   (satosin(&ro->ro_dst)->sin_addr.s_addr !=
-                       sin->sin_addr.s_addr ||
-                   inp->inp_socket->so_options & SO_DONTROUTE)) {
+                   (ro->ro_dst.sa_family != AF_INET ||
+                    satosin(&ro->ro_dst)->sin_addr.s_addr !=
+                    sin->sin_addr.s_addr ||
+                    inp->inp_socket->so_options & SO_DONTROUTE)) {
                        RTFREE(ro->ro_rt);
                        ro->ro_rt = (struct rtentry *)0;
                }
@@ -421,6 +422,7 @@
                    (ro->ro_rt == (struct rtentry *)0 ||
                    ro->ro_rt->rt_ifp == (struct ifnet *)0)) {
                        /* No route yet, so try to acquire one */
+                       bzero(&ro->ro_dst, sizeof(struct sockaddr_in));
                        ro->ro_dst.sa_family = AF_INET;
                        ro->ro_dst.sa_len = sizeof(struct sockaddr_in);
                        ((struct sockaddr_in *) &ro->ro_dst)->sin_addr =
--- ip_output.c.orig    Wed Mar 27 14:29:43 2002
+++ ip_output.c Thu Mar 28 14:15:56 2002
@@ -219,11 +219,13 @@
         * and is still up.  If not, free it and try again.
         */
        if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+          dst->sin_family != AF_INET ||
           dst->sin_addr.s_addr != ip->ip_dst.s_addr)) {
                RTFREE(ro->ro_rt);
                ro->ro_rt = (struct rtentry *)0;
        }
        if (ro->ro_rt == 0) {
+               bzero(dst, sizeof(*dst));
                dst->sin_family = AF_INET;
                dst->sin_len = sizeof(*dst);
                dst->sin_addr = ip->ip_dst;
--- ip6_output.c.orig   Wed Mar 27 14:23:54 2002
+++ ip6_output.c        Wed Mar 27 14:08:22 2002
@@ -461,6 +461,7 @@
         * and is still up. If not, free it and try again.
         */
        if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+                        dst->sin6_family != AF_INET6 ||
                         !IN6_ARE_ADDR_EQUAL(&dst->sin6_addr, &ip6->ip6_dst))) {
                RTFREE(ro->ro_rt);
                ro->ro_rt = (struct rtentry *)0;
--- in6_src.c.orig      Wed Mar 27 14:24:28 2002
+++ in6_src.c   Wed Mar 27 14:47:31 2002
@@ -239,7 +239,9 @@
         */
        if (ro) {
                if (ro->ro_rt &&
-                   !IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, dst)) {
+                   (!(ro->ro_rt->rt_flags & RTF_UP) ||
+                    ro->ro_dst.sin6_family != AF_INET6 ||
+                    !IN6_ARE_ADDR_EQUAL(&satosin6(&ro->ro_dst)->sin6_addr, dst))) {
                        RTFREE(ro->ro_rt);
                        ro->ro_rt = (struct rtentry *)0;
                }

Reply via email to