Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2001 05:04:08 -0800 (PST)
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/netinet ip_input.c
Message-ID:  <200103181304.f2ID48w58379@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
ru          2001/03/18 05:04:07 PST

  Modified files:
    sys/netinet          ip_input.c 
  Log:
  Make sure the cached forwarding route (ipforward_rt) is still up before
  using it.  Not checking this may have caused the wrong IP address to be
  used when processing certain IP options (see example below).  This also
  caused the wrong route to be passed to ip_output() when forwarding, but
  fortunately ip_output() is smart enough to detect this.
  
  This example demonstrates the wrong behavior of the Record Route option
  observed with this bug.  Host ``freebsd'' is acting as the gateway for
  the ``sysv''.
  
  1. On the gateway, we add the route to the destination.  The new route
     will use the primary address of the loopback interface, 127.0.0.1:
  
  :  freebsd# route add 10.0.0.66 -iface lo0 -reject
  :  add host 10.0.0.66: gateway lo0
  
  2. From the client, we ping the destination.  We see the correct replies.
     Please note that this also causes the relevant route on the ``freebsd''
     gateway to be cached in ipforward_rt variable:
  
  :  sysv# ping -snv 10.0.0.66
  :  PING 10.0.0.66: 56 data bytes
  :  ICMP Host Unreachable from gateway 192.168.0.115
  :  ICMP Host Unreachable from gateway 192.168.0.115
  :  ICMP Host Unreachable from gateway 192.168.0.115
  :
  :  ----10.0.0.66 PING Statistics----
  :  3 packets transmitted, 0 packets received, 100% packet loss
  
  3. On the gateway, we delete the route to the destination, thus making
     the destination reachable through the `default' route:
  
  :  freebsd# route delete 10.0.0.66
  :  delete host 10.0.0.66
  
  4. From the client, we ping destination again, now with the RR option
     turned on.  The surprise here is the 127.0.0.1 in the first reply.
     This is caused by the bug in ip_rtaddr() not checking the cached
     route is still up befor use.  The debug code also shows that the
     wrong (down) route is further passed to ip_output().  The latter
     detects that the route is down, and replaces the bogus route with
     the valid one, so we see the correct replies (192.168.0.115) on
     further probes:
  
  :  sysv# ping -snRv 10.0.0.66
  :  PING 10.0.0.66: 56 data bytes
  :  64 bytes from 10.0.0.66: icmp_seq=0. time=10. ms
  :    IP options:  <record route> 127.0.0.1, 10.0.0.65, 10.0.0.66,
  :                                192.168.0.65, 192.168.0.115, 192.168.0.120,
  :                                0.0.0.0(Current), 0.0.0.0, 0.0.0.0
  :  64 bytes from 10.0.0.66: icmp_seq=1. time=0. ms
  :    IP options:  <record route> 192.168.0.115, 10.0.0.65, 10.0.0.66,
  :                                192.168.0.65, 192.168.0.115, 192.168.0.120,
  :                                0.0.0.0(Current), 0.0.0.0, 0.0.0.0
  :  64 bytes from 10.0.0.66: icmp_seq=2. time=0. ms
  :    IP options:  <record route> 192.168.0.115, 10.0.0.65, 10.0.0.66,
  :                                192.168.0.65, 192.168.0.115, 192.168.0.120,
  :                                0.0.0.0(Current), 0.0.0.0, 0.0.0.0
  :
  :  ----10.0.0.66 PING Statistics----
  :  3 packets transmitted, 3 packets received, 0% packet loss
  :  round-trip (ms)  min/avg/max = 0/3/10
  
  Revision  Changes    Path
  1.164     +8 -20     src/sys/netinet/ip_input.c


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103181304.f2ID48w58379>