On Tue, Jun 05, 2001 at 11:13:27AM -0400, Garrett Wollman wrote:
> <<On Tue, 5 Jun 2001 14:51:04 +0200, Jesper Skriver <[EMAIL PROTECTED]> said:
>
> > Since rt was the cached route of the pcb, the ref count is >= 1
> > since the pcb will have a ref count on it. In the case of a dynamic
> > route, in_losing calls rtrequest to delete the route but not rtfree.
> > rtrequest() only deletes the route from the routing table. It does
> > not free the route structure unless rt_refcnt is 0.
>
> This is correct. We can't have it rip the route out from under any
> number of PCBs and other routes which may have it referenced.
>
> > We know it won't be zero because the pcb has a ref count. As a
> > result it appears that we leak a route structure since it will never
> > be freed.
>
> No, the next time that route structure is used, the lack of an RTF_UP
> flag on the route will be noted, and the reference will be dropped
> before rtalloc() is called to find the new correct route. If you want
> the references to be dropped sooner, either send more traffic or close
> your connections more frequently.
>
Hmm, and what happens if the PCB is the only holder of this route?
The refcnt will be 1 in this case, and the code drops the reference
by setting inp->inp_route.ro_rt = 0. How this route can be reused
(and deleted) later?
Also, while I was playing with this, I noticed some strange things
I don't understand, and would like a tip on.
Why, when I add the `default' route, the rttrash variable increases?
Who calls the rtfree() in this case? And why this is different from
where I add the route to say `-net 10'? Note the difference:
Script started on Tue Jun 5 20:38:47 2001
perl# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
127.0.0.1 127.0.0.1 UH 1 6 lo0
192.168.4 link#1 UC 2 0 rl0 =>
perl# route add -net 10 192.168.4.65
add net 10: gateway 192.168.4.65
perl# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
10 192.168.4.65 UGSc 0 0 rl0
127.0.0.1 127.0.0.1 UH 1 6 lo0
192.168.4 link#1 UC 3 0 rl0 =>
192.168.4.65 link#1 UHLW 1 0 rl0 =>
Script done on Tue Jun 5 20:39:10 2001
Script started on Tue Jun 5 20:39:28 2001
perl# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
127.0.0.1 127.0.0.1 UH 1 6 lo0
192.168.4 link#1 UC 2 0 rl0 =>
perl# route add default 192.168.4.65
add net default: gateway 192.168.4.65
perl# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.4.65 UGSc 0 0 rl0
127.0.0.1 127.0.0.1 UH 1 6 lo0
192.168.4 link#1 UC 3 0 rl0 =>
Script done on Tue Jun 5 20:39:40 2001
Cheers,
--
Ruslan Ermilov Oracle Developer/DBA,
[EMAIL PROTECTED] Sunbay Software AG,
[EMAIL PROTECTED] FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message