Subject: Re: about ETOOMANYREFS using ppp.
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@tac.gw.com>
List: netbsd-help
Date: 01/19/2005 14:31:25
In article <20050119011003.6243028f.ccatrian@eml.cc>,
César Catrián C. <ccatrian@eml.cc> wrote:
>On Thu, 13 Jan 2005 18:32:41 -0500
>christos@zoulas.com (Christos Zoulas) wrote:
>>
>> Can you ktrace it and see what it is trying to do?
>> 
>> christos
>
>This is part of the trace. It was obtained sending an INT signal to the ppp
>process in -ddial mode.
>
> 13229 ppp      socket(0x11, 0x3, 0)               = 1

socket(PF_ROUTE, SOCK_RAW, 0) -> open routing socket.
> 13229 ppp      seteuid(0)                         = 0
> 13229 ppp      getpid()                           = 13229
> 13229 ppp      seteuid(0)                         = 0
> 13229 ppp      write(0x1, 0xbfbfe690, 0x7c)       Err#17 EEXIST

Tries to write a route, gets EEXIST back because the route is already
there.

> 13229 ppp      seteuid(0)                         = 0
> 13229 ppp      seteuid(0)                         = 0
> 13229 ppp      write(0x1, 0xbfbfe690, 0x7c)       Err#59 ETOOMANYREFS

Tries to write another route gets ETOOMANYREFS.

>Every time userppp reconnects itself (the process doesn't die), it can't 
>overwrite the default route. If the route is deleted manually (route delete 
>default), and the INT signal is sent, the program writes the route properly. 
>If the process is killed and started again, the default route can be set.
>
>The 'add! default HISADDR' command in the ppp.conf file doesn't overwrite the 
>default route, even if the peer has the same IP.

The bug is in the userppp code. It appears that it does not issue an
RTM_DELETE command when it dies, so the RTM_ADD that it does again
when it reconnects fails. Since userppp added the route, it is responsible
for cleaning it up before re-adding it. The fix to the code should be
simple. Seeing the obnoxious number of seteuid(0) calls it does, my
guess is that it is poorly written and I would not use it.

christos