[Xorp-cvs] XORP cvs commit: xorp/fea/data_plane/ifconfig
Andrea Bittau
abittau at icir.org
Wed Dec 17 18:06:57 PST 2008
CVSROOT: /usr/local/www/data/cvs
Module name: xorp
Changes by: abittau at chum.icir.org 2008-12-18 02:06:57 UTC
XORP CVS repository
Modified files:
fea/data_plane/ifconfig ifconfig_set_netlink_socket.cc
ifconfig_set_netlink_socket.hh
Log message:
Partly tackle 839 [well, this is a sub-problem].
When having to change the interface status (i.e., bring iface up / down) in
order to accomplish some other task (e.g., change MAC), we try to hide the
transient state of the interface being down. In other words, after changing the
MAC address the interface has to always stay up at all times, and not
temporarily going down and back up. Before we would change the MAC, and at some
time in the future, when the netlink observer receives the event that we
actually put the iface down, the iface would go down temporarily. This could
break stuff as applications assume that the iface is up (changing MAC should not
bring it down).
Here's a comment I had in the code regarding wait_interface_status(), but I
think that putting it here is more appropriate:
// We need this to avoid nasty races, which are best explained with an example.
// On Linux, to change MAC address, you need to bring the interface down and up.
// Logically though, changing a MAC shouldn't change the interface status, so
// upper layers should be free to TX/RX on that interface without interruptions.
//
// Consider the following events:
// 1) Get change of MAC XRL.
// 2) interface down. (Note, configuration still thinks interface is UP because
// we update status only when receiving netlink events from the kernel.)
// 3) change mac.
// 4) interface up.
// 5) Notify completion of change MAC XRL.
// 6) Kernel tells us via netlink that interface status went down [step 2].
// 7) Get raw_send XRL.
// 8) raw_send XRL fails because we think interface is down.
// 9) Kernel tells us via netlink that interface status went up [step 4].
// This actually occurs in practice (VRRP changes MAC and sends an ARP right
// away). To avoid this we need to "hide" the fact that the interface is
// toggled up / down. Or, what we do here, is make it synchronous and complete
// the XRL only when we get message #9 and know that the interface will remain
// up. -sorbo
Bugzilla URL: http://bugzilla.xorp.org/bugzilla/show_bug.cgi?id=839
Revision Changes Path
1.25 +29 -1; commitid: 99b04949b01a41a7; xorp/fea/data_plane/ifconfig/ifconfig_set_netlink_socket.cc
1.14 +10 -1; commitid: 99b04949b01a41a7; xorp/fea/data_plane/ifconfig/ifconfig_set_netlink_socket.hh
More information about the Xorp-cvs
mailing list