All of lore.kernel.org
 help / color / mirror / Atom feed
* Why RTM_NEWADDR is sent before FIB update?
@ 2010-10-20 10:23 Timo Teräs
  0 siblings, 0 replies; only message in thread
From: Timo Teräs @ 2010-10-20 10:23 UTC (permalink / raw)
  To: netdev

Hi,

I'm wonder why does devinet.c:__inet_insert_ifa() (and other places)
send first the RTM_NEWADDR notification and only after that calls
inetaddr_chain notifiers?

The reason I'm asking that this gives a race condition to user land:
 1. process A changes IP address
 2. kernel sends RTM_NEWADDR
 3. process B gets notification
 4. process B tries to bind() to new IP but that fails with
EADDRNOTAVAIL because FIB is not yet updated and inet_addr_type() in
inet_bind() does not recognize the IP as local
 5. kernel calls inetaddr_chain notifiers which updates FIB

My understanding was that RTM_NEWADDR was notification about new address
being usable. But it's currently a notification about "new address will
be usable soon".

So should we:
 a) call first notifiers and after that send RTM_NEWADDR?
 b) synchronise inet_bind() with address changes somehow?
 c) live with the bad semantics of the notification in userland
 d) ??

- Timo

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-20 10:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 10:23 Why RTM_NEWADDR is sent before FIB update? Timo Teräs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.