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

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

batman-adv: improved roaming mechanism



With the current client announcement implementation, in case of roaming,
an update is triggered on the new AP serving the client. At that point
the new information is spread around by means of the OGM broadcasting
mechanism. Until this operations is not executed, no node is able to
correctly route traffic towards the client. This obviously causes packet
drops and introduces a delay in the time needed by the client to recover
its connections.

A new packet type called ROAMING_ADVERTISEMENT is added to account this
issue.

This message is sent in case of roaming from the new AP serving the
client to the old one and will contain the client MAC address. In this
way an out-of-OGM update is immediately committed, so that the old node
can update its global translation table. Traffic reaching this node will
then be redirected to the correct destination utilising the fresher
information. Thus reducing the packet drops and the connection recovery
delay.

Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent a73105b8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -658,6 +658,10 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
	case BAT_TT_QUERY:
		ret = recv_tt_query(skb, hard_iface);
		break;
		/* Roaming advertisement */
	case BAT_ROAM_ADV:
		ret = recv_roam_adv(skb, hard_iface);
		break;
	default:
		ret = NET_RX_DROP;
	}
+2 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ int mesh_init(struct net_device *soft_iface)
	spin_lock_init(&bat_priv->tt_ghash_lock);
	spin_lock_init(&bat_priv->tt_changes_list_lock);
	spin_lock_init(&bat_priv->tt_req_list_lock);
	spin_lock_init(&bat_priv->tt_roam_list_lock);
	spin_lock_init(&bat_priv->tt_buff_lock);
	spin_lock_init(&bat_priv->gw_list_lock);
	spin_lock_init(&bat_priv->vis_hash_lock);
@@ -101,6 +102,7 @@ int mesh_init(struct net_device *soft_iface)
	INIT_HLIST_HEAD(&bat_priv->softif_neigh_vids);
	INIT_LIST_HEAD(&bat_priv->tt_changes_list);
	INIT_LIST_HEAD(&bat_priv->tt_req_list);
	INIT_LIST_HEAD(&bat_priv->tt_roam_list);

	if (originator_init(bat_priv) < 1)
		goto err;
+5 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
 * -> TODO: check influence on TQ_LOCAL_WINDOW_SIZE */
#define PURGE_TIMEOUT 200
#define TT_LOCAL_TIMEOUT 3600 /* in seconds */

#define TT_CLIENT_ROAM_TIMEOUT 600
/* sliding packet range of received originator messages in squence numbers
 * (should be a multiple of our word size) */
#define TQ_LOCAL_WINDOW_SIZE 64
@@ -55,6 +55,10 @@

#define TT_OGM_APPEND_MAX 3 /* number of OGMs sent with the last tt diff */

#define ROAMING_MAX_TIME 20 /* Time in which a client can roam at most
			     * ROAMING_MAX_COUNT times */
#define ROAMING_MAX_COUNT 5

#define NO_FLAGS 0

#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
+1 −0
Original line number Diff line number Diff line
@@ -219,6 +219,7 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr)
	/* extra reference for return */
	atomic_set(&orig_node->refcount, 2);

	orig_node->tt_poss_change = false;
	orig_node->bat_priv = bat_priv;
	memcpy(orig_node->orig, addr, ETH_ALEN);
	orig_node->router = NULL;
+12 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ enum bat_packettype {
	BAT_BCAST        = 0x04,
	BAT_VIS          = 0x05,
	BAT_UNICAST_FRAG = 0x06,
	BAT_TT_QUERY     = 0x07
	BAT_TT_QUERY     = 0x07,
	BAT_ROAM_ADV     = 0x08
};

/* this file is included by batctl which needs these defines */
@@ -194,6 +195,16 @@ struct tt_query_packet {
	uint16_t tt_data;
} __packed;

struct roam_adv_packet {
	uint8_t  packet_type;
	uint8_t  version;
	uint8_t  ttl;
	uint8_t  reserved;
	uint8_t  dst[ETH_ALEN];
	uint8_t  src[ETH_ALEN];
	uint8_t  client[ETH_ALEN];
} __packed;

struct tt_change {
	uint8_t flags;
	uint8_t addr[ETH_ALEN];
Loading