On 17/12/16(Sat) 07:52, Stefan Sperling wrote:
> On Sat, Dec 17, 2016 at 02:33:37AM +0100, Alexander Bluhm wrote:
> > Hi,
> > 
> > If rt_ifa_addlocal() in in_ifinit() fails, the address has been
> > added to the interface address list, but the local route is missing.
> > This inconsistency can result in a panic later.
> > 
> > panic: kernel diagnostic assertion "ifa == rt->rt_ifa" failed: file 
> > "/crypt/home/bluhm/openbsd/cvs/src/sys/netinet/if_ether.c", line 206
> > 
> > I have seen this crash in production on a 5.9 system and could
> > reproduce it on -current by inducing an error in rt_ifa_addlocal().
> > 
> > So in case of an error, remove the interface address to get a
> > consistent state again.
> > 
> > ok?

Haha, I have a similar diff in my tree!  I couldn't find a way to make
rt_ifa_addlocal() fail, but I agree this is needed.  ok mpi@

> The little dance with an aditional error variable is a bit confusing.
> It would be nice to avoid the extra variable. But off-hand I could not
> find a simpler diff which keeps the semantics of re-adding the original
> address if the ioctl errors. So your approach seems fine.

The proper way to simplify this mess is to always call in_ifinit() with
newifaddr = 1.  But it is the kind of work nobody want to spend her time
on.

Reply via email to