From owner-freebsd-bugs Wed Jun 6 3:30:15 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A968137B409 for ; Wed, 6 Jun 2001 03:30:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.3/8.11.3) id f56AU7J92591; Wed, 6 Jun 2001 03:30:07 -0700 (PDT) (envelope-from gnats) Date: Wed, 6 Jun 2001 03:30:07 -0700 (PDT) Message-Id: <200106061030.f56AU7J92591@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Andre Albsmeier Subject: Re: kern/27890: FreeBSD not always seems to take the best route Reply-To: Andre Albsmeier Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/27890; it has been noted by GNATS. From: Andre Albsmeier To: Ruslan Ermilov Cc: Andre Albsmeier , bug-followup@FreeBSD.org Subject: Re: kern/27890: FreeBSD not always seems to take the best route Date: Wed, 6 Jun 2001 12:29:04 +0200 Thanks for helping... On Wed, 06-Jun-2001 at 11:24:19 +0300, Ruslan Ermilov wrote: > > ... > > I can't reproduce this problem on my 4.3-STABLE box. > > Yes, the UDP socket has the reference to the protocol-cloned > route to the destination host S through the router 1 initially, > and UDP packets go through that router. > > In my tests, router 1 (192.168.1.1) was the host *not* configured > to act as the router, so all "foreign" packets sent to it got OK, I have blocked packets coming from C on router 1. So I think I got the same config as you. > silently ignored. I used the ports/net/netcat utility to connect > to the UDP `echo' port of the destination S (192.168.2.1): > > Fig.1: Initial state, before UDP socket is open. > > : # netstat -arn > : Destination Gateway Flags Refs Use Netif Expire > : default 192.168.1.1 UGSc 0 2 rl0 > : 127.0.0.1 127.0.0.1 UH 1 6 lo0 > : 192.168.1 link#1 UC 3 0 rl0 => > > > Fig.2: We connect(2) UDP socket to the "echo" port on S (192.168.2.1). > > : # nc -u 192.168.2.1 echo > : ping1 > : ping2 > : ping3 > [...] > > As you can see, we receive no echos back. OK, same here. > Fig.3: Routing table after UDP socket is open. > > : # netstat -arn > : Destination Gateway Flags Refs Use Netif Expire > : default 192.168.1.1 UGSc 1 2 rl0 > : 127.0.0.1 127.0.0.1 UH 1 6 lo0 > : 192.168.1 link#1 UC 4 0 rl0 => > : 192.168.2.1 192.168.1.1 UGHW 1 14 rl0 > > The route to S (192.168.2.1) was cloned (W) from the `default' route. > refcnt=1 on the 192.168.2.1 route indicates that the UDP socket holds > a reference to this route. Same here: 192.168.2.1 192.168.1.1 UGHW 1 425 fxp0 > Fig.4: I manually add the route to the 192.168.2 network. > > : # route add -net 192.168.2 192.168.1.2 > : add net 192.168.2: gateway 192.168.1.2 OK, I don;t add it manually but wait until routed messages from 192.168.1.2 brings it back. > > Fig.5: Routing table after the route to the 192.168.2 network was added. > > : # netstat -arn > : Destination Gateway Flags Refs Use Netif Expire > : default 192.168.1.1 UGSc 1 2 rl0 > : 127.0.0.1 127.0.0.1 UH 1 6 lo0 > : 192.168.1 link#1 UC 4 0 rl0 => > : 192.168.2 192.168.1.2 UGSc 0 0 rl0 Yup, same here > As you can see, the route to the 192.168.2.1 host is deleted from the routing > table. It actually doesn't get freed completely, as it had non-zero reference > count (UDP socket still holds on it), but instead it gets marked as DOWN, and > will be freed and reallocated in ip_output() on the next use. > > Fig.6: We continue to send UDP datagrams. > > : # nc -u 192.168.2.1 echo (continued) > : ping4 > : ping4 > : ping5 > : ping5 > : ping6 > : ping6 > > As you can see, this time we get the echos back. Yes, same here :-( > Fig.7: Routing table after we sent more UDP datagrams. > > : # netstat -arn -finet > : Destination Gateway Flags Refs Use Netif Expire > : default 192.168.1.1 UGSc 0 2 rl0 > : 127.0.0.1 127.0.0.1 UH 1 6 lo0 > : 192.168.1 link#1 UC 4 0 rl0 => > : 192.168.2 192.168.1.2 UGSc 1 3 rl0 > > The refcount on 192.168.2 route has grown to 1, indicating that the > UDP socket now holds on this route. The `Use' count of 3 corresponds > to our three UDP datagrams (ping4, ping5, and ping6). > > Could you please repeat these steps in your environment, and try to > detect where it behaved differently in your case. It doesn't behave differently, that's interesting. May I ask you to try it using syslogd? - Let host C log to host S (with the route installed). - Watch C's messages appear on S. - Delete C's route to S (via router 2) - Let host C log again (run tcpdump on router 1 to see the packets come in) - Install the route to S (via router 2) again on C - Log more stuff. If you don't see the packets go into router 1 anymore I am really lost... Thanks, -Andre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message