From 610bfc6bc99bc83680d190ebc69359a05fc7f605 Mon Sep 17 00:00:00 2001 From: Martin Hundebøll Date: Thu, 23 May 2013 16:53:02 +0200 Subject: batman-adv: Receive fragmented packets and merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fragments arriving at their destination are buffered for later merge. Merged packets are passed to the main receive function as had they never been fragmented. Fragments are forwarded without merging if the MTU of the outgoing interface is smaller than the size of the merged packet. Signed-off-by: Martin Hundebøll Signed-off-by: Marek Lindner Signed-off-by: Antonio Quartulli --- net/batman-adv/packet.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'net/batman-adv/packet.h') diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 5e3b1026b509..aa46c2778ad8 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h @@ -249,6 +249,33 @@ struct batadv_unicast_4addr_packet { */ }; +/** + * struct batadv_frag_packet - fragmented packet + * @header: common batman packet header with type, compatversion, and ttl + * @dest: final destination used when routing fragments + * @orig: originator of the fragment used when merging the packet + * @no: fragment number within this sequence + * @reserved: reserved byte for alignment + * @seqno: sequence identification + * @total_size: size of the merged packet + */ +struct batadv_frag_packet { + struct batadv_header header; +#if defined(__BIG_ENDIAN_BITFIELD) + uint8_t no:4; + uint8_t reserved:4; +#elif defined(__LITTLE_ENDIAN_BITFIELD) + uint8_t reserved:4; + uint8_t no:4; +#else +#error "unknown bitfield endianess" +#endif + uint8_t dest[ETH_ALEN]; + uint8_t orig[ETH_ALEN]; + __be16 seqno; + __be16 total_size; +}; + struct batadv_bcast_packet { struct batadv_header header; uint8_t reserved; -- cgit v1.2.3