Subject: Re: iproute2 (addr flush) infinite loop when unprivileged users

From: Stephen Hemminger <[email-masked]>
Date: Fri, 25 Jan 2008 15:02:57 -0800

On Sat, 26 Jan 2008 01:00:34 +0200
"Alon Bar-Lev" <[email-masked]> wrote:

> Hello,
> 
> When executing the following command using unprivileged users there is
> an infinite loop...
> /sbin/ip route flush dev eth1
> 
> Execution with -s produces:
> *** Round 28153, deleting 2 entries ***
> 
> *** Round 28154, deleting 2 entries ***
> 
> *** Round 28155, deleting 2 entries ***
> 
> *** Round 28156, deleting 2 entries ***
> 
> *** Round 28157, deleting 2 entries ***
> 
> *** Round 28158, deleting 2 entries ***
> 
> *** Round 28159, deleting 2 entries ***
> 
> I do not fully understand the sequence, but it may be kernel fault, as
> it should have returned EPERM for this request stopping the netlink
> request.
> 
> Anyway... A simple solution is to store the filter.flushed and fail if
> it keeps its value during loop iteration at
> ip/ipaddress.c::ipaddr_list_or_flush(), but this is only a
> workaround...
> 
> Please CC as I am not in netdev list.
> Thanks!
> Alon.

Non privileged users can't delete routes, but command keeps trying.
The correct way to handle it is to teach flush loop to look at error code.

-- 
Stephen Hemminger <[email-masked]>