diff options
author | Sven Eckelmann <sven@narfation.org> | 2011-11-20 09:47:38 -0500 |
---|---|---|
committer | Marek Lindner <lindner_marek@yahoo.de> | 2012-02-16 13:50:19 -0500 |
commit | 76543d14aec6ce5cb3fc7be9b39c50fcebd2043b (patch) | |
tree | 4f739cfadaee8ec9a06d7855956f3accc1dcc2be /net/batman-adv/hard-interface.c | |
parent | 17071578888c7c18709e48e74fae228c04581b9a (diff) |
batman-adv: Explicitly mark the common header structure
All batman-adv packets have a common 3 byte header. It can be used to share
some code between different code paths, but it was never explicit stated that
this header has to be always the same for all packets. Therefore, new code
changes always have the problem that they may accidently introduce regressions
by moving some elements around.
A new structure is introduced that contains the common header and makes it
easier visible that these 3 bytes have to be the same for all on-wire packets.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r-- | net/batman-adv/hard-interface.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 7704df468e0b..d3e0e32e51c6 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -590,17 +590,17 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
590 | 590 | ||
591 | batman_ogm_packet = (struct batman_ogm_packet *)skb->data; | 591 | batman_ogm_packet = (struct batman_ogm_packet *)skb->data; |
592 | 592 | ||
593 | if (batman_ogm_packet->version != COMPAT_VERSION) { | 593 | if (batman_ogm_packet->header.version != COMPAT_VERSION) { |
594 | bat_dbg(DBG_BATMAN, bat_priv, | 594 | bat_dbg(DBG_BATMAN, bat_priv, |
595 | "Drop packet: incompatible batman version (%i)\n", | 595 | "Drop packet: incompatible batman version (%i)\n", |
596 | batman_ogm_packet->version); | 596 | batman_ogm_packet->header.version); |
597 | goto err_free; | 597 | goto err_free; |
598 | } | 598 | } |
599 | 599 | ||
600 | /* all receive handlers return whether they received or reused | 600 | /* all receive handlers return whether they received or reused |
601 | * the supplied skb. if not, we have to free the skb. */ | 601 | * the supplied skb. if not, we have to free the skb. */ |
602 | 602 | ||
603 | switch (batman_ogm_packet->packet_type) { | 603 | switch (batman_ogm_packet->header.packet_type) { |
604 | /* batman originator packet */ | 604 | /* batman originator packet */ |
605 | case BAT_OGM: | 605 | case BAT_OGM: |
606 | ret = recv_bat_ogm_packet(skb, hard_iface); | 606 | ret = recv_bat_ogm_packet(skb, hard_iface); |