pull request: batman-adv 2013-10-09b
Subsystems (4)
Hello David,
here you have my fixed pull request intended for net-next.
The previous build error was due to an accidental remotion of the beginning of a batadv_dbg() statement during a merge conflict resolution.
Sorry for that.
Please pull or let me know of any problem.
Thanks a lot,
Antonio
The following changes since commit 3d7d562ca4a884089344eb13451b5903a18d3817:
bnx2x: Add ndo_get_phys_port_id support (2013-10-09 14:55:13 -0400)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 18c68d5960c8dfeb2db113f4b871bab259cfd565:
batman-adv: reorder batadv_iv_flags (2013-10-09 21:22:35 +0200)
----------------------------------------------------------------
Included changes:
- update emails for A. Quartulli and M. Lindner in MAINTAINERS
- switch to the next on-the-wire protocol version
- introduce the T(ype) V(ersion) L(ength) V(alue) framework
- adjust the existing components to make them use the new TVLV code
- make the TT component use CRC32 instead of CRC16
- totally remove the VIS functionality (has been moved to userspace)
- reorder packet types and flags
- add static checks on packet format
- remove __packed from batadv_ogm_packet
----------------------------------------------------------------
Antonio Quartulli (4):
MAINTAINERS: batman-adv - update emails
batman-adv: switch to a new packet compatibility version
batman-adv: use CRC32C instead of CRC16 in TT code
batman-adv: move BATADV_TT_CLIENT_TEMP to higher bit
Marek Lindner (7):
batman-adv: tvlv - basic infrastructure
batman-adv: tvlv - gateway download/upload bandwidth container
batman-adv: tvlv - add distributed arp table container
batman-adv: tvlv - add network coding container
batman-adv: tvlv - convert tt data sent within OGMs
batman-adv: tvlv - convert tt query packet to use tvlv unicast packets
batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets
Simon Wunderlich (5):
batman-adv: remove vis functionality
batman-adv: add build check macros for packet member offset
batman-adv: reorder packet types
batman-adv: remove packed from batadv_ogm_packet
batman-adv: reorder batadv_iv_flags
Documentation/ABI/testing/sysfs-class-net-mesh | 11 - Documentation/networking/batman-adv.txt | 50 +- MAINTAINERS | 4 +- net/batman-adv/Makefile | 1 - net/batman-adv/bat_iv_ogm.c | 111 +-- net/batman-adv/debugfs.c | 9 - net/batman-adv/distributed-arp-table.c | 64 ++ net/batman-adv/distributed-arp-table.h | 5 + net/batman-adv/gateway_client.c | 187 +++-- net/batman-adv/gateway_client.h | 2 +- net/batman-adv/gateway_common.c | 230 +++--- net/batman-adv/gateway_common.h | 14 +- net/batman-adv/hard-interface.c | 9 - net/batman-adv/main.c | 623 +++++++++++++++- net/batman-adv/main.h | 37 +- net/batman-adv/network-coding.c | 63 ++ net/batman-adv/network-coding.h | 5 + net/batman-adv/originator.c | 4 +- net/batman-adv/packet.h | 248 ++++--- net/batman-adv/routing.c | 247 ++----- net/batman-adv/routing.h | 6 +- net/batman-adv/send.c | 1 - net/batman-adv/soft-interface.c | 4 +- net/batman-adv/sysfs.c | 96 +-- net/batman-adv/translation-table.c | 905 ++++++++++++++---------- net/batman-adv/translation-table.h | 13 +- net/batman-adv/types.h | 178 ++--- net/batman-adv/vis.c | 938 ------------------------- net/batman-adv/vis.h | 36 - 29 files changed, 1968 insertions(+), 2133 deletions(-) delete mode 100644 net/batman-adv/vis.c delete mode 100644 net/batman-adv/vis.h
PATCH 1/16 MAINTAINERS: batman-adv - update emails
Update my and Marek Lindner's email in the MAINTAINERS file
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -1652,9 +1652,9 @@ F: drivers/video/backlight/ F: include/linux/backlight.h BATMAN ADVANCED -M: Marek Lindner <[email protected]> +M: Marek Lindner <[email protected]> M: Simon Wunderlich <[email protected]> -M: Antonio Quartulli <[email protected]> +M: Antonio Quartulli <[email protected]> L: [email protected] W: http://www.open-mesh.org/ S: Maintained
Signature · 1 line
1.8.3.2
PATCH 2/16 batman-adv: switch to a new packet compatibility version
In reply to Antonio QuartulliFrom: Antonio Quartulli <[email protected]>
With this change batman-adv is breaking compatibility with older versions and it is moving to compat-version 15.
--- net/batman-adv/packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/packet.h +1 -1
@@ -48,7 +48,7 @@ enum batadv_subtype { };/* this file is included by batctl which needs these defines */ -#define BATADV_COMPAT_VERSION 14 +#define BATADV_COMPAT_VERSION 15enum batadv_iv_flags {BATADV_NOT_BEST_NEXT_HOP =BIT (3 ),
Signature · 1 line
1.8.3.2
PATCH 3/16 batman-adv: tvlv - basic infrastructure
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
The goal is to provide the infrastructure for sending, receiving and parsing information 'containers' while preserving backward compatibility. TVLV (based on the commonly known Type Length Value technique) was chosen as the format for those containers. Even if a node does not know the tvlv type of a certain container it can simply skip the current container and proceed with the next. Past experience has shown features evolve over time, so a 'version' field was added right from the start to allow differentiating between feature variants - hence the name: T(ype) V(ersion) L(ength) V(alue).
This patch introduces the basic TVLV infrastructure:
* register / unregister tvlv containers to be sent with each OGM (on primary interfaces only)
* register / unregister callback handlers to be called upon finding the corresponding tvlv type in a tvlv buffer
* unicast tvlv send / receive API calls
--- net/batman-adv/bat_iv_ogm.c | 38 +-- net/batman-adv/main.c | 575 ++++++++++++++++++++++++++++++++++++++++++++ net/batman-adv/main.h | 35 +++ net/batman-adv/packet.h | 41 ++++ net/batman-adv/routing.c | 48 ++++ net/batman-adv/routing.h | 2 + net/batman-adv/types.h | 72 ++++++ 7 files changed, 794 insertions(+), 17 deletions(-)
net/batman-adv/bat_iv_ogm.c +21 -17
@@ -207,12 +207,12 @@ static uint8_t batadv_hop_penalty(uint8_t tq,/* is there another aggregated packet here? */ static int batadv_iv_ogm_aggr_packet (int buff_pos,int packet_len, -int tt_num_changes) +__be16 tvlv_len) {int next_buff_pos =0 ; next_buff_pos += buff_pos +BATADV_OGM_HLEN ; - next_buff_pos +=batadv_tt_len (tt_num_changes); + next_buff_pos +=ntohs (tvlv_len);return (next_buff_pos <= packet_len) && (next_buff_pos <=BATADV_MAX_AGGREGATION_BYTES );
@@ -240,7 +240,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet,/* adjust all flags and log packets */ while (batadv_iv_ogm_aggr_packet (buff_pos, forw_packet->packet_len, - batadv_ogm_packet->tt_num_changes)) { + batadv_ogm_packet->tvlv_len)) {/* we might have aggregated direct link packets with an * ordinary base packet */
@@ -267,7 +267,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet, hard_iface->net_dev->dev_addr); buff_pos +=BATADV_OGM_HLEN ; - buff_pos +=batadv_tt_len (batadv_ogm_packet->tt_num_changes); + buff_pos +=ntohs (batadv_ogm_packet->tvlv_len); packet_num++; packet_pos = forw_packet->skb->data + buff_pos; batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos;
@@ -601,7 +601,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, struct batadv_hard_iface *if_incoming) {struct batadv_priv *bat_priv =netdev_priv (if_incoming->soft_iface); -uint8_t tt_num_changes; +uint16_t tvlv_len;if (batadv_ogm_packet->header.ttl <=1 ) {batadv_dbg (BATADV_DBG_BATMAN , bat_priv,"ttl exceeded\n" );
@@ -621,7 +621,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node,return ; } - tt_num_changes = batadv_ogm_packet->tt_num_changes; + tvlv_len =ntohs (batadv_ogm_packet->tvlv_len); batadv_ogm_packet->header.ttl--;memcpy (batadv_ogm_packet->prev_sender, ethhdr->h_source,ETH_ALEN );
@@ -642,7 +642,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, batadv_ogm_packet->flags &= ~BATADV_DIRECTLINK ;batadv_iv_ogm_queue_add (bat_priv, (unsigned char *)batadv_ogm_packet, -BATADV_OGM_HLEN +batadv_tt_len (tt_num_changes), +BATADV_OGM_HLEN + tvlv_len, if_incoming,0 ,batadv_iv_ogm_fwd_send_time ()); }
@@ -691,16 +691,18 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)int vis_server, tt_num_changes =0 ;uint32_t seqno;uint8_t bandwidth; +uint16_t tvlv_len =0 ; vis_server =atomic_read (&bat_priv->vis_mode); primary_if =batadv_primary_if_get_selected (bat_priv);if (hard_iface == primary_if) - tt_num_changes =batadv_tt_append_diff (bat_priv, ogm_buff, - ogm_buff_len, -BATADV_OGM_HLEN ); + tvlv_len =batadv_tvlv_container_ogm_append (bat_priv, ogm_buff, + ogm_buff_len, +BATADV_OGM_HLEN ); batadv_ogm_packet = (struct batadv_ogm_packet *)(*ogm_buff); + batadv_ogm_packet->tvlv_len =htons (tvlv_len);/* change sequence number to network order */ seqno = (uint32_t )atomic_read (&hard_iface->bat_iv.ogm_seqno);
@@ -1254,6 +1256,8 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, goto out; } +batadv_tvlv_ogm_receive (bat_priv, batadv_ogm_packet, orig_node); +/* if sender is a direct neighbor the sender mac equals * originator mac */
@@ -1350,9 +1354,9 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,struct batadv_ogm_packet *batadv_ogm_packet;struct ethhdr *ethhdr;int buff_pos =0 , packet_len; -unsigned char *tt_buff, *packet_buff; +unsigned char *tvlv_buff, *packet_buff; +uint8_t *packet_pos;bool ret; -uint8_t *packet_pos; ret =batadv_check_management_packet (skb, if_incoming,BATADV_OGM_HLEN );if (!ret)
@@ -1375,14 +1379,14 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,/* unpack the aggregated packets and process them one by one */ while (batadv_iv_ogm_aggr_packet (buff_pos, packet_len, - batadv_ogm_packet->tt_num_changes)) { - tt_buff = packet_buff + buff_pos +BATADV_OGM_HLEN ; + batadv_ogm_packet->tvlv_len)) { + tvlv_buff = packet_buff + buff_pos +BATADV_OGM_HLEN ; -batadv_iv_ogm_process (ethhdr, batadv_ogm_packet, tt_buff, - if_incoming); +batadv_iv_ogm_process (ethhdr, batadv_ogm_packet, + tvlv_buff, if_incoming); buff_pos +=BATADV_OGM_HLEN ; - buff_pos +=batadv_tt_len (batadv_ogm_packet->tt_num_changes); + buff_pos +=ntohs (batadv_ogm_packet->tvlv_len); packet_pos = packet_buff + buff_pos; batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos;
net/batman-adv/main.c +575 -0
605 lines not on this page · raw message
net/batman-adv/main.h +35 -0
@@ -326,4 +326,39 @@ static inline uint64_t batadv_sum_counter(struct batadv_priv *bat_priv,*/ #define BATADV_SKB_CB (__skb) ((struct batadv_skb_cb *)&((__skb)->cb[0])) +void batadv_tvlv_container_register (struct batadv_priv *bat_priv, +uint8_t type,uint8_t version, +void *tvlv_value,uint16_t tvlv_value_len); +uint16_t batadv_tvlv_container_ogm_append (struct batadv_priv *bat_priv, +unsigned char **packet_buff, +int *packet_buff_len, +int packet_min_len); +void batadv_tvlv_ogm_receive (struct batadv_priv *bat_priv, +struct batadv_ogm_packet *batadv_ogm_packet, +struct batadv_orig_node *orig_node); +void batadv_tvlv_container_unregister (struct batadv_priv *bat_priv, +uint8_t type,uint8_t version); + +void batadv_tvlv_handler_register (struct batadv_priv *bat_priv, +void (*optr)(struct batadv_priv *bat_priv, +struct batadv_orig_node *orig, +uint8_t flags, +void *tvlv_value, +uint16_t tvlv_value_len), +int (*uptr)(struct batadv_priv *bat_priv, +uint8_t *src,uint8_t *dst, +void *tvlv_value, +uint16_t tvlv_value_len), +uint8_t type,uint8_t version,uint8_t flags); +void batadv_tvlv_handler_unregister (struct batadv_priv *bat_priv, +uint8_t type,uint8_t version); +int batadv_tvlv_containers_process (struct batadv_priv *bat_priv, +bool ogm_source, +struct batadv_orig_node *orig_node, +uint8_t *src,uint8_t *dst, +void *tvlv_buff,uint16_t tvlv_buff_len); +void batadv_tvlv_unicast_send (struct batadv_priv *bat_priv,uint8_t *src, +uint8_t *dst,uint8_t type,uint8_t version, +void *tvlv_value,uint16_t tvlv_value_len); +#endif /* _NET_BATMAN_ADV_MAIN_H_ */
net/batman-adv/packet.h +41 -0
69 lines not on this page · raw message
net/batman-adv/routing.c +48 -0
54 lines not on this page · raw message
net/batman-adv/routing.h +2 -0
@@ -40,6 +40,8 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if);int batadv_recv_roam_adv (struct sk_buff *skb,struct batadv_hard_iface *recv_if); +int batadv_recv_unicast_tvlv (struct sk_buff *skb, +struct batadv_hard_iface *recv_if);struct batadv_neigh_node * batadv_find_router(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node,
net/batman-adv/types.h +72 -0
94 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH 4/16 batman-adv: tvlv - gateway download/upload bandwidth container
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
Prior to this patch batman-adv read the advertised uplink bandwidth from userspace and compressed this information into a single byte called "gateway class".
Now the download & upload bandwidth information is sent as-is. No userspace change is necessary since the sysfs API always allowed to specify a bandwidth.
--- net/batman-adv/bat_iv_ogm.c | 23 +--- net/batman-adv/gateway_client.c | 197 +++++++++++++++++++++------------- net/batman-adv/gateway_client.h | 2 +- net/batman-adv/gateway_common.c | 230 +++++++++++++++++++++++++--------------- net/batman-adv/gateway_common.h | 14 ++- net/batman-adv/main.c | 5 + net/batman-adv/originator.c | 4 +- net/batman-adv/packet.h | 21 +++- net/batman-adv/soft-interface.c | 3 +- net/batman-adv/sysfs.c | 15 ++- net/batman-adv/types.h | 12 ++- 11 files changed, 331 insertions(+), 195 deletions(-)
net/batman-adv/bat_iv_ogm.c +1 -22
@@ -135,6 +135,7 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) batadv_ogm_packet->header.version =BATADV_COMPAT_VERSION ; batadv_ogm_packet->header.ttl =2 ; batadv_ogm_packet->flags =BATADV_NO_FLAGS ; + batadv_ogm_packet->reserved =0 ; batadv_ogm_packet->tq =BATADV_TQ_MAX_VALUE ; batadv_ogm_packet->tt_num_changes =0 ; batadv_ogm_packet->ttvn =0 ;
@@ -690,7 +691,6 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)int *ogm_buff_len = &hard_iface->bat_iv.ogm_buff_len;int vis_server, tt_num_changes =0 ;uint32_t seqno; -uint8_t bandwidth;uint16_t tvlv_len =0 ; vis_server =atomic_read (&bat_priv->vis_mode);
@@ -719,14 +719,6 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)else batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER ; -if (hard_iface == primary_if && -atomic_read (&bat_priv->gw_mode) ==BATADV_GW_MODE_SERVER ) { - bandwidth = (uint8_t )atomic_read (&bat_priv->gw_bandwidth); - batadv_ogm_packet->gw_flags = bandwidth; - }else { - batadv_ogm_packet->gw_flags =BATADV_NO_FLAGS ; - } -batadv_iv_ogm_slide_own_bcast_window (hard_iface); batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff, hard_iface->bat_iv.ogm_buff_len, hard_iface, 1,
@@ -861,19 +853,6 @@ update_tt: batadv_ogm_packet->tt_num_changes, batadv_ogm_packet->ttvn, ntohs(batadv_ogm_packet->tt_crc)); - -if (orig_node->gw_flags != batadv_ogm_packet->gw_flags) -batadv_gw_node_update (bat_priv, orig_node, - batadv_ogm_packet->gw_flags); - - orig_node->gw_flags = batadv_ogm_packet->gw_flags; - -/* restart gateway selection if fast or late switching was enabled */ -if ((orig_node->gw_flags) && - (atomic_read (&bat_priv->gw_mode) ==BATADV_GW_MODE_CLIENT ) && - (atomic_read (&bat_priv->gw_sel_class) >2 )) -batadv_gw_check_election (bat_priv, orig_node); - goto out; unlock:
net/batman-adv/gateway_client.c +126 -71
296 lines not on this page · raw message
net/batman-adv/gateway_client.h +1 -1
@@ -29,7 +29,7 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node);void batadv_gw_node_update (struct batadv_priv *bat_priv,struct batadv_orig_node *orig_node, -uint8_t new_gwflags); +struct batadv_tvlv_gateway_data *gateway);void batadv_gw_node_delete (struct batadv_priv *bat_priv,struct batadv_orig_node *orig_node);void batadv_gw_node_purge (struct batadv_priv *bat_priv);
net/batman-adv/gateway_common.c +147 -83
293 lines not on this page · raw message
net/batman-adv/gateway_common.h +13 -1
@@ -26,12 +26,24 @@ enum batadv_gw_modes { BATADV_GW_MODE_SERVER, }; +/** +* enum batadv_bandwidth_units - bandwidth unit types +* @BATADV_BW_UNIT_KBIT: unit type kbit +* @BATADV_BW_UNIT_MBIT: unit type mbit +*/ +enum batadv_bandwidth_units { +BATADV_BW_UNIT_KBIT , +BATADV_BW_UNIT_MBIT , +}; +#define BATADV_GW_MODE_OFF_NAME "off"#define BATADV_GW_MODE_CLIENT_NAME "client"#define BATADV_GW_MODE_SERVER_NAME "server" -void batadv_gw_bandwidth_to_kbit (uint8_t gw_class,int *down,int *up);ssize_t batadv_gw_bandwidth_set (struct net_device *net_dev,char *buff,size_t count); +void batadv_gw_tvlv_container_update (struct batadv_priv *bat_priv); +void batadv_gw_init (struct batadv_priv *bat_priv); +void batadv_gw_free (struct batadv_priv *bat_priv);#endif /* _NET_BATMAN_ADV_GATEWAY_COMMON_H_ */
net/batman-adv/main.c +5 -0
@@ -37,6 +37,7 @@#include "bridge_loop_avoidance.h" #include "distributed-arp-table.h" #include "unicast.h" +#include "gateway_common.h" #include "vis.h" #include "hash.h" #include "bat_algo.h"
@@ -152,6 +153,8 @@ int batadv_mesh_init(struct net_device *soft_iface)if (ret <0 ) goto err; +batadv_gw_init (bat_priv); +atomic_set (&bat_priv->gw.reselect,0 );atomic_set (&bat_priv->mesh_state,BATADV_MESH_ACTIVE );
@@ -190,6 +193,8 @@ void batadv_mesh_free(struct net_device *soft_iface)*/ batadv_originator_free (bat_priv); +batadv_gw_free (bat_priv); +free_percpu (bat_priv->bat_counters); bat_priv->bat_counters =NULL ;
net/batman-adv/originator.c +1 -3
@@ -388,9 +388,7 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv)hlist_for_each_entry_safe (orig_node, node_tmp, head, hash_entry) {if (batadv_purge_orig_node (bat_priv, orig_node)) { -if (orig_node->gw_flags) -batadv_gw_node_delete (bat_priv, - orig_node); +batadv_gw_node_delete (bat_priv, orig_node);hlist_del_rcu (&orig_node->hash_entry);batadv_orig_node_free_ref (orig_node);continue ;
net/batman-adv/packet.h +20 -1
@@ -118,6 +118,14 @@ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_REQUEST = 0x03, }; +/** +* enum batadv_tvlv_type - tvlv type definitions +* @BATADV_TVLV_GW: gateway tvlv +*/ +enum batadv_tvlv_type { +BATADV_TVLV_GW =0x01 , +}; +/* the destination hardware field in the ARP frame is used to * transport the claim type and the group id */
@@ -147,7 +155,7 @@ struct batadv_ogm_packet {__be32 seqno;uint8_t orig[ETH_ALEN ];uint8_t prev_sender[ETH_ALEN ]; -uint8_t gw_flags;/* flags related to gateway class */ +uint8_t reserved;uint8_t tq;uint8_t tt_num_changes;uint8_t ttvn;/* translation table version number */
@@ -352,4 +360,15 @@ struct batadv_tvlv_hdr { __be16 len; }; +/** +* struct batadv_tvlv_gateway_data - gateway data propagated through gw tvlv +* container +* @bandwidth_down: advertised uplink download bandwidth +* @bandwidth_up: advertised uplink upload bandwidth +*/ +struct batadv_tvlv_gateway_data { +__be32 bandwidth_down; +__be32 bandwidth_up; +}; +#endif /* _NET_BATMAN_ADV_PACKET_H_ */
net/batman-adv/soft-interface.c +2 -1
@@ -472,7 +472,8 @@ static int batadv_softif_init_late(struct net_device *dev)atomic_set (&bat_priv->vis_mode,BATADV_VIS_TYPE_CLIENT_UPDATE );atomic_set (&bat_priv->gw_mode,BATADV_GW_MODE_OFF );atomic_set (&bat_priv->gw_sel_class,20 ); -atomic_set (&bat_priv->gw_bandwidth,41 ); +atomic_set (&bat_priv->gw.bandwidth_down,100 ); +atomic_set (&bat_priv->gw.bandwidth_up,20 );atomic_set (&bat_priv->orig_interval,1000 );atomic_set (&bat_priv->hop_penalty,30 );#ifdef CONFIG_BATMAN_ADV_DEBUG
net/batman-adv/sysfs.c +7 -8
@@ -390,6 +390,7 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,*/ batadv_gw_check_client_stop (bat_priv);atomic_set (&bat_priv->gw_mode, (unsigned int )gw_mode_tmp); +batadv_gw_tvlv_container_update (bat_priv);return count; }
@@ -397,15 +398,13 @@ static ssize_t batadv_show_gw_bwidth(struct kobject *kobj, struct attribute *attr, char *buff) { struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj); -int down, up; -int gw_bandwidth =atomic_read (&bat_priv->gw_bandwidth); +uint32_t down, up; -batadv_gw_bandwidth_to_kbit (gw_bandwidth, &down, &up); -return sprintf (buff,"%i%s/%i%s\n" , - (down >2048 ? down /1024 : down), - (down >2048 ?"MBit" :"KBit" ), - (up >2048 ? up /1024 : up), - (up >2048 ?"MBit" :"KBit" )); + down =atomic_read (&bat_priv->gw.bandwidth_down); + up =atomic_read (&bat_priv->gw.bandwidth_up); + +return sprintf (buff,"%u.%u/%u.%u MBit\n" , down /10 , + down %10 , up /10 , up %10 ); } static ssize_t batadv_store_gw_bwidth(struct kobject *kobj,
net/batman-adv/types.h +8 -4
@@ -99,7 +99,6 @@ struct batadv_hard_iface {* @last_seen: time when last packet from this node was received * @bcast_seqno_reset: time when the broadcast seqno window was reset * @batman_seqno_reset: time when the batman seqno window was reset -* @gw_flags: flags related to gateway class * @flags: for now only VIS_SERVER flag * @last_ttvn: last seen translation table version number * @tt_crc: CRC of the translation table
@@ -147,7 +146,6 @@ struct batadv_orig_node {unsigned long last_seen;unsigned long bcast_seqno_reset;unsigned long batman_seqno_reset; -uint8_t gw_flags;uint8_t flags;atomic_t last_ttvn;uint16_t tt_crc;
@@ -189,6 +187,8 @@ struct batadv_orig_node {* struct batadv_gw_node - structure for orig nodes announcing gw capabilities * @list: list node for batadv_priv_gw::list * @orig_node: pointer to corresponding orig node +* @bandwidth_down: advertised uplink download bandwidth +* @bandwidth_up: advertised uplink upload bandwidth * @deleted: this struct is scheduled for deletion * @refcount: number of contexts the object is used * @rcu: struct used for freeing in an RCU-safe manner
@@ -196,6 +196,8 @@ struct batadv_orig_node {struct batadv_gw_node {struct hlist_node list;struct batadv_orig_node *orig_node; +uint32_t bandwidth_down; +uint32_t bandwidth_up;unsigned long deleted;atomic_t refcount;struct rcu_head rcu;
@@ -420,12 +422,16 @@ struct batadv_priv_debug_log {* @list: list of available gateway nodes * @list_lock: lock protecting gw_list & curr_gw * @curr_gw: pointer to currently selected gateway node +* @bandwidth_down: advertised uplink download bandwidth (if gw_mode server) +* @bandwidth_up: advertised uplink upload bandwidth (if gw_mode server) * @reselect: bool indicating a gateway re-selection is in progress */ struct batadv_priv_gw {struct hlist_head list;spinlock_t list_lock;/* protects gw_list & curr_gw */ struct batadv_gw_node __rcu *curr_gw;/* rcu protected pointer */ +atomic_t bandwidth_down; +atomic_t bandwidth_up;atomic_t reselect; };
@@ -521,7 +527,6 @@ struct batadv_priv_nc {* @vis_mode: vis operation: client or server (see batadv_vis_packettype) * @gw_mode: gateway operation: off, client or server (see batadv_gw_modes) * @gw_sel_class: gateway selection class (applies if gw_mode client) -* @gw_bandwidth: gateway announced bandwidth (applies if gw_mode server) * @orig_interval: OGM broadcast interval in milliseconds * @hop_penalty: penalty which will be applied to an OGM's tq-field on every hop * @log_level: configured log level (see batadv_dbg_level)
@@ -569,7 +574,6 @@ struct batadv_priv {atomic_t vis_mode;atomic_t gw_mode;atomic_t gw_sel_class; -atomic_t gw_bandwidth;atomic_t orig_interval;atomic_t hop_penalty;#ifdef CONFIG_BATMAN_ADV_DEBUG
Signature · 1 line
1.8.3.2
PATCH 5/16 batman-adv: tvlv - add distributed arp table container
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
Create DAT container to announce DAT capabilities (if enabled).
--- net/batman-adv/distributed-arp-table.c | 64 ++++++++++++++++++++++++++++++++++ net/batman-adv/distributed-arp-table.h | 5 +++ net/batman-adv/packet.h | 2 ++ net/batman-adv/sysfs.c | 3 +- net/batman-adv/types.h | 10 ++++++ 5 files changed, 83 insertions(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +64 -0
@@ -419,6 +419,10 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,bool ret = false;int j; +/* check if orig node candidate is running DAT */ +if (!(candidate->capabilities &BATADV_ORIG_CAPA_HAS_DAT )) + goto out; +/* Check if this node has already been selected... */ for (j =0 ; j < select; j++)if (res[j].orig_node == candidate)
@@ -626,6 +630,59 @@ out: }/** +* batadv_dat_tvlv_container_update - update the dat tvlv container after dat +* setting change +* @bat_priv: the bat priv with all the soft interface information +*/ +static void batadv_dat_tvlv_container_update (struct batadv_priv *bat_priv) +{ +char dat_mode; + + dat_mode =atomic_read (&bat_priv->distributed_arp_table); + +switch (dat_mode) { +case 0 : +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_DAT ,1 ); +break ; +case 1 : +batadv_tvlv_container_register (bat_priv,BATADV_TVLV_DAT ,1 , +NULL ,0 ); +break ; + } +} + +/** +* batadv_dat_status_update - update the dat tvlv container after dat +* setting change +* @net_dev: the soft interface net device +*/ +void batadv_dat_status_update (struct net_device *net_dev) +{ +struct batadv_priv *bat_priv =netdev_priv (net_dev); +batadv_dat_tvlv_container_update (bat_priv); +} + +/** +* batadv_gw_tvlv_ogm_handler_v1 - process incoming dat tvlv container +* @bat_priv: the bat priv with all the soft interface information +* @orig: the orig_node of the ogm +* @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) +* @tvlv_value: tvlv buffer containing the gateway data +* @tvlv_value_len: tvlv buffer length +*/ +static void batadv_dat_tvlv_ogm_handler_v1 (struct batadv_priv *bat_priv, +struct batadv_orig_node *orig, +uint8_t flags, +void *tvlv_value, +uint16_t tvlv_value_len) +{ +if (flags &BATADV_TVLV_HANDLER_OGM_CIFNOTFND ) + orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_DAT ; +else + orig->capabilities |=BATADV_ORIG_CAPA_HAS_DAT ; +} + +/** * batadv_dat_hash_free - free the local DAT hash table * @bat_priv: the bat priv with all the soft interface information */
@@ -657,6 +714,10 @@ int batadv_dat_init(struct batadv_priv *bat_priv)batadv_dat_start_timer (bat_priv); +batadv_tvlv_handler_register (bat_priv, batadv_dat_tvlv_ogm_handler_v1, +NULL ,BATADV_TVLV_DAT ,1 , +BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +batadv_dat_tvlv_container_update (bat_priv);return 0 ; }
@@ -666,6 +727,9 @@ int batadv_dat_init(struct batadv_priv *bat_priv)*/ void batadv_dat_free (struct batadv_priv *bat_priv) { +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_DAT ,1 ); +batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_DAT ,1 ); +cancel_delayed_work_sync (&bat_priv->dat.work);batadv_dat_hash_free (bat_priv);
net/batman-adv/distributed-arp-table.h +5 -0
@@ -29,6 +29,7 @@#define BATADV_DAT_ADDR_MAX ((batadv_dat_addr_t)~(batadv_dat_addr_t)0) +void batadv_dat_status_update (struct net_device *net_dev);bool batadv_dat_snoop_outgoing_arp_request (struct batadv_priv *bat_priv,struct sk_buff *skb); bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
@@ -98,6 +99,10 @@ static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv,#else +static inline void batadv_dat_status_update (struct net_device *net_dev) +{ +} +static inline bool batadv_dat_snoop_outgoing_arp_request (struct batadv_priv *bat_priv,struct sk_buff *skb)
net/batman-adv/packet.h +2 -0
@@ -121,9 +121,11 @@ enum batadv_bla_claimframe {/** * enum batadv_tvlv_type - tvlv type definitions * @BATADV_TVLV_GW: gateway tvlv +* @BATADV_TVLV_DAT: distributed arp table tvlv */ enum batadv_tvlv_type {BATADV_TVLV_GW =0x01 , +BATADV_TVLV_DAT =0x02 , };/* the destination hardware field in the ARP frame is used to
net/batman-adv/sysfs.c +2 -1
@@ -425,7 +425,8 @@ BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);BATADV_ATTR_SIF_BOOL (bridge_loop_avoidance,S_IRUGO |S_IWUSR ,NULL );#endif #ifdef CONFIG_BATMAN_ADV_DAT -BATADV_ATTR_SIF_BOOL (distributed_arp_table,S_IRUGO |S_IWUSR ,NULL ); +BATADV_ATTR_SIF_BOOL (distributed_arp_table,S_IRUGO |S_IWUSR , + batadv_dat_status_update);#endif BATADV_ATTR_SIF_BOOL (fragmentation,S_IRUGO |S_IWUSR , batadv_update_min_mtu);BATADV_ATTR_SIF_BOOL (ap_isolation,S_IRUGO |S_IWUSR ,NULL );
net/batman-adv/types.h +10 -0
@@ -100,6 +100,7 @@ struct batadv_hard_iface {* @bcast_seqno_reset: time when the broadcast seqno window was reset * @batman_seqno_reset: time when the batman seqno window was reset * @flags: for now only VIS_SERVER flag +* @capabilities: announced capabilities of this originator * @last_ttvn: last seen translation table version number * @tt_crc: CRC of the translation table * @tt_buff: last tt changeset this node received from the orig node
@@ -147,6 +148,7 @@ struct batadv_orig_node {unsigned long bcast_seqno_reset;unsigned long batman_seqno_reset;uint8_t flags; +uint8_t capabilities;atomic_t last_ttvn;uint16_t tt_crc;unsigned char *tt_buff;
@@ -184,6 +186,14 @@ struct batadv_orig_node { };/** +* enum batadv_orig_capabilities - orig node capabilities +* @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled +*/ +enum batadv_orig_capabilities { +BATADV_ORIG_CAPA_HAS_DAT =BIT (0 ), +}; + +/** * struct batadv_gw_node - structure for orig nodes announcing gw capabilities * @list: list node for batadv_priv_gw::list * @orig_node: pointer to corresponding orig node
Signature · 1 line
1.8.3.2
PATCH 6/16 batman-adv: tvlv - add network coding container
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
Create network coding container to announce network coding capabilities (if enabled).
--- net/batman-adv/network-coding.c | 63 +++++++++++++++++++++++++++++++++++++++++ net/batman-adv/network-coding.h | 5 ++++ net/batman-adv/packet.h | 2 ++ net/batman-adv/sysfs.c | 4 ++- net/batman-adv/types.h | 2 ++ 5 files changed, 75 insertions(+), 1 deletion(-)
net/batman-adv/network-coding.c +63 -0
@@ -59,6 +59,59 @@ static void batadv_nc_start_timer(struct batadv_priv *bat_priv) }/** +* batadv_nc_tvlv_container_update - update the network coding tvlv container +* after network coding setting change +* @bat_priv: the bat priv with all the soft interface information +*/ +static void batadv_nc_tvlv_container_update (struct batadv_priv *bat_priv) +{ +char nc_mode; + + nc_mode =atomic_read (&bat_priv->network_coding); + +switch (nc_mode) { +case 0 : +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_NC ,1 ); +break ; +case 1 : +batadv_tvlv_container_register (bat_priv,BATADV_TVLV_NC ,1 , +NULL ,0 ); +break ; + } +} + +/** +* batadv_nc_status_update - update the network coding tvlv container after +* network coding setting change +* @net_dev: the soft interface net device +*/ +void batadv_nc_status_update (struct net_device *net_dev) +{ +struct batadv_priv *bat_priv =netdev_priv (net_dev); +batadv_nc_tvlv_container_update (bat_priv); +} + +/** +* batadv_nc_tvlv_ogm_handler_v1 - process incoming nc tvlv container +* @bat_priv: the bat priv with all the soft interface information +* @orig: the orig_node of the ogm +* @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) +* @tvlv_value: tvlv buffer containing the gateway data +* @tvlv_value_len: tvlv buffer length +*/ +static void batadv_nc_tvlv_ogm_handler_v1 (struct batadv_priv *bat_priv, +struct batadv_orig_node *orig, +uint8_t flags, +void *tvlv_value, +uint16_t tvlv_value_len) +{ +if (flags &BATADV_TVLV_HANDLER_OGM_CIFNOTFND ) + orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_NC ; +else + orig->capabilities |=BATADV_ORIG_CAPA_HAS_NC ; +} + +/** * batadv_nc_mesh_init - initialise coding hash table and start house keeping * @bat_priv: the bat priv with all the soft interface information */
@@ -87,6 +140,10 @@ int batadv_nc_mesh_init(struct batadv_priv *bat_priv)INIT_DELAYED_WORK (&bat_priv->nc.work, batadv_nc_worker);batadv_nc_start_timer (bat_priv); +batadv_tvlv_handler_register (bat_priv, batadv_nc_tvlv_ogm_handler_v1, +NULL ,BATADV_TVLV_NC ,1 , +BATADV_TVLV_HANDLER_OGM_CIFNOTFND ); +batadv_nc_tvlv_container_update (bat_priv);return 0 ; err:
@@ -802,6 +859,10 @@ void batadv_nc_update_nc_node(struct batadv_priv *bat_priv,if (!atomic_read (&bat_priv->network_coding)) goto out; +/* check if orig node is network coding enabled */ +if (!(orig_node->capabilities &BATADV_ORIG_CAPA_HAS_NC )) + goto out; +/* accept ogms from 'good' neighbors and single hop neighbors */ if (!batadv_can_nc_with_orig (bat_priv, orig_node, ogm_packet) && !is_single_hop_neigh)
@@ -1735,6 +1796,8 @@ free_nc_packet:*/ void batadv_nc_mesh_free (struct batadv_priv *bat_priv) { +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_NC ,1 ); +batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_NC ,1 );cancel_delayed_work_sync (&bat_priv->nc.work);batadv_nc_purge_paths (bat_priv, bat_priv->nc.coding_hash,NULL );
net/batman-adv/network-coding.h +5 -0
@@ -22,6 +22,7 @@#ifdef CONFIG_BATMAN_ADV_NC +void batadv_nc_status_update (struct net_device *net_dev);int batadv_nc_init (void );int batadv_nc_mesh_init (struct batadv_priv *bat_priv);void batadv_nc_mesh_free (struct batadv_priv *bat_priv);
@@ -47,6 +48,10 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv);#else /* ifdef CONFIG_BATMAN_ADV_NC */ +static inline void batadv_nc_status_update (struct net_device *net_dev) +{ +} +static inline int batadv_nc_init (void ) {return 0 ;
net/batman-adv/packet.h +2 -0
@@ -122,10 +122,12 @@ enum batadv_bla_claimframe {* enum batadv_tvlv_type - tvlv type definitions * @BATADV_TVLV_GW: gateway tvlv * @BATADV_TVLV_DAT: distributed arp table tvlv +* @BATADV_TVLV_NC: network coding tvlv */ enum batadv_tvlv_type {BATADV_TVLV_GW =0x01 ,BATADV_TVLV_DAT =0x02 , +BATADV_TVLV_NC =0x03 , };/* the destination hardware field in the ARP frame is used to
net/batman-adv/sysfs.c +3 -1
@@ -21,6 +21,7 @@#include "sysfs.h" #include "translation-table.h" #include "distributed-arp-table.h" +#include "network-coding.h" #include "originator.h" #include "hard-interface.h" #include "gateway_common.h"
@@ -447,7 +448,8 @@ static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth,BATADV_ATTR_SIF_UINT (log_level,S_IRUGO |S_IWUSR ,0 ,BATADV_DBG_ALL ,NULL );#endif #ifdef CONFIG_BATMAN_ADV_NC -BATADV_ATTR_SIF_BOOL (network_coding,S_IRUGO |S_IWUSR ,NULL ); +BATADV_ATTR_SIF_BOOL (network_coding,S_IRUGO |S_IWUSR , + batadv_nc_status_update);#endif static struct batadv_attribute *batadv_mesh_attrs[] = {
net/batman-adv/types.h +2 -0
@@ -188,9 +188,11 @@ struct batadv_orig_node {/** * enum batadv_orig_capabilities - orig node capabilities * @BATADV_ORIG_CAPA_HAS_DAT: orig node has distributed arp table enabled +* @BATADV_ORIG_CAPA_HAS_NC: orig node has network coding enabled */ enum batadv_orig_capabilities {BATADV_ORIG_CAPA_HAS_DAT =BIT (0 ), +BATADV_ORIG_CAPA_HAS_NC =BIT (1 ), };/**
Signature · 1 line
1.8.3.2
PATCH 7/16 batman-adv: tvlv - convert tt data sent within OGMs
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
The translation table meta data (version number, crc checksum, etc) as well as the translation table diff propgated within OGMs now uses the newly introduced tvlv infrastructure.
--- net/batman-adv/bat_iv_ogm.c | 44 +++---- net/batman-adv/packet.h | 51 ++++++-- net/batman-adv/translation-table.c | 240 ++++++++++++++++++++----------------- net/batman-adv/translation-table.h | 8 +- net/batman-adv/types.h | 2 +- 5 files changed, 187 insertions(+), 158 deletions(-)
net/batman-adv/bat_iv_ogm.c +14 -30
@@ -137,8 +137,6 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) batadv_ogm_packet->flags =BATADV_NO_FLAGS ; batadv_ogm_packet->reserved =0 ; batadv_ogm_packet->tq =BATADV_TQ_MAX_VALUE ; - batadv_ogm_packet->tt_num_changes =0 ; - batadv_ogm_packet->ttvn =0 ; res =0 ;
@@ -257,14 +255,14 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet, fwd_str ="Sending own" ;batadv_dbg (BATADV_DBG_BATMAN , bat_priv, -"%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n" , +"%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s) on interface %s [%pM]\n" , fwd_str, (packet_num >0 ?"aggregated " :"" ), batadv_ogm_packet->orig,ntohl (batadv_ogm_packet->seqno), batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl, (batadv_ogm_packet->flags &BATADV_DIRECTLINK ?"on" :"off" ), - batadv_ogm_packet->ttvn, hard_iface->net_dev->name, + hard_iface->net_dev->name, hard_iface->net_dev->dev_addr); buff_pos +=BATADV_OGM_HLEN ;
@@ -689,17 +687,22 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)struct batadv_ogm_packet *batadv_ogm_packet;struct batadv_hard_iface *primary_if;int *ogm_buff_len = &hard_iface->bat_iv.ogm_buff_len; -int vis_server, tt_num_changes =0 ; +int vis_server;uint32_t seqno;uint16_t tvlv_len =0 ; vis_server =atomic_read (&bat_priv->vis_mode); primary_if =batadv_primary_if_get_selected (bat_priv); -if (hard_iface == primary_if) +if (hard_iface == primary_if) { +/* tt changes have to be committed before the tvlv data is +* appended as it may alter the tt tvlv container +*/ +batadv_tt_local_commit_changes (bat_priv); tvlv_len =batadv_tvlv_container_ogm_append (bat_priv, ogm_buff, ogm_buff_len,BATADV_OGM_HLEN ); + } batadv_ogm_packet = (struct batadv_ogm_packet *)(*ogm_buff); batadv_ogm_packet->tvlv_len =htons (tvlv_len);
@@ -709,11 +712,6 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) batadv_ogm_packet->seqno =htonl (seqno);atomic_inc (&hard_iface->bat_iv.ogm_seqno); - batadv_ogm_packet->ttvn =atomic_read (&bat_priv->tt.vn); - batadv_ogm_packet->tt_crc =htons (bat_priv->tt.local_crc); -if (tt_num_changes >=0 ) - batadv_ogm_packet->tt_num_changes = tt_num_changes; -if (vis_server ==BATADV_VIS_TYPE_SERVER_SYNC ) batadv_ogm_packet->flags |=BATADV_VIS_SERVER ;else
@@ -814,11 +812,11 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,*/ router =batadv_orig_node_get_router (orig_node);if (router == neigh_node) - goto update_tt; + goto out;/* if this neighbor does not offer a better TQ we won't consider it */ if (router && (router->tq_avg > neigh_node->tq_avg)) - goto update_tt; + goto out;/* if the TQ is the same and the link not more symmetric we * won't consider it either
@@ -837,22 +835,10 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,spin_unlock_bh (&orig_node_tmp->ogm_cnt_lock);if (sum_orig >= sum_neigh) - goto update_tt; + goto out; }batadv_update_route (bat_priv, orig_node, neigh_node); - -update_tt: -/* I have to check for transtable changes only if the OGM has been -* sent through a primary interface -*/ -if (((batadv_ogm_packet->orig != ethhdr->h_source) && - (batadv_ogm_packet->header.ttl >2 )) || - (batadv_ogm_packet->flags &BATADV_PRIMARIES_FIRST_HOP )) -batadv_tt_update_orig (bat_priv, orig_node, tt_buff, - batadv_ogm_packet->tt_num_changes, - batadv_ogm_packet->ttvn, -ntohs (batadv_ogm_packet->tt_crc)); goto out; unlock:
@@ -1103,13 +1089,11 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, is_single_hop_neigh = true;batadv_dbg (BATADV_DBG_BATMAN , bat_priv, -"Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %#.4x, changes %u, tq %d, TTL %d, V %d, IDF %d)\n" , +"Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, tq %d, TTL %d, V %d, IDF %d)\n" , ethhdr->h_source, if_incoming->net_dev->name, if_incoming->net_dev->dev_addr, batadv_ogm_packet->orig, batadv_ogm_packet->prev_sender, -ntohl (batadv_ogm_packet->seqno), batadv_ogm_packet->ttvn, -ntohs (batadv_ogm_packet->tt_crc), - batadv_ogm_packet->tt_num_changes, batadv_ogm_packet->tq, +ntohl (batadv_ogm_packet->seqno), batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl, batadv_ogm_packet->header.version, has_directlink_flag);
net/batman-adv/packet.h +41 -10
79 lines not on this page · raw message
net/batman-adv/translation-table.c +130 -110
329 lines not on this page · raw message
net/batman-adv/translation-table.h +1 -7
@@ -50,13 +50,7 @@ void batadv_handle_tt_response(struct batadv_priv *bat_priv, struct batadv_tt_query_packet *tt_response);bool batadv_is_ap_isolated (struct batadv_priv *bat_priv,uint8_t *src,uint8_t *dst); -void batadv_tt_update_orig (struct batadv_priv *bat_priv, -struct batadv_orig_node *orig_node, -const unsigned char *tt_buff,uint8_t tt_num_changes, -uint8_t ttvn,uint16_t tt_crc); -int batadv_tt_append_diff (struct batadv_priv *bat_priv, -unsigned char **packet_buff,int *packet_buff_len, -int packet_min_len); +void batadv_tt_local_commit_changes (struct batadv_priv *bat_priv);bool batadv_tt_global_client_is_roaming (struct batadv_priv *bat_priv,uint8_t *addr); bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
net/batman-adv/types.h +1 -1
@@ -772,7 +772,7 @@ struct batadv_tt_orig_list_entry {*/ struct batadv_tt_change_node {struct list_head list; -struct batadv_tt_change change; +struct batadv_tvlv_tt_change change; };/**
Signature · 1 line
1.8.3.2
PATCH 8/16 batman-adv: tvlv - convert tt query packet to use tvlv unicast packets
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
Instead of generating TT specific packets the TVLV unicast API is used to send translation table data.
--- net/batman-adv/main.c | 2 - net/batman-adv/packet.h | 33 --- net/batman-adv/routing.c | 78 ------ net/batman-adv/translation-table.c | 498 +++++++++++++++++++++---------------- net/batman-adv/translation-table.h | 5 - 5 files changed, 284 insertions(+), 332 deletions(-)
net/batman-adv/main.c +0 -2
@@ -414,8 +414,6 @@ static void batadv_recv_handler_init(void) batadv_rx_handler[BATADV_BCAST ] = batadv_recv_bcast_packet;/* vis packet */ batadv_rx_handler[BATADV_VIS ] = batadv_recv_vis_packet; -/* Translation table query (request or response) */ - batadv_rx_handler[BATADV_TT_QUERY ] = batadv_recv_tt_query;/* Roaming advertisement */ batadv_rx_handler[BATADV_ROAM_ADV ] = batadv_recv_roam_adv;/* unicast tvlv packet */
net/batman-adv/packet.h +0 -33
@@ -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
net/batman-adv/routing.c +0 -78
84 lines not on this page · raw message
net/batman-adv/translation-table.c +284 -214
777 lines not on this page · raw message
net/batman-adv/translation-table.h +0 -5
@@ -20,7 +20,6 @@#ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_#define _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ -int batadv_tt_len (int changes_num);int batadv_tt_init (struct batadv_priv *bat_priv);void batadv_tt_local_add (struct net_device *soft_iface,const uint8_t *addr,int ifindex);
@@ -43,11 +42,7 @@ struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,const uint8_t *src, const uint8_t *addr);void batadv_tt_free (struct batadv_priv *bat_priv); -bool batadv_send_tt_response (struct batadv_priv *bat_priv, -struct batadv_tt_query_packet *tt_request);bool batadv_is_my_client (struct batadv_priv *bat_priv,const uint8_t *addr); -void batadv_handle_tt_response (struct batadv_priv *bat_priv, -struct batadv_tt_query_packet *tt_response);bool batadv_is_ap_isolated (struct batadv_priv *bat_priv,uint8_t *src,uint8_t *dst);void batadv_tt_local_commit_changes (struct batadv_priv *bat_priv);
Signature · 1 line
1.8.3.2
PATCH 9/16 batman-adv: tvlv - convert roaming adv packet to use tvlv unicast packets
In reply to Antonio QuartulliFrom: Marek Lindner <[email protected]>
Instead of generating roaming specific packets the TVLV unicast API is used to send roaming information.
--- net/batman-adv/main.c | 2 - net/batman-adv/packet.h | 21 ++++---- net/batman-adv/routing.c | 42 --------------- net/batman-adv/translation-table.c | 104 ++++++++++++++++++++++++++----------- 4 files changed, 86 insertions(+), 83 deletions(-)
net/batman-adv/main.c +0 -2
@@ -414,8 +414,6 @@ static void batadv_recv_handler_init(void) batadv_rx_handler[BATADV_BCAST ] = batadv_recv_bcast_packet;/* vis packet */ batadv_rx_handler[BATADV_VIS ] = batadv_recv_vis_packet; -/* Roaming advertisement */ - batadv_rx_handler[BATADV_ROAM_ADV ] = batadv_recv_roam_adv;/* unicast tvlv packet */ batadv_rx_handler[BATADV_UNICAST_TVLV ] = batadv_recv_unicast_tvlv; }
net/batman-adv/packet.h +12 -9
@@ -31,7 +31,6 @@ enum batadv_packettype {BATADV_BCAST =0x04 ,BATADV_VIS =0x05 ,BATADV_UNICAST_FRAG =0x06 , -BATADV_ROAM_ADV =0x08 ,BATADV_UNICAST_4ADDR =0x09 ,BATADV_CODED =0x0a , BATADV_UNICAST_TVLV = 0x0b,
@@ -127,12 +126,14 @@ enum batadv_bla_claimframe {* @BATADV_TVLV_DAT: distributed arp table tvlv * @BATADV_TVLV_NC: network coding tvlv * @BATADV_TVLV_TT: translation table tvlv +* @BATADV_TVLV_ROAM: roaming advertisement tvlv */ enum batadv_tvlv_type {BATADV_TVLV_GW =0x01 ,BATADV_TVLV_DAT =0x02 ,BATADV_TVLV_NC =0x03 ,BATADV_TVLV_TT =0x04 , +BATADV_TVLV_ROAM =0x05 , };/* the destination hardware field in the ARP frame is used to
@@ -267,14 +268,6 @@ struct batadv_vis_packet {uint8_t sender_orig[ETH_ALEN ];/* who sent or forwarded this packet */ }; -struct batadv_roam_adv_packet { -struct batadv_header header; -uint8_t reserved; -uint8_t dst[ETH_ALEN ]; -uint8_t src[ETH_ALEN ]; -uint8_t client[ETH_ALEN ]; -} __packed; -/** * struct batadv_coded_packet - network coded packet * @header: common batman packet header and ttl of first included packet
@@ -373,4 +366,14 @@ struct batadv_tvlv_tt_change { uint8_t addr[ETH_ALEN]; }; +/** +* struct batadv_tvlv_roam_adv - roaming advertisement +* @client: mac address of roaming client +* @reserved: field reserved for future use +*/ +struct batadv_tvlv_roam_adv { +uint8_t client[ETH_ALEN ]; +uint16_t reserved; +}; +#endif /* _NET_BATMAN_ADV_PACKET_H_ */
net/batman-adv/routing.c +0 -42
48 lines not on this page · raw message
net/batman-adv/translation-table.c +74 -30
137 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH 10/16 batman-adv: use CRC32C instead of CRC16 in TT code
In reply to Antonio QuartulliFrom: Antonio Quartulli <[email protected]>
CRC32C has to be preferred to CRC16 because of its possible HW native support and because of the reduced collision probability. With this change the Translation Table component now uses CRC32C to compute the local and global table checksum.
--- net/batman-adv/packet.h | 6 ++-- net/batman-adv/translation-table.c | 73 ++++++++++++++++++++------------------ net/batman-adv/types.h | 4 +-- 3 files changed, 45 insertions(+), 38 deletions(-)
net/batman-adv/packet.h +4 -2
@@ -345,12 +345,14 @@ struct batadv_tvlv_gateway_data {* struct batadv_tvlv_tt_data - tt data propagated through the tt tvlv container * @flags: translation table flags (see batadv_tt_data_flags) * @ttvn: translation table version number -* @crc: crc16 checksum of the local translation table +* @reserved: field reserved for future use +* @crc: crc32 checksum of the local translation table */ struct batadv_tvlv_tt_data {uint8_t flags;uint8_t ttvn; -__be16 crc; +uint16_t reserved; +__be32 crc; };/**
net/batman-adv/translation-table.c +39 -34
184 lines not on this page · raw message
net/batman-adv/types.h +2 -2
@@ -150,7 +150,7 @@ struct batadv_orig_node {uint8_t flags;uint8_t capabilities;atomic_t last_ttvn; -uint16_t tt_crc; +uint32_t tt_crc;unsigned char *tt_buff;int16_t tt_buff_len;spinlock_t tt_buff_lock;/* protects tt_buff & tt_buff_len */
@@ -377,7 +377,7 @@ struct batadv_priv_tt {spinlock_t req_list_lock;/* protects req_list */ spinlock_t roam_list_lock;/* protects roam_list */ atomic_t local_entry_num; -uint16_t local_crc; +uint32_t local_crc;unsigned char *last_changeset;int16_t last_changeset_len;/* protects last_changeset & last_changeset_len */
Signature · 1 line
1.8.3.2
PATCH 11/16 batman-adv: move BATADV_TT_CLIENT_TEMP to higher bit
In reply to Antonio QuartulliFrom: Antonio Quartulli <[email protected]>
Client flags from bit 0 to 7 are sent over the wire. BATADV_TT_CLIENT_TEMP is a local flag and is not supposed to be sent to the network. Therefore it has occupy a higher bit.
--- net/batman-adv/packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/packet.h +1 -1
@@ -106,10 +106,10 @@ enum batadv_tt_client_flags {BATADV_TT_CLIENT_DEL =BIT (0 ),BATADV_TT_CLIENT_ROAM =BIT (1 ),BATADV_TT_CLIENT_WIFI =BIT (2 ), -BATADV_TT_CLIENT_TEMP =BIT (3 ),BATADV_TT_CLIENT_NOPURGE =BIT (8 ),BATADV_TT_CLIENT_NEW =BIT (9 ),BATADV_TT_CLIENT_PENDING =BIT (10 ), + BATADV_TT_CLIENT_TEMP = BIT(11), };/* claim frame types for the bridge loop avoidance */
Signature · 1 line
1.8.3.2
PATCH 12/16 batman-adv: remove vis functionality
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
This is replaced by a userspace program, we don't need this functionality to bloat the kernel.
--- Documentation/ABI/testing/sysfs-class-net-mesh | 11 - Documentation/networking/batman-adv.txt | 50 +- net/batman-adv/Makefile | 1 - net/batman-adv/bat_iv_ogm.c | 8 - net/batman-adv/debugfs.c | 9 - net/batman-adv/hard-interface.c | 9 - net/batman-adv/main.c | 11 - net/batman-adv/main.h | 2 - net/batman-adv/packet.h | 21 +- net/batman-adv/routing.c | 51 -- net/batman-adv/routing.h | 2 - net/batman-adv/send.c | 1 - net/batman-adv/soft-interface.c | 1 - net/batman-adv/sysfs.c | 72 -- net/batman-adv/types.h | 84 --- net/batman-adv/vis.c | 938 ------------------------- net/batman-adv/vis.h | 36 - 17 files changed, 3 insertions(+), 1304 deletions(-) delete mode 100644 net/batman-adv/vis.c delete mode 100644 net/batman-adv/vis.h
Documentation/ABI/testing/sysfs-class-net-mesh +0 -11
@@ -88,14 +88,3 @@ Contact: Marek Lindner <[email protected]> Description: Defines the routing procotol this mesh instance uses to find the optimal paths through the mesh. - -What: /sys/class/net/<mesh_iface>/mesh/vis_mode -Date: May 2010 -Contact: Marek Lindner <[email protected]> -Description: - Each batman node only maintains information about its - own local neighborhood, therefore generating graphs - showing the topology of the entire mesh is not easily - feasible without having a central instance to collect - the local topologies from all nodes. This file allows - to activate the collecting (server) mode.
Documentation/networking/batman-adv.txt +2 -48
68 lines not on this page · raw message
net/batman-adv/Makefile +0 -1
@@ -38,4 +38,3 @@ batman-adv-y += soft-interface.o batman-adv-y += sysfs.o batman-adv-y += translation-table.o batman-adv-y += unicast.o -batman-adv-y += vis.o
net/batman-adv/bat_iv_ogm.c +0 -8
@@ -687,11 +687,9 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)struct batadv_ogm_packet *batadv_ogm_packet;struct batadv_hard_iface *primary_if;int *ogm_buff_len = &hard_iface->bat_iv.ogm_buff_len; -int vis_server;uint32_t seqno;uint16_t tvlv_len =0 ; - vis_server =atomic_read (&bat_priv->vis_mode); primary_if =batadv_primary_if_get_selected (bat_priv);if (hard_iface == primary_if) {
@@ -712,11 +710,6 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) batadv_ogm_packet->seqno =htonl (seqno);atomic_inc (&hard_iface->bat_iv.ogm_seqno); -if (vis_server ==BATADV_VIS_TYPE_SERVER_SYNC ) - batadv_ogm_packet->flags |=BATADV_VIS_SERVER ; -else - batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER ; -batadv_iv_ogm_slide_own_bcast_window (hard_iface); batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff, hard_iface->bat_iv.ogm_buff_len, hard_iface, 1,
@@ -790,7 +783,6 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,rcu_read_unlock (); - orig_node->flags = batadv_ogm_packet->flags; neigh_node->last_seen = jiffies;spin_lock_bh (&neigh_node->lq_update_lock);
net/batman-adv/debugfs.c +0 -9
@@ -28,7 +28,6 @@#include "gateway_common.h" #include "gateway_client.h" #include "soft-interface.h" -#include "vis.h" #include "icmp_socket.h" #include "bridge_loop_avoidance.h" #include "distributed-arp-table.h"
@@ -300,12 +299,6 @@ static int batadv_transtable_local_open(struct inode *inode, struct file *file)return single_open (file, batadv_tt_local_seq_print_text, net_dev); } -static int batadv_vis_data_open (struct inode *inode,struct file *file) -{ -struct net_device *net_dev = (struct net_device *)inode->i_private; -return single_open (file, batadv_vis_seq_print_text, net_dev); -} -struct batadv_debuginfo {struct attribute attr;const struct file_operations fops;
@@ -356,7 +349,6 @@ static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open);#endif static BATADV_DEBUGINFO(transtable_local, S_IRUGO, batadv_transtable_local_open); -static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);#ifdef CONFIG_BATMAN_ADV_NC static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open);#endif
@@ -373,7 +365,6 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = { &batadv_debuginfo_dat_cache, #endif &batadv_debuginfo_transtable_local, - &batadv_debuginfo_vis_data, #ifdef CONFIG_BATMAN_ADV_NC &batadv_debuginfo_nc_nodes, #endif
net/batman-adv/hard-interface.c +0 -9
@@ -194,22 +194,13 @@ out:static void batadv_primary_if_update_addr (struct batadv_priv *bat_priv,struct batadv_hard_iface *oldif) { -struct batadv_vis_packet *vis_packet;struct batadv_hard_iface *primary_if; -struct sk_buff *skb; primary_if =batadv_primary_if_get_selected (bat_priv);if (!primary_if) goto out;batadv_dat_init_own_addr (bat_priv, primary_if); - - skb = bat_priv->vis.my_info->skb_packet; - vis_packet = (struct batadv_vis_packet *)skb->data; -memcpy (vis_packet->vis_orig, primary_if->net_dev->dev_addr,ETH_ALEN ); -memcpy (vis_packet->sender_orig, - primary_if->net_dev->dev_addr,ETH_ALEN ); -batadv_bla_update_orig_address (bat_priv, primary_if, oldif); out:if (primary_if)
net/batman-adv/main.c +0 -11
@@ -38,7 +38,6 @@#include "distributed-arp-table.h" #include "unicast.h" #include "gateway_common.h" -#include "vis.h" #include "hash.h" #include "bat_algo.h" #include "network-coding.h"
@@ -112,8 +111,6 @@ int batadv_mesh_init(struct net_device *soft_iface)spin_lock_init (&bat_priv->tt.roam_list_lock);spin_lock_init (&bat_priv->tt.last_changeset_lock);spin_lock_init (&bat_priv->gw.list_lock); -spin_lock_init (&bat_priv->vis.hash_lock); -spin_lock_init (&bat_priv->vis.list_lock);spin_lock_init (&bat_priv->tvlv.container_list_lock);spin_lock_init (&bat_priv->tvlv.handler_list_lock);
@@ -137,10 +134,6 @@ int batadv_mesh_init(struct net_device *soft_iface)batadv_tt_local_add (soft_iface, soft_iface->dev_addr,BATADV_NULL_IFINDEX ); - ret =batadv_vis_init (bat_priv); -if (ret <0 ) - goto err; - ret =batadv_bla_init (bat_priv);if (ret <0 ) goto err;
@@ -173,8 +166,6 @@ void batadv_mesh_free(struct net_device *soft_iface)batadv_purge_outstanding_packets (bat_priv,NULL ); -batadv_vis_quit (bat_priv); -batadv_gw_node_purge (bat_priv);batadv_nc_mesh_free (bat_priv);batadv_dat_free (bat_priv);
@@ -412,8 +403,6 @@ static void batadv_recv_handler_init(void) batadv_rx_handler[BATADV_UNICAST_FRAG ] = batadv_recv_ucast_frag_packet;/* broadcast packet */ batadv_rx_handler[BATADV_BCAST ] = batadv_recv_bcast_packet; -/* vis packet */ - batadv_rx_handler[BATADV_VIS ] = batadv_recv_vis_packet;/* unicast tvlv packet */ batadv_rx_handler[BATADV_UNICAST_TVLV ] = batadv_recv_unicast_tvlv; }
net/batman-adv/main.h +0 -2
@@ -86,8 +86,6 @@/* numbers of originator to contact for any PUT/GET DHT operation */ #define BATADV_DAT_CANDIDATES_NUM 3 -#define BATADV_VIS_INTERVAL 5000/* 5 seconds */ -/* how much worse secondary interfaces may be to be considered as bonding * candidates */
net/batman-adv/packet.h +1 -20
@@ -29,7 +29,6 @@ enum batadv_packettype {BATADV_ICMP =0x02 ,BATADV_UNICAST =0x03 ,BATADV_BCAST =0x04 , -BATADV_VIS =0x05 ,BATADV_UNICAST_FRAG =0x06 ,BATADV_UNICAST_4ADDR =0x09 , BATADV_CODED = 0x0a,
@@ -56,7 +55,6 @@ enum batadv_subtype {enum batadv_iv_flags {BATADV_NOT_BEST_NEXT_HOP =BIT (3 ),BATADV_PRIMARIES_FIRST_HOP =BIT (4 ), -BATADV_VIS_SERVER =BIT (5 ),BATADV_DIRECTLINK =BIT (6 ), };
@@ -69,12 +67,6 @@ enum batadv_icmp_packettype { BATADV_PARAMETER_PROBLEM = 12, }; -/* vis defines */ -enum batadv_vis_packettype { -BATADV_VIS_TYPE_SERVER_SYNC =0 , -BATADV_VIS_TYPE_CLIENT_UPDATE =1 , -}; -/* fragmentation defines */ enum batadv_unicast_frag_flags {BATADV_UNI_FRAG_HEAD =BIT (0 ),
@@ -161,7 +153,7 @@ struct batadv_header {*/ struct batadv_ogm_packet {struct batadv_header header; -uint8_t flags;/* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */ +uint8_t flags;/* 0x40: DIRECTLINK flag ... */ __be32 seqno;uint8_t orig[ETH_ALEN ];uint8_t prev_sender[ETH_ALEN ];
@@ -257,17 +249,6 @@ struct batadv_bcast_packet {#pragma pack() -struct batadv_vis_packet { -struct batadv_header header; -uint8_t vis_type;/* which type of vis-participant sent this? */ -__be32 seqno;/* sequence number */ -uint8_t entries;/* number of entries behind this struct */ -uint8_t reserved; -uint8_t vis_orig[ETH_ALEN ];/* originator reporting its neighbors */ -uint8_t target_orig[ETH_ALEN ];/* who should receive this packet */ -uint8_t sender_orig[ETH_ALEN ];/* who sent or forwarded this packet */ -}; -/** * struct batadv_coded_packet - network coded packet * @header: common batman packet header and ttl of first included packet
net/batman-adv/routing.c +0 -51
60 lines not on this page · raw message
net/batman-adv/routing.h +0 -2
@@ -34,8 +34,6 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb, struct batadv_hard_iface *recv_if);int batadv_recv_bcast_packet (struct sk_buff *skb,struct batadv_hard_iface *recv_if); -int batadv_recv_vis_packet (struct sk_buff *skb, -struct batadv_hard_iface *recv_if);int batadv_recv_tt_query (struct sk_buff *skb,struct batadv_hard_iface *recv_if); int batadv_recv_roam_adv(struct sk_buff *skb,
net/batman-adv/send.c +0 -1
@@ -24,7 +24,6 @@#include "translation-table.h" #include "soft-interface.h" #include "hard-interface.h" -#include "vis.h" #include "gateway_common.h" #include "originator.h" #include "network-coding.h"
net/batman-adv/soft-interface.c +0 -1
@@ -469,7 +469,6 @@ static int batadv_softif_init_late(struct net_device *dev)atomic_set (&bat_priv->distributed_arp_table,1 );#endif atomic_set (&bat_priv->ap_isolation,0 ); -atomic_set (&bat_priv->vis_mode,BATADV_VIS_TYPE_CLIENT_UPDATE );atomic_set (&bat_priv->gw_mode,BATADV_GW_MODE_OFF );atomic_set (&bat_priv->gw_sel_class,20 );atomic_set (&bat_priv->gw.bandwidth_down,100 );
net/batman-adv/sysfs.c +0 -72
96 lines not on this page · raw message
net/batman-adv/types.h +0 -84
132 lines not on this page · raw message
net/batman-adv/vis.c deleted +0 -938
938 lines not on this page · raw message
net/batman-adv/vis.h deleted +0 -36
@@ -1,36 +0,0 @@ -/* Copyright (C) 2008-2013 B.A.T.M.A.N. contributors: -* -* Simon Wunderlich, Marek Lindner -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of version 2 of the GNU General Public -* License as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -* 02110-1301, USA -*/ - -#ifndef _NET_BATMAN_ADV_VIS_H_ -#define _NET_BATMAN_ADV_VIS_H_ - -/* timeout of vis packets in milliseconds */ -#define BATADV_VIS_TIMEOUT 200000 - -int batadv_vis_seq_print_text (struct seq_file *seq,void *offset); -void batadv_receive_server_sync_packet (struct batadv_priv *bat_priv, -struct batadv_vis_packet *vis_packet, -int vis_info_len); -void batadv_receive_client_update_packet (struct batadv_priv *bat_priv, -struct batadv_vis_packet *vis_packet, -int vis_info_len); -int batadv_vis_init (struct batadv_priv *bat_priv); -void batadv_vis_quit (struct batadv_priv *bat_priv); - -#endif /* _NET_BATMAN_ADV_VIS_H_ */
Signature · 1 line
1.8.3.2
PATCH 13/16 batman-adv: add build check macros for packet member offset
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
Since we removed the __packed from most of the packets, we should make sure that the offset generated by the compiler are correct for sent/received data.
--- net/batman-adv/main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/batman-adv/main.c +8 -0
@@ -393,6 +393,14 @@ static void batadv_recv_handler_init(void)for (i =0 ; i <ARRAY_SIZE (batadv_rx_handler); i++) batadv_rx_handler[i] = batadv_recv_unhandled_packet; +/* compile time checks for struct member offsets */ +BUILD_BUG_ON (offsetof(struct batadv_unicast_4addr_packet , src) !=10 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_frag_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_tvlv_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet_rr , dst) !=4 ); +/* batman icmp packet */ batadv_rx_handler[BATADV_ICMP ] = batadv_recv_icmp_packet;/* unicast with 4 addresses packet */
Signature · 1 line
1.8.3.2
PATCH 14/16 batman-adv: reorder packet types
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
Reordering the packet type numbers allows us to handle unicast packets in a general way - even if we don't know the specific packet type, we can still forward it. There was already code handling this for a couple of unicast packets, and this is the more generalized version to do that.
--- net/batman-adv/main.c | 20 +++++++++++++++----- net/batman-adv/packet.h | 31 +++++++++++++++++++++++-------- net/batman-adv/routing.c | 28 ++++++++++++++++++++++++++++ net/batman-adv/routing.h | 2 ++ 4 files changed, 68 insertions(+), 13 deletions(-)
net/batman-adv/main.c +15 -5
@@ -393,6 +393,9 @@ static void batadv_recv_handler_init(void)for (i =0 ; i <ARRAY_SIZE (batadv_rx_handler); i++) batadv_rx_handler[i] = batadv_recv_unhandled_packet; +for (i =BATADV_UNICAST_MIN ; i <=BATADV_UNICAST_MAX ; i++) + batadv_rx_handler[i] = batadv_recv_unhandled_unicast_packet; +/* compile time checks for struct member offsets */ BUILD_BUG_ON (offsetof(struct batadv_unicast_4addr_packet , src) !=10 );BUILD_BUG_ON (offsetof(struct batadv_unicast_packet , dest) !=4 );
@@ -401,18 +404,20 @@ static void batadv_recv_handler_init(void)BUILD_BUG_ON (offsetof(struct batadv_icmp_packet , dst) !=4 );BUILD_BUG_ON (offsetof(struct batadv_icmp_packet_rr , dst) !=4 ); -/* batman icmp packet */ - batadv_rx_handler[BATADV_ICMP ] = batadv_recv_icmp_packet; +/* broadcast packet */ + batadv_rx_handler[BATADV_BCAST ] = batadv_recv_bcast_packet; + +/* unicast packets ... */ /* unicast with 4 addresses packet */ batadv_rx_handler[BATADV_UNICAST_4ADDR ] = batadv_recv_unicast_packet;/* unicast packet */ batadv_rx_handler[BATADV_UNICAST ] = batadv_recv_unicast_packet;/* fragmented unicast packet */ batadv_rx_handler[BATADV_UNICAST_FRAG ] = batadv_recv_ucast_frag_packet; -/* broadcast packet */ - batadv_rx_handler[BATADV_BCAST ] = batadv_recv_bcast_packet;/* unicast tvlv packet */ batadv_rx_handler[BATADV_UNICAST_TVLV ] = batadv_recv_unicast_tvlv; +/* batman icmp packet */ + batadv_rx_handler[BATADV_ICMP ] = batadv_recv_icmp_packet; }int
@@ -420,7 +425,12 @@ batadv_recv_handler_register(uint8_t packet_type,int (*recv_handler)(struct sk_buff *, struct batadv_hard_iface *)) { -if (batadv_rx_handler[packet_type] != &batadv_recv_unhandled_packet) +int (*curr)(struct sk_buff *, +struct batadv_hard_iface *); + curr = batadv_rx_handler[packet_type]; + +if ((curr != batadv_recv_unhandled_packet) && + (curr != batadv_recv_unhandled_unicast_packet))return -EBUSY ; batadv_rx_handler[packet_type] = recv_handler;
net/batman-adv/packet.h +23 -8
@@ -22,17 +22,32 @@/** * enum batadv_packettype - types for batman-adv encapsulated packets +* @BATADV_IV_OGM: originator messages for B.A.T.M.A.N. IV +* @BATADV_BCAST: broadcast packets carrying broadcast payload +* @BATADV_CODED: network coded packets +* +* @BATADV_UNICAST: unicast packets carrying unicast payload traffic +* @BATADV_UNICAST_FRAG: unicast packets carrying a fragment of the original +* payload packet +* @BATADV_UNICAST_4ADDR: unicast packet including the originator address of +* the sender +* @BATADV_ICMP: unicast packet like IP ICMP used for ping or traceroute * @BATADV_UNICAST_TVLV: unicast packet carrying TVLV containers */ enum batadv_packettype { -BATADV_IV_OGM =0x01 , -BATADV_ICMP =0x02 , -BATADV_UNICAST =0x03 , -BATADV_BCAST =0x04 , -BATADV_UNICAST_FRAG =0x06 , -BATADV_UNICAST_4ADDR =0x09 , -BATADV_CODED =0x0a , -BATADV_UNICAST_TVLV =0x0b , +/* 0x00 - 0x3f: local packets or special rules for handling */ +BATADV_IV_OGM =0x00 , +BATADV_BCAST =0x01 , +BATADV_CODED =0x02 , +/* 0x40 - 0x7f: unicast */ +#define BATADV_UNICAST_MIN 0x40 + BATADV_UNICAST = 0x40, +BATADV_UNICAST_FRAG =0x41 , +BATADV_UNICAST_4ADDR =0x42 , +BATADV_ICMP =0x43 , +BATADV_UNICAST_TVLV =0x44 , +#define BATADV_UNICAST_MAX 0x7f +/* 0x80 - 0xff: reserved */ };/**
net/batman-adv/routing.c +28 -0
@@ -911,6 +911,34 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,return 1 ; } +/** +* batadv_recv_unhandled_unicast_packet - receive and process packets which +* are in the unicast number space but not yet known to the implementation +* @skb: unicast tvlv packet to process +* @recv_if: pointer to interface this packet was received on +* +* Returns NET_RX_SUCCESS if the packet has been consumed or NET_RX_DROP +* otherwise. +*/ +int batadv_recv_unhandled_unicast_packet (struct sk_buff *skb, +struct batadv_hard_iface *recv_if) +{ +struct batadv_unicast_packet *unicast_packet; +struct batadv_priv *bat_priv =netdev_priv (recv_if->soft_iface); +int check, hdr_size =sizeof (*unicast_packet); + + check =batadv_check_unicast_packet (bat_priv, skb, hdr_size); +if (check <0 ) +return NET_RX_DROP ; + +/* we don't know about this type, drop it. */ + unicast_packet = (struct batadv_unicast_packet *)skb->data; +if (batadv_is_my_mac (bat_priv, unicast_packet->dest)) +return NET_RX_DROP ; + +return batadv_route_unicast_packet (skb, recv_if); +} +int batadv_recv_unicast_packet (struct sk_buff *skb,struct batadv_hard_iface *recv_if) {
net/batman-adv/routing.h +2 -0
@@ -40,6 +40,8 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if);int batadv_recv_unicast_tvlv (struct sk_buff *skb,struct batadv_hard_iface *recv_if); +int batadv_recv_unhandled_unicast_packet (struct sk_buff *skb, +struct batadv_hard_iface *recv_if);struct batadv_neigh_node * batadv_find_router(struct batadv_priv *bat_priv, struct batadv_orig_node *orig_node,
Signature · 1 line
1.8.3.2
PATCH 15/16 batman-adv: remove packed from batadv_ogm_packet
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
As we decreased the struct size from 26 to 24 byte, we can remove __packed as the compiler will not add any more padding.
--- net/batman-adv/packet.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/packet.h +4 -1
@@ -175,7 +175,10 @@ struct batadv_ogm_packet {uint8_t reserved;uint8_t tq;__be16 tvlv_len; -} __packed; +/* __packed is not needed as the struct size is divisible by 4, +* and the largest data type in this struct has a size of 4. +*/ +};#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
Signature · 1 line
1.8.3.2
PATCH 16/16 batman-adv: reorder batadv_iv_flags
In reply to Antonio QuartulliFrom: Simon Wunderlich <[email protected]>
The vis flag is not needed anymore, and since we do a compat bump we can start with the first bit again
--- net/batman-adv/packet.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/batman-adv/packet.h +14 -4
@@ -67,10 +67,19 @@ enum batadv_subtype {/* this file is included by batctl which needs these defines */ #define BATADV_COMPAT_VERSION 15 +/** +* enum batadv_iv_flags - flags used in B.A.T.M.A.N. IV OGM packets +* @BATADV_NOT_BEST_NEXT_HOP: flag is set when ogm packet is forwarded and was +* previously received from someone else than the best neighbor. +* @BATADV_PRIMARIES_FIRST_HOP: flag is set when the primary interface address +* is used, and the packet travels its first hop. +* @BATADV_DIRECTLINK: flag is for the first hop or if rebroadcasted from a +* one hop neighbor on the interface where it was originally received. +*/ enum batadv_iv_flags { -BATADV_NOT_BEST_NEXT_HOP =BIT (3 ), -BATADV_PRIMARIES_FIRST_HOP =BIT (4 ), -BATADV_DIRECTLINK =BIT (6 ), +BATADV_NOT_BEST_NEXT_HOP =BIT (0 ), +BATADV_PRIMARIES_FIRST_HOP =BIT (1 ), +BATADV_DIRECTLINK =BIT (2 ), };/* ICMP message types */
@@ -164,11 +173,12 @@ struct batadv_header {/** * struct batadv_ogm_packet - ogm (routing protocol) packet * @header: common batman packet header +* @flags: contains routing relevant flags - see enum batadv_iv_flags * @tvlv_len: length of tvlv data following the ogm header */ struct batadv_ogm_packet {struct batadv_header header; -uint8_t flags;/* 0x40: DIRECTLINK flag ... */ +uint8_t flags;__be32 seqno;uint8_t orig[ETH_ALEN ];uint8_t prev_sender[ETH_ALEN ];
Signature · 1 line
1.8.3.2
David Miller
maintainerFrom: Antonio Quartulli <[email protected]>
Date: Wed, 9 Oct 2013 21:32:38 +0200
Quoted 5 lines
here you have my fixed pull request intended for net-next.
The previous build error was due to an accidental remotion of the beginning of a
batadv_dbg()statement during a merge conflict resolution.
Sorry for that.
This looks better, pulled, thanks a lot.
Re: [PATCH 13/16] batman-adv: add build check macros for packet member offset
In reply to a message not in the archiveQuoted 3 lines
Since we removed the
__packedfrom most of the packets, we should make sure that the offset generated by the compiler are correct for sent/received data.
...
net/batman-adv/main.c static void batadv_recv_handler_init(void) · line 402
Quoted 7 lines
net/batman-adv/main.c +7
-0+/* compile time checks for struct member offsets */ +BUILD_BUG_ON (offsetof(struct batadv_unicast_4addr_packet , src) !=10 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_frag_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_tvlv_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet_rr , dst) !=4 );
It is usually enough to check the size of the structures. Which is also best done in the .h file so it is validated in all the compilation environments that might be used.
David
Re: [PATCH 13/16] batman-adv: add build check macros for packet member offset
In reply to a message not in the archiveQuoted 4 lines · David Laight
Quoted 3 lines
Since we removed the
__packedfrom most of the packets, we should make sure that the offset generated by the compiler are correct for sent/received data....
Quoted 9 lines
net/batman-adv/main.c static void batadv_recv_handler_init(void) · line 402
Quoted 7 lines
net/batman-adv/main.c +7
-0+/* compile time checks for struct member offsets */ +BUILD_BUG_ON (offsetof(struct batadv_unicast_4addr_packet , src) !=10 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_frag_packet , dest) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_unicast_tvlv_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet , dst) !=4 ); +BUILD_BUG_ON (offsetof(struct batadv_icmp_packet_rr , dst) !=4 );It is usually enough to check the size of the structures.
What if two fields are inverted by mistake in a way that the
size of the struct remains the same? The size check would not complain but the code would not work anymore.
We use a "generic" struct to access the initial part of any packet. Therefore these checks are to ensure that the information we are going to access is really placed at that offset, whatever packet we have.
It was not possible to use a common inner struct and so we relied on this test to be safe.
Quoted 3 lines
Which is also best done in the .h file so it is validated in all the compilation environments that might be used.
This does not really hurt at the moment because we placed them in main.c which is a file that is always compiled. But thanks for the suggestion: putting them in the .h file helps to remind the developer to add a new BUILD_ON_BUG when creating a new packet type.
Thanks a lot.
Regards,
Signature · 1 line
Antonio Quartulli
Quoted 10 lines · David Miller
From: Antonio Quartulli <[email protected]>
Date: Wed, 9 Oct 2013 21:32:38 +0200Quoted 5 lines
here you have my fixed pull request intended for net-next.
The previous build error was due to an accidental remotion of the beginning of a
batadv_dbg()statement during a merge conflict resolution.
Sorry for that.This looks better, pulled, thanks a lot.
Hello David,
I can't find my patchset in net-next, hasn't it been pushed yet?
Regards,
Signature · 1 line
Antonio Quartulli
From: Antonio Quartulli <[email protected]>
Date: Fri, 11 Oct 2013 08:10:53 +0200
Quoted 10 lines · David Miller
Quoted 9 lines
From: Antonio Quartulli <[email protected]>
Date: Wed, 9 Oct 2013 21:32:38 +0200Quoted 5 lines
here you have my fixed pull request intended for net-next.
The previous build error was due to an accidental remotion of the beginning of a
batadv_dbg()statement during a merge conflict resolution.
Sorry for that.
Quoted 5 lines
Quoted 1 line
This looks better, pulled, thanks a lot.
Hello David,
I can't find my patchset in net-next, hasn't it been pushed yet?
Sorry, it should be there now.