Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a73105b8 authored by Antonio Quartulli's avatar Antonio Quartulli Committed by Sven Eckelmann
Browse files

batman-adv: improved client announcement mechanism



The client announcement mechanism informs every mesh node in the network
of any connected non-mesh client, in order to find the path towards that
client from any given point in the mesh.

The old implementation was based on the simple idea of appending a data
buffer to each OGM containing all the client MAC addresses the node is
serving. All other nodes can populate their global translation tables
(table which links client MAC addresses to node addresses) using this
MAC address buffer and linking it to the node's address contained in the
OGM. A node that wants to contact a client has to lookup the node the
client is connected to and its address in the global translation table.

It is easy to understand that this implementation suffers from several
issues:
 - big overhead (each and every OGM contains the entire list of
   connected clients)
 - high latencies for client route updates due to long OGM trip time and
   OGM losses

The new implementation addresses these issues by appending client
changes (new client joined or a client left) to the OGM instead of
filling it with all the client addresses each time. In this way nodes
can modify their global tables by means of "updates", thus reducing the
overhead within the OGMs.

To keep the entire network in sync each node maintains a translation
table version number (ttvn) and a translation table checksum. These
values are spread with the OGM to allow all the network participants to
determine whether or not they need to update their translation table
information.

When a translation table lookup is performed in order to send a packet
to a client attached to another node, the destination's ttvn is added to
the payload packet. Forwarding nodes can compare the packet's ttvn with
their destination's ttvn (this node could have a fresher information
than the source) and re-route the packet if necessary. This greatly
reduces the packet loss of clients roaming from one AP to the next.

Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent 3b27ffb0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
config BATMAN_ADV
	tristate "B.A.T.M.A.N. Advanced Meshing Protocol"
	depends on NET
	select CRC16
        default n
	---help---

+10 −13
Original line number Diff line number Diff line
@@ -20,17 +20,12 @@
 */

#include "main.h"
#include "translation-table.h"
#include "aggregation.h"
#include "send.h"
#include "routing.h"
#include "hard-interface.h"

/* calculate the size of the tt information for a given packet */
static int tt_len(const struct batman_packet *batman_packet)
{
	return batman_packet->num_tt * ETH_ALEN;
}

/* return true if new_packet can be aggregated with forw_packet */
static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
			       int packet_len,
@@ -264,18 +259,20 @@ void receive_aggr_bat_packet(const struct ethhdr *ethhdr,
	batman_packet = (struct batman_packet *)packet_buff;

	do {
		/* network to host order for our 32bit seqno, and the
		   orig_interval. */
		/* network to host order for our 32bit seqno and the
		   orig_interval */
		batman_packet->seqno = ntohl(batman_packet->seqno);
		batman_packet->tt_crc = ntohs(batman_packet->tt_crc);

		tt_buff = packet_buff + buff_pos + BAT_PACKET_LEN;
		receive_bat_packet(ethhdr, batman_packet,
				   tt_buff, tt_len(batman_packet),
				   if_incoming);

		buff_pos += BAT_PACKET_LEN + tt_len(batman_packet);
		receive_bat_packet(ethhdr, batman_packet, tt_buff, if_incoming);

		buff_pos += BAT_PACKET_LEN +
			tt_len(batman_packet->tt_num_changes);

		batman_packet = (struct batman_packet *)
			(packet_buff + buff_pos);
	} while (aggregated_packet(buff_pos, packet_len,
				   batman_packet->num_tt));
				   batman_packet->tt_num_changes));
}
+4 −2
Original line number Diff line number Diff line
@@ -25,9 +25,11 @@
#include "main.h"

/* is there another aggregated packet here? */
static inline int aggregated_packet(int buff_pos, int packet_len, int num_tt)
static inline int aggregated_packet(int buff_pos, int packet_len,
				    int tt_num_changes)
{
	int next_buff_pos = buff_pos + BAT_PACKET_LEN + (num_tt * ETH_ALEN);
	int next_buff_pos = buff_pos + BAT_PACKET_LEN + (tt_num_changes *
						sizeof(struct tt_change));

	return (next_buff_pos <= packet_len) &&
		(next_buff_pos <= MAX_AGGREGATION_BYTES);
+1 −1
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ BAT_ATTR_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE,
static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth,
		store_gw_bwidth);
#ifdef CONFIG_BATMAN_ADV_DEBUG
BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 3, NULL);
BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 7, NULL);
#endif

static struct bat_attribute *mesh_attrs[] = {
+6 −7
Original line number Diff line number Diff line
@@ -152,12 +152,6 @@ static void primary_if_select(struct bat_priv *bat_priv,
	batman_packet->ttl = TTL;

	primary_if_update_addr(bat_priv);

	/***
	 * hacky trick to make sure that we send the TT information via
	 * our new primary interface
	 */
	atomic_set(&bat_priv->tt_local_changed, 1);
}

static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
@@ -340,7 +334,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
	batman_packet->flags = NO_FLAGS;
	batman_packet->ttl = 2;
	batman_packet->tq = TQ_MAX_VALUE;
	batman_packet->num_tt = 0;
	batman_packet->tt_num_changes = 0;
	batman_packet->ttvn = 0;

	hard_iface->if_num = bat_priv->num_ifaces;
	bat_priv->num_ifaces++;
@@ -659,6 +654,10 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
	case BAT_VIS:
		ret = recv_vis_packet(skb, hard_iface);
		break;
		/* Translation table query (request or response) */
	case BAT_TT_QUERY:
		ret = recv_tt_query(skb, hard_iface);
		break;
	default:
		ret = NET_RX_DROP;
	}
Loading