On Fri, Nov 27, 2020 at 09:41:21PM +0100, Florian Obser wrote:
> An interface might have disappeared or switched rdomains while we
> waited for a FD. It's not a fatal condition if it arrives late.

That makes sense.

> I can only get it to lose the race by introducing a sleep in the
> parent process, but the race is still there. Found while implementing
> rdomain support in rad(8) using the same pattern.

I did not manage to reproduce this in rdomain rad, but I didn't try very
hard. I understand the race now.

ok tb

> I'm now wondering if it would be better to listen on the route socket
> for interface arrivals / departure in the parent process instead of
> the frontend asking for a raw socket to be opened. But that's a diff
> for another time.
>
> OK?
> 
> diff --git frontend.c frontend.c
> index 4b3f575611e..7efbe50df20 100644
> --- frontend.c
> +++ frontend.c
> @@ -1164,9 +1164,14 @@ set_icmp6sock(int icmp6sock, int rdomain)
>               }
>       }
>  
> -     if (icmp6sock != -1)
> -             fatalx("received unneeded ICMPv6 socket for rdomain %d",
> -                 rdomain);
> +     if (icmp6sock != -1) {
> +             /*
> +              * The interface disappeared or changed rdomain while we were
> +              * waiting for the parent process to open the raw socket.
> +              */
> +             close(icmp6sock);
> +             return;
> +     }
>  
>       LIST_FOREACH (iface, &interfaces, entries) {
>               if (event_initialized(&iface->icmp6ev->ev) &&
> 
> -- 
> I'm not entirely sure you are real.
> 

Reply via email to