Repository : ssh://git@open-mesh.org/batctl
On branch : master
commit a561b02508ef7d34eae4e10ec21213f19c7e541a Author: Marek Lindner lindner_marek@yahoo.de Date: Tue Apr 23 21:40:02 2013 +0800
batctl: tvlv - convert tt query packet to use tvlv unicast packets
Instead of generating TT specific packets the TVLV unicast API is used to send translation table data.
Signed-off-by: Marek Lindner lindner_marek@yahoo.de
a561b02508ef7d34eae4e10ec21213f19c7e541a packet.h | 33 --------------------------------- tcpdump.c | 45 --------------------------------------------- 2 files changed, 78 deletions(-)
diff --git a/packet.h b/packet.h index c976ffe..4675dc4 100644 --- a/packet.h +++ b/packet.h @@ -31,7 +31,6 @@ enum batadv_packettype { BATADV_BCAST = 0x04, BATADV_VIS = 0x05, BATADV_UNICAST_FRAG = 0x06, - BATADV_TT_QUERY = 0x07, BATADV_ROAM_ADV = 0x08, BATADV_UNICAST_4ADDR = 0x09, BATADV_CODED = 0x0a, @@ -83,9 +82,6 @@ enum batadv_unicast_frag_flags { BATADV_UNI_FRAG_LARGETAIL = BIT(1), };
-/* TT_QUERY subtypes */ -#define BATADV_TT_QUERY_TYPE_MASK 0x3 - /* tt data subtypes */ #define BATADV_TT_DATA_TYPE_MASK 0x0F
@@ -271,30 +267,6 @@ struct batadv_vis_packet { uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */ };
-struct batadv_tt_query_packet { - struct batadv_header header; - /* the flag field is a combination of: - * - TT_REQUEST or TT_RESPONSE - * - TT_FULL_TABLE - */ - uint8_t flags; - uint8_t dst[ETH_ALEN]; - uint8_t src[ETH_ALEN]; - /* the ttvn field is: - * if TT_REQUEST: ttvn that triggered the - * request - * if TT_RESPONSE: new ttvn for the src - * orig_node - */ - uint8_t ttvn; - /* tt_data field is: - * if TT_REQUEST: crc associated with the - * ttvn - * if TT_RESPONSE: table_size - */ - __be16 tt_data; -} __packed; - struct batadv_roam_adv_packet { struct batadv_header header; uint8_t reserved; @@ -303,11 +275,6 @@ struct batadv_roam_adv_packet { uint8_t client[ETH_ALEN]; } __packed;
-struct batadv_tt_change { - uint8_t flags; - uint8_t addr[ETH_ALEN]; -} __packed; - /** * struct batadv_coded_packet - network coded packet * @header: common batman packet header and ttl of first included packet diff --git a/tcpdump.c b/tcpdump.c index 9ef19f2..aa02c0e 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -325,47 +325,6 @@ static void dump_vlan(unsigned char *packet_buff, ssize_t buff_len, int read_opt parse_eth_hdr(packet_buff + 4, buff_len - 4, read_opt, time_printed); }
-static void dump_batman_tt(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) -{ - struct batadv_tt_query_packet *tt_query_packet; - char *tt_desc, *tt_data, tt_type; - - LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct batadv_tt_query_packet), "BAT TT"); - - tt_query_packet = (struct batadv_tt_query_packet *)(packet_buff + sizeof(struct ether_header)); - - if (!time_printed) - print_time(); - - switch (tt_query_packet->flags & BATADV_TT_QUERY_TYPE_MASK) { - case BATADV_TT_REQUEST: - tt_desc = "request"; - tt_data = "crc"; - tt_type = 'Q'; - break; - case BATADV_TT_RESPONSE: - tt_desc = "response"; - tt_data = "entries"; - tt_type = 'P'; - break; - default: - tt_desc = "unknown"; - tt_data = "unknown"; - tt_type = '?'; - break; - } - - printf("BAT %s > ", - get_name_by_macaddr((struct ether_addr *)tt_query_packet->src, read_opt)); - - printf("%s: TT %s, ttvn %d, %s %u, ttl %2d, v %d, flags [%c%c], length %zu\n", - get_name_by_macaddr((struct ether_addr *)tt_query_packet->dst, read_opt), - tt_desc, tt_query_packet->ttvn, tt_data, ntohs(tt_query_packet->tt_data), - tt_query_packet->header.ttl, tt_query_packet->header.version, - tt_type, (tt_query_packet->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'), - (size_t)buff_len - sizeof(struct ether_header)); -} - static void dump_batman_roam(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { struct batadv_roam_adv_packet *roam_adv_packet; @@ -622,10 +581,6 @@ static void parse_eth_hdr(unsigned char *packet_buff, ssize_t buff_len, int read if (dump_level & DUMP_TYPE_BATFRAG) dump_batman_frag(packet_buff, buff_len, read_opt, time_printed); break; - case BATADV_TT_QUERY: - if (dump_level & DUMP_TYPE_BATTT) - dump_batman_tt(packet_buff, buff_len, read_opt, time_printed); - break; case BATADV_ROAM_ADV: if (dump_level & DUMP_TYPE_BATTT) dump_batman_roam(packet_buff, buff_len, read_opt, time_printed);