On Thu, Aug 30, 2012 at 06:33:52PM +0200, Antonio Quartulli wrote:
On Thu, Aug 30, 2012 at 06:22:27PM +0200, Simon Wunderlich wrote:
The hash functions in the bridge loop avoidance code expects the VLAN vid to be right after the mac address, but this is not guaranteed.
Fix this by explicitly hashing over the right fields of the struct.
What about creating a new structure like
struct { uint8_t mac[ETH_ALEN]; short vid; }
to be used as first field in the batadv_claim object? Then you can easily hash the first 10 bytes in one shot. This would also help to avoid code duplication in the future (TT will support VLAN tagging sooner or later and will need the same trick).
Sorry, but my proposal is wrong. In the new structure we could still have some padding between the two fields (and we can't know), therefore we cannot hash 10bytes in one shot as I said.
Drop my idea :)
Cheers,