bridge: Change struct port's active_iface member from index to pointer.
authorBen Pfaff <blp@nicira.com>
Thu, 17 Mar 2011 22:57:20 +0000 (15:57 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 22 Mar 2011 00:01:49 +0000 (17:01 -0700)
commit990cda854810c4f3d926156f08cda64064075e77
tree045f093cd1992ed5119de9dc68db1631c4c79489
parent27b3a6e0b36ef36bf40dcaee7a6a61dbb495e33f
bridge: Change struct port's active_iface member from index to pointer.

This makes the code easier to understand.

As a historical note, the "bridge" code was originally written in an
almighty hurry, and so some design decisions were made on the basis of
being unlikely to cause serious bugs instead of on the basis of being
easy to understand.  That's why there are so many array indexes sprinkled
around the bridge data structures, and so much range checking of their
values, when it would be better to just have pointers that can be followed
directly.  I figured that getting the wrong index would at least do
something half-reasonable in most cases, whereas dereferencing a freed
pointer was likely to segfault sooner or later and cause immediate failure.

But now I think it's time to improve the code.  The code is mature enough
now that we should be able to thoroughly understand the data lifetime
issues.
vswitchd/bridge.c