* New address announcements in RTMGRP_IPV4_IFADDR netlink group
@ 2005-06-06 18:59 Teemu Koponen
2005-06-06 19:54 ` Thomas Graf
0 siblings, 1 reply; 2+ messages in thread
From: Teemu Koponen @ 2005-06-06 18:59 UTC (permalink / raw)
To: netdev
Netlink developers and gurus,
While fine-tuning the handover speed for a certain L3 mobility daemon
under Linux 2.6.11.10, I stumbled into the following behavior which
intuitively does not follow the semantics of the RTMGRP_IPV4_IFADDR
group:
0) A userspace daemon process is running and listening to the broadcast
group.
1) Address is inserted to an interface (ip addr add ... at shell).
2) The daemon receives a NEWADDR message, just as is should, but the
daemon is unable to bind to the address *immediately* (actually in the
function that processes the netlink message). The result is "cannot
assign an address" from the bind call. However, if I do insert a single
nanosleep, even with an arbitrary low sleep value, before the bind
call, the bind then succeeds.
So, what is the semantics of NEWADDR? Should the address be bindable
right after receiving the message? Or is there a race-condition between
userspace and kernel that the inserted sleep helps to overcome by
letting the kernel to run again before the bind call?
TIA,
Teemu
--
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: New address announcements in RTMGRP_IPV4_IFADDR netlink group
2005-06-06 18:59 New address announcements in RTMGRP_IPV4_IFADDR netlink group Teemu Koponen
@ 2005-06-06 19:54 ` Thomas Graf
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Graf @ 2005-06-06 19:54 UTC (permalink / raw)
To: Teemu Koponen; +Cc: netdev
* Teemu Koponen <aa027950f2fc7f2ad640cac4a11fbe93@iki.fi> 2005-06-06 11:59
> 0) A userspace daemon process is running and listening to the broadcast
> group.
>
> 1) Address is inserted to an interface (ip addr add ... at shell).
>
> 2) The daemon receives a NEWADDR message, just as is should, but the
> daemon is unable to bind to the address *immediately* (actually in the
> function that processes the netlink message). The result is "cannot
> assign an address" from the bind call. However, if I do insert a single
> nanosleep, even with an arbitrary low sleep value, before the bind
> call, the bind then succeeds.
>
> So, what is the semantics of NEWADDR? Should the address be bindable
> right after receiving the message?
The bind() call doesn't fail because of the address being non-existant,
it fails because the route has not been created for it. The netlink
message is generated before we notify the other subsystems about the
addition of a new address so you try to bind to an adress for which
no route has been generated yet. The best solution is probably to wait
for the route addition notification message being received and then
bind to that address.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-06 19:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-06 18:59 New address announcements in RTMGRP_IPV4_IFADDR netlink group Teemu Koponen
2005-06-06 19:54 ` Thomas Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox