Thread (4 messages) 4 messages, 3 authors, 2012-09-09

Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't rely on positions in struct for hashing

From: Antonio Quartulli <hidden>
Date: 2012-08-30 16:46:27

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:
quoted
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,




-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help