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

Commit b6da4bf5 authored by Marek Lindner's avatar Marek Lindner
Browse files

batman-adv: rename all instances of batman_packet to batman_ogm_packet



The follow-up routing code changes are going to introduce additional
routing packet types which make this distinction necessary.

Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
parent a943cac1
Loading
Loading
Loading
Loading
+26 −22
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@
#include "hard-interface.h"

/* return true if new_packet can be aggregated with forw_packet */
static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
static bool can_aggregate_with(const struct batman_ogm_packet
							*new_batman_ogm_packet,
			       struct bat_priv *bat_priv,
			       int packet_len,
			       unsigned long send_time,
@@ -35,8 +36,8 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
			       const struct hard_iface *if_incoming,
			       const struct forw_packet *forw_packet)
{
	struct batman_packet *batman_packet =
		(struct batman_packet *)forw_packet->skb->data;
	struct batman_ogm_packet *batman_ogm_packet =
			(struct batman_ogm_packet *)forw_packet->skb->data;
	int aggregated_bytes = forw_packet->packet_len + packet_len;
	struct hard_iface *primary_if = NULL;
	bool res = false;
@@ -71,8 +72,8 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
		/* packets without direct link flag and high TTL
		 * are flooded through the net  */
		if ((!directlink) &&
		    (!(batman_packet->flags & DIRECTLINK)) &&
		    (batman_packet->ttl != 1) &&
		    (!(batman_ogm_packet->flags & DIRECTLINK)) &&
		    (batman_ogm_packet->ttl != 1) &&

		    /* own packets originating non-primary
		     * interfaces leave only that interface */
@@ -85,13 +86,13 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
		/* if the incoming packet is sent via this one
		 * interface only - we still can aggregate */
		if ((directlink) &&
		    (new_batman_packet->ttl == 1) &&
		    (new_batman_ogm_packet->ttl == 1) &&
		    (forw_packet->if_incoming == if_incoming) &&

		    /* packets from direct neighbors or
		     * own secondary interface packets
		     * (= secondary interface packets in general) */
		    (batman_packet->flags & DIRECTLINK ||
		    (batman_ogm_packet->flags & DIRECTLINK ||
		     (forw_packet->own &&
		      forw_packet->if_incoming != primary_if))) {
			res = true;
@@ -213,9 +214,11 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
	 */
	struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL;
	struct hlist_node *tmp_node;
	struct batman_packet *batman_packet =
		(struct batman_packet *)packet_buff;
	bool direct_link = batman_packet->flags & DIRECTLINK ? 1 : 0;
	struct batman_ogm_packet *batman_ogm_packet;
	bool direct_link;

	batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
	direct_link = batman_ogm_packet->flags & DIRECTLINK ? 1 : 0;

	/* find position for the packet in the forward queue */
	spin_lock_bh(&bat_priv->forw_bat_list_lock);
@@ -223,7 +226,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
	if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) {
		hlist_for_each_entry(forw_packet_pos, tmp_node,
				     &bat_priv->forw_bat_list, list) {
			if (can_aggregate_with(batman_packet,
			if (can_aggregate_with(batman_ogm_packet,
					       bat_priv,
					       packet_len,
					       send_time,
@@ -267,27 +270,28 @@ void receive_aggr_bat_packet(const struct ethhdr *ethhdr,
			     unsigned char *packet_buff, int packet_len,
			     struct hard_iface *if_incoming)
{
	struct batman_packet *batman_packet;
	struct batman_ogm_packet *batman_ogm_packet;
	int buff_pos = 0;
	unsigned char *tt_buff;

	batman_packet = (struct batman_packet *)packet_buff;
	batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;

	do {
		/* 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);
		batman_ogm_packet->seqno = ntohl(batman_ogm_packet->seqno);
		batman_ogm_packet->tt_crc = ntohs(batman_ogm_packet->tt_crc);

		tt_buff = packet_buff + buff_pos + BAT_PACKET_LEN;
		tt_buff = packet_buff + buff_pos + BATMAN_OGM_LEN;

		receive_bat_packet(ethhdr, batman_packet, tt_buff, if_incoming);
		receive_bat_packet(ethhdr, batman_ogm_packet,
				   tt_buff, if_incoming);

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

		batman_packet = (struct batman_packet *)
		batman_ogm_packet = (struct batman_ogm_packet *)
						(packet_buff + buff_pos);
	} while (aggregated_packet(buff_pos, packet_len,
				   batman_packet->tt_num_changes));
				   batman_ogm_packet->tt_num_changes));
}
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
static inline int aggregated_packet(int buff_pos, int packet_len,
				    int tt_num_changes)
{
	int next_buff_pos = buff_pos + BAT_PACKET_LEN + tt_len(tt_num_changes);
	int next_buff_pos = buff_pos + BATMAN_OGM_LEN + tt_len(tt_num_changes);

	return (next_buff_pos <= packet_len) &&
		(next_buff_pos <= MAX_AGGREGATION_BYTES);
+27 −22
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
			      struct hard_iface *new_hard_iface)
{
	struct hard_iface *curr_hard_iface;
	struct batman_packet *batman_packet;
	struct batman_ogm_packet *batman_ogm_packet;

	ASSERT_RTNL();

@@ -147,9 +147,10 @@ static void primary_if_select(struct bat_priv *bat_priv,
	if (!new_hard_iface)
		return;

	batman_packet = (struct batman_packet *)(new_hard_iface->packet_buff);
	batman_packet->flags = PRIMARIES_FIRST_HOP;
	batman_packet->ttl = TTL;
	batman_ogm_packet = (struct batman_ogm_packet *)
						(new_hard_iface->packet_buff);
	batman_ogm_packet->flags = PRIMARIES_FIRST_HOP;
	batman_ogm_packet->ttl = TTL;

	primary_if_update_addr(bat_priv);
}
@@ -164,9 +165,12 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)

static void update_mac_addresses(struct hard_iface *hard_iface)
{
	memcpy(((struct batman_packet *)(hard_iface->packet_buff))->orig,
	struct batman_ogm_packet *batman_ogm_packet;

	batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
	memcpy(batman_ogm_packet->orig,
	       hard_iface->net_dev->dev_addr, ETH_ALEN);
	memcpy(((struct batman_packet *)(hard_iface->packet_buff))->prev_sender,
	memcpy(batman_ogm_packet->prev_sender,
	       hard_iface->net_dev->dev_addr, ETH_ALEN);
}

@@ -283,7 +287,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
			    const char *iface_name)
{
	struct bat_priv *bat_priv;
	struct batman_packet *batman_packet;
	struct batman_ogm_packet *batman_ogm_packet;
	struct net_device *soft_iface;
	int ret;

@@ -318,7 +322,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface,

	hard_iface->soft_iface = soft_iface;
	bat_priv = netdev_priv(hard_iface->soft_iface);
	hard_iface->packet_len = BAT_PACKET_LEN;
	hard_iface->packet_len = BATMAN_OGM_LEN;
	hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC);

	if (!hard_iface->packet_buff) {
@@ -328,14 +332,15 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
		goto err;
	}

	batman_packet = (struct batman_packet *)(hard_iface->packet_buff);
	batman_packet->packet_type = BAT_PACKET;
	batman_packet->version = COMPAT_VERSION;
	batman_packet->flags = NO_FLAGS;
	batman_packet->ttl = 2;
	batman_packet->tq = TQ_MAX_VALUE;
	batman_packet->tt_num_changes = 0;
	batman_packet->ttvn = 0;
	batman_ogm_packet = (struct batman_ogm_packet *)
						(hard_iface->packet_buff);
	batman_ogm_packet->packet_type = BAT_OGM;
	batman_ogm_packet->version = COMPAT_VERSION;
	batman_ogm_packet->flags = NO_FLAGS;
	batman_ogm_packet->ttl = 2;
	batman_ogm_packet->tq = TQ_MAX_VALUE;
	batman_ogm_packet->tt_num_changes = 0;
	batman_ogm_packet->ttvn = 0;

	hard_iface->if_num = bat_priv->num_ifaces;
	bat_priv->num_ifaces++;
@@ -580,7 +585,7 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
			   struct net_device *orig_dev)
{
	struct bat_priv *bat_priv;
	struct batman_packet *batman_packet;
	struct batman_ogm_packet *batman_ogm_packet;
	struct hard_iface *hard_iface;
	int ret;

@@ -612,21 +617,21 @@ static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
	if (hard_iface->if_status != IF_ACTIVE)
		goto err_free;

	batman_packet = (struct batman_packet *)skb->data;
	batman_ogm_packet = (struct batman_ogm_packet *)skb->data;

	if (batman_packet->version != COMPAT_VERSION) {
	if (batman_ogm_packet->version != COMPAT_VERSION) {
		bat_dbg(DBG_BATMAN, bat_priv,
			"Drop packet: incompatible batman version (%i)\n",
			batman_packet->version);
			batman_ogm_packet->version);
		goto err_free;
	}

	/* all receive handlers return whether they received or reused
	 * the supplied skb. if not, we have to free the skb. */

	switch (batman_packet->packet_type) {
	switch (batman_ogm_packet->packet_type) {
		/* batman originator packet */
	case BAT_PACKET:
	case BAT_OGM:
		ret = recv_bat_packet(skb, hard_iface);
		break;

+9 −9
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#define ETH_P_BATMAN  0x4305	/* unofficial/not registered Ethertype */

enum bat_packettype {
	BAT_PACKET       = 0x01,
	BAT_OGM		 = 0x01,
	BAT_ICMP	 = 0x02,
	BAT_UNICAST	 = 0x03,
	BAT_BCAST	 = 0x04,
@@ -90,7 +90,7 @@ enum tt_client_flags {
	TT_CLIENT_PENDING = 1 << 10
};

struct batman_packet {
struct batman_ogm_packet {
	uint8_t  packet_type;
	uint8_t  version;  /* batman version field */
	uint8_t  ttl;
@@ -105,7 +105,7 @@ struct batman_packet {
	uint16_t tt_crc;
} __packed;

#define BAT_PACKET_LEN sizeof(struct batman_packet)
#define BATMAN_OGM_LEN sizeof(struct batman_ogm_packet)

struct icmp_packet {
	uint8_t  packet_type;
+63 −55
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ void update_routes(struct bat_priv *bat_priv, struct orig_node *orig_node,

static int is_bidirectional_neigh(struct orig_node *orig_node,
				struct orig_node *orig_neigh_node,
				struct batman_packet *batman_packet,
				struct batman_ogm_packet *batman_ogm_packet,
				struct hard_iface *if_incoming)
{
	struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -209,7 +209,8 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
					 TQ_LOCAL_WINDOW_SIZE *
					 TQ_LOCAL_WINDOW_SIZE);

	batman_packet->tq = ((batman_packet->tq * tq_own * tq_asym_penalty) /
	batman_ogm_packet->tq = ((batman_ogm_packet->tq * tq_own
							* tq_asym_penalty) /
						(TQ_MAX_VALUE * TQ_MAX_VALUE));

	bat_dbg(DBG_BATMAN, bat_priv,
@@ -218,11 +219,11 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
		"real recv = %2i, local tq: %3i, asym_penalty: %3i, "
		"total tq: %3i\n",
		orig_node->orig, orig_neigh_node->orig, total_count,
		neigh_rq_count, tq_own,	tq_asym_penalty, batman_packet->tq);
		neigh_rq_count, tq_own,	tq_asym_penalty, batman_ogm_packet->tq);

	/* if link has the minimum required transmission quality
	 * consider it bidirectional */
	if (batman_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT)
	if (batman_ogm_packet->tq >= TQ_TOTAL_BIDRECT_LIMIT)
		ret = 1;

out:
@@ -321,9 +322,10 @@ static void bonding_candidate_add(struct orig_node *orig_node,
/* copy primary address for bonding */
static void bonding_save_primary(const struct orig_node *orig_node,
				 struct orig_node *orig_neigh_node,
				 const struct batman_packet *batman_packet)
				 const struct batman_ogm_packet
							*batman_ogm_packet)
{
	if (!(batman_packet->flags & PRIMARIES_FIRST_HOP))
	if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
		return;

	memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN);
@@ -331,7 +333,7 @@ static void bonding_save_primary(const struct orig_node *orig_node,

static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
			const struct ethhdr *ethhdr,
			const struct batman_packet *batman_packet,
			const struct batman_ogm_packet *batman_ogm_packet,
			struct hard_iface *if_incoming,
			const unsigned char *tt_buff, int is_duplicate)
{
@@ -386,19 +388,19 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,

	rcu_read_unlock();

	orig_node->flags = batman_packet->flags;
	orig_node->flags = batman_ogm_packet->flags;
	neigh_node->last_valid = jiffies;

	spin_lock_bh(&neigh_node->tq_lock);
	ring_buffer_set(neigh_node->tq_recv,
			&neigh_node->tq_index,
			batman_packet->tq);
			batman_ogm_packet->tq);
	neigh_node->tq_avg = ring_buffer_avg(neigh_node->tq_recv);
	spin_unlock_bh(&neigh_node->tq_lock);

	if (!is_duplicate) {
		orig_node->last_ttl = batman_packet->ttl;
		neigh_node->last_ttl = batman_packet->ttl;
		orig_node->last_ttl = batman_ogm_packet->ttl;
		neigh_node->last_ttl = batman_ogm_packet->ttl;
	}

	bonding_candidate_add(orig_node, neigh_node);
@@ -437,17 +439,19 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
update_tt:
	/* I have to check for transtable changes only if the OGM has been
	 * sent through a primary interface */
	if (((batman_packet->orig != ethhdr->h_source) &&
				(batman_packet->ttl > 2)) ||
				(batman_packet->flags & PRIMARIES_FIRST_HOP))
	if (((batman_ogm_packet->orig != ethhdr->h_source) &&
	     (batman_ogm_packet->ttl > 2)) ||
	    (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
		tt_update_orig(bat_priv, orig_node, tt_buff,
			       batman_packet->tt_num_changes,
			       batman_packet->ttvn, batman_packet->tt_crc);
			       batman_ogm_packet->tt_num_changes,
			       batman_ogm_packet->ttvn,
			       batman_ogm_packet->tt_crc);

	if (orig_node->gw_flags != batman_packet->gw_flags)
		gw_node_update(bat_priv, orig_node, batman_packet->gw_flags);
	if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
		gw_node_update(bat_priv, orig_node,
			       batman_ogm_packet->gw_flags);

	orig_node->gw_flags = batman_packet->gw_flags;
	orig_node->gw_flags = batman_ogm_packet->gw_flags;

	/* restart gateway selection if fast or late switching was enabled */
	if ((orig_node->gw_flags) &&
@@ -500,7 +504,7 @@ static int window_protected(struct bat_priv *bat_priv,
 *     was protected. Caller should drop it.
 */
static int count_real_packets(const struct ethhdr *ethhdr,
			       const struct batman_packet *batman_packet,
			      const struct batman_ogm_packet *batman_ogm_packet,
			      const struct hard_iface *if_incoming)
{
	struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -512,12 +516,12 @@ static int count_real_packets(const struct ethhdr *ethhdr,
	int need_update = 0;
	int set_mark, ret = -1;

	orig_node = get_orig_node(bat_priv, batman_packet->orig);
	orig_node = get_orig_node(bat_priv, batman_ogm_packet->orig);
	if (!orig_node)
		return 0;

	spin_lock_bh(&orig_node->ogm_cnt_lock);
	seq_diff = batman_packet->seqno - orig_node->last_real_seqno;
	seq_diff = batman_ogm_packet->seqno - orig_node->last_real_seqno;

	/* signalize caller that the packet is to be dropped. */
	if (window_protected(bat_priv, seq_diff,
@@ -530,7 +534,7 @@ static int count_real_packets(const struct ethhdr *ethhdr,

		is_duplicate |= get_bit_status(tmp_neigh_node->real_bits,
					       orig_node->last_real_seqno,
					       batman_packet->seqno);
					       batman_ogm_packet->seqno);

		if (compare_eth(tmp_neigh_node->addr, ethhdr->h_source) &&
		    (tmp_neigh_node->if_incoming == if_incoming))
@@ -551,8 +555,8 @@ static int count_real_packets(const struct ethhdr *ethhdr,
	if (need_update) {
		bat_dbg(DBG_BATMAN, bat_priv,
			"updating last_seqno: old %d, new %d\n",
			orig_node->last_real_seqno, batman_packet->seqno);
		orig_node->last_real_seqno = batman_packet->seqno;
			orig_node->last_real_seqno, batman_ogm_packet->seqno);
		orig_node->last_real_seqno = batman_ogm_packet->seqno;
	}

	ret = is_duplicate;
@@ -564,7 +568,7 @@ static int count_real_packets(const struct ethhdr *ethhdr,
}

void receive_bat_packet(const struct ethhdr *ethhdr,
			struct batman_packet *batman_packet,
			struct batman_ogm_packet *batman_ogm_packet,
			const unsigned char *tt_buff,
			struct hard_iface *if_incoming)
{
@@ -587,31 +591,31 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
	 * it as an additional length.
	 *
	 * TODO: A more sane solution would be to have a bit in the
	 * batman_packet to detect whether the packet is the last
	 * batman_ogm_packet to detect whether the packet is the last
	 * packet in an aggregation.  Here we expect that the padding
	 * is always zero (or not 0x01)
	 */
	if (batman_packet->packet_type != BAT_PACKET)
	if (batman_ogm_packet->packet_type != BAT_OGM)
		return;

	/* could be changed by schedule_own_packet() */
	if_incoming_seqno = atomic_read(&if_incoming->seqno);

	has_directlink_flag = (batman_packet->flags & DIRECTLINK ? 1 : 0);
	has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0);

	is_single_hop_neigh = (compare_eth(ethhdr->h_source,
					   batman_packet->orig) ? 1 : 0);
					   batman_ogm_packet->orig) ? 1 : 0);

	bat_dbg(DBG_BATMAN, bat_priv,
		"Received BATMAN packet via NB: %pM, IF: %s [%pM] "
		"(from OG: %pM, via prev OG: %pM, seqno %d, ttvn %u, "
		"crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
		ethhdr->h_source, if_incoming->net_dev->name,
		if_incoming->net_dev->dev_addr, batman_packet->orig,
		batman_packet->prev_sender, batman_packet->seqno,
		batman_packet->ttvn, batman_packet->tt_crc,
		batman_packet->tt_num_changes, batman_packet->tq,
		batman_packet->ttl, batman_packet->version,
		if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
		batman_ogm_packet->prev_sender, batman_ogm_packet->seqno,
		batman_ogm_packet->ttvn, batman_ogm_packet->tt_crc,
		batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq,
		batman_ogm_packet->ttl, batman_ogm_packet->version,
		has_directlink_flag);

	rcu_read_lock();
@@ -626,11 +630,11 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
				hard_iface->net_dev->dev_addr))
			is_my_addr = 1;

		if (compare_eth(batman_packet->orig,
		if (compare_eth(batman_ogm_packet->orig,
				hard_iface->net_dev->dev_addr))
			is_my_orig = 1;

		if (compare_eth(batman_packet->prev_sender,
		if (compare_eth(batman_ogm_packet->prev_sender,
				hard_iface->net_dev->dev_addr))
			is_my_oldorig = 1;

@@ -639,10 +643,10 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
	}
	rcu_read_unlock();

	if (batman_packet->version != COMPAT_VERSION) {
	if (batman_ogm_packet->version != COMPAT_VERSION) {
		bat_dbg(DBG_BATMAN, bat_priv,
			"Drop packet: incompatible batman version (%i)\n",
			batman_packet->version);
			batman_ogm_packet->version);
		return;
	}

@@ -674,13 +678,14 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
		/* save packet seqno for bidirectional check */
		if (has_directlink_flag &&
		    compare_eth(if_incoming->net_dev->dev_addr,
				batman_packet->orig)) {
				batman_ogm_packet->orig)) {
			offset = if_incoming->if_num * NUM_WORDS;

			spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
			word = &(orig_neigh_node->bcast_own[offset]);
			bit_mark(word,
				 if_incoming_seqno - batman_packet->seqno - 2);
				 if_incoming_seqno -
						batman_ogm_packet->seqno - 2);
			orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
				bit_packet_count(word);
			spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
@@ -699,11 +704,12 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
		return;
	}

	orig_node = get_orig_node(bat_priv, batman_packet->orig);
	orig_node = get_orig_node(bat_priv, batman_ogm_packet->orig);
	if (!orig_node)
		return;

	is_duplicate = count_real_packets(ethhdr, batman_packet, if_incoming);
	is_duplicate = count_real_packets(ethhdr, batman_ogm_packet,
					  if_incoming);

	if (is_duplicate == -1) {
		bat_dbg(DBG_BATMAN, bat_priv,
@@ -712,7 +718,7 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
		goto out;
	}

	if (batman_packet->tq == 0) {
	if (batman_ogm_packet->tq == 0) {
		bat_dbg(DBG_BATMAN, bat_priv,
			"Drop packet: originator packet with tq equal 0\n");
		goto out;
@@ -724,8 +730,9 @@ void receive_bat_packet(const struct ethhdr *ethhdr,

	/* avoid temporary routing loops */
	if (router && router_router &&
	    (compare_eth(router->addr, batman_packet->prev_sender)) &&
	    !(compare_eth(batman_packet->orig, batman_packet->prev_sender)) &&
	    (compare_eth(router->addr, batman_ogm_packet->prev_sender)) &&
	    !(compare_eth(batman_ogm_packet->orig,
			  batman_ogm_packet->prev_sender)) &&
	    (compare_eth(router->addr, router_router->addr))) {
		bat_dbg(DBG_BATMAN, bat_priv,
			"Drop packet: ignoring all rebroadcast packets that "
@@ -752,24 +759,25 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
	}

	is_bidirectional = is_bidirectional_neigh(orig_node, orig_neigh_node,
						batman_packet, if_incoming);
						  batman_ogm_packet,
						  if_incoming);

	bonding_save_primary(orig_node, orig_neigh_node, batman_packet);
	bonding_save_primary(orig_node, orig_neigh_node, batman_ogm_packet);

	/* update ranking if it is not a duplicate or has the same
	 * seqno and similar ttl as the non-duplicate */
	if (is_bidirectional &&
	    (!is_duplicate ||
	     ((orig_node->last_real_seqno == batman_packet->seqno) &&
	      (orig_node->last_ttl - 3 <= batman_packet->ttl))))
		update_orig(bat_priv, orig_node, ethhdr, batman_packet,
	     ((orig_node->last_real_seqno == batman_ogm_packet->seqno) &&
	      (orig_node->last_ttl - 3 <= batman_ogm_packet->ttl))))
		update_orig(bat_priv, orig_node, ethhdr, batman_ogm_packet,
			    if_incoming, tt_buff, is_duplicate);

	/* is single hop (direct) neighbor */
	if (is_single_hop_neigh) {

		/* mark direct link on incoming interface */
		schedule_forward_packet(orig_node, ethhdr, batman_packet,
		schedule_forward_packet(orig_node, ethhdr, batman_ogm_packet,
					1, if_incoming);

		bat_dbg(DBG_BATMAN, bat_priv, "Forwarding packet: "
@@ -792,7 +800,7 @@ void receive_bat_packet(const struct ethhdr *ethhdr,

	bat_dbg(DBG_BATMAN, bat_priv,
		"Forwarding packet: rebroadcast originator packet\n");
	schedule_forward_packet(orig_node, ethhdr, batman_packet,
	schedule_forward_packet(orig_node, ethhdr, batman_ogm_packet,
				0, if_incoming);

out_neigh:
@@ -814,7 +822,7 @@ int recv_bat_packet(struct sk_buff *skb, struct hard_iface *hard_iface)
	struct ethhdr *ethhdr;

	/* drop packet if it has not necessary minimum size */
	if (unlikely(!pskb_may_pull(skb, sizeof(struct batman_packet))))
	if (unlikely(!pskb_may_pull(skb, BATMAN_OGM_LEN)))
		return NET_RX_DROP;

	ethhdr = (struct ethhdr *)skb_mac_header(skb);
Loading