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

batman-adv: Prefix originator non-static functions with batadv_



batman-adv can be compiled as part of the kernel instead of an module. In that
case the linker will see all non-static symbols of batman-adv and all other
non-static symbols of the kernel. This could lead to symbol collisions. A
prefix for the batman-adv symbols that defines their private namespace avoids
such a problem.

Reported-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent 9039dc7e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static int bat_algorithms_open(struct inode *inode, struct file *file)
static int originators_open(struct inode *inode, struct file *file)
{
	struct net_device *net_dev = (struct net_device *)inode->i_private;
	return single_open(file, orig_seq_print_text, net_dev);
	return single_open(file, batadv_orig_seq_print_text, net_dev);
}

static int gateways_open(struct inode *inode, struct file *file)
+22 −21
Original line number Diff line number Diff line
@@ -633,7 +633,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
		    (tmp_neigh_node->if_incoming == if_incoming) &&
		     atomic_inc_not_zero(&tmp_neigh_node->refcount)) {
			if (neigh_node)
				neigh_node_free_ref(neigh_node);
				batadv_neigh_node_free_ref(neigh_node);
			neigh_node = tmp_neigh_node;
			continue;
		}
@@ -652,7 +652,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
	if (!neigh_node) {
		struct orig_node *orig_tmp;

		orig_tmp = get_orig_node(bat_priv, ethhdr->h_source);
		orig_tmp = batadv_get_orig_node(bat_priv, ethhdr->h_source);
		if (!orig_tmp)
			goto unlock;

@@ -660,7 +660,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,
						  orig_node, orig_tmp,
						  batman_ogm_packet->seqno);

		orig_node_free_ref(orig_tmp);
		batadv_orig_node_free_ref(orig_tmp);
		if (!neigh_node)
			goto unlock;
	} else
@@ -688,7 +688,7 @@ static void bat_iv_ogm_orig_update(struct bat_priv *bat_priv,

	/* if this neighbor already is our next hop there is nothing
	 * to change */
	router = orig_node_get_router(orig_node);
	router = batadv_orig_node_get_router(orig_node);
	if (router == neigh_node)
		goto update_tt;

@@ -746,9 +746,9 @@ unlock:
	rcu_read_unlock();
out:
	if (neigh_node)
		neigh_node_free_ref(neigh_node);
		batadv_neigh_node_free_ref(neigh_node);
	if (router)
		neigh_node_free_ref(router);
		batadv_neigh_node_free_ref(router);
}

static int bat_iv_ogm_calc_tq(struct orig_node *orig_node,
@@ -848,7 +848,7 @@ static int bat_iv_ogm_calc_tq(struct orig_node *orig_node,

out:
	if (neigh_node)
		neigh_node_free_ref(neigh_node);
		batadv_neigh_node_free_ref(neigh_node);
	return ret;
}

@@ -875,7 +875,7 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
	int set_mark, ret = -1;
	uint32_t seqno = ntohl(batman_ogm_packet->seqno);

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

@@ -924,7 +924,7 @@ static int bat_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,

out:
	spin_unlock_bh(&orig_node->ogm_cnt_lock);
	orig_node_free_ref(orig_node);
	batadv_orig_node_free_ref(orig_node);
	return ret;
}

@@ -1029,7 +1029,8 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
		unsigned long *word;
		int offset;

		orig_neigh_node = get_orig_node(bat_priv, ethhdr->h_source);
		orig_neigh_node = batadv_get_orig_node(bat_priv,
						       ethhdr->h_source);
		if (!orig_neigh_node)
			return;

@@ -1053,7 +1054,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,

		bat_dbg(DBG_BATMAN, bat_priv,
			"Drop packet: originator packet from myself (via neighbor)\n");
		orig_node_free_ref(orig_neigh_node);
		batadv_orig_node_free_ref(orig_neigh_node);
		return;
	}

@@ -1071,7 +1072,7 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
		return;
	}

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

@@ -1091,9 +1092,9 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
		goto out;
	}

	router = orig_node_get_router(orig_node);
	router = batadv_orig_node_get_router(orig_node);
	if (router)
		router_router = orig_node_get_router(router->orig_node);
		router_router = batadv_orig_node_get_router(router->orig_node);

	if ((router && router->tq_avg != 0) &&
	    (compare_eth(router->addr, ethhdr->h_source)))
@@ -1115,11 +1116,11 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,
	 * originator mac */
	orig_neigh_node = (is_single_hop_neigh ?
			   orig_node :
			   get_orig_node(bat_priv, ethhdr->h_source));
			   batadv_get_orig_node(bat_priv, ethhdr->h_source));
	if (!orig_neigh_node)
		goto out;

	orig_neigh_router = orig_node_get_router(orig_neigh_node);
	orig_neigh_router = batadv_orig_node_get_router(orig_neigh_node);

	/* drop packet if sender is not a direct neighbor and if we
	 * don't route towards it */
@@ -1178,16 +1179,16 @@ static void bat_iv_ogm_process(const struct ethhdr *ethhdr,

out_neigh:
	if ((orig_neigh_node) && (!is_single_hop_neigh))
		orig_node_free_ref(orig_neigh_node);
		batadv_orig_node_free_ref(orig_neigh_node);
out:
	if (router)
		neigh_node_free_ref(router);
		batadv_neigh_node_free_ref(router);
	if (router_router)
		neigh_node_free_ref(router_router);
		batadv_neigh_node_free_ref(router_router);
	if (orig_neigh_router)
		neigh_node_free_ref(orig_neigh_router);
		batadv_neigh_node_free_ref(orig_neigh_router);

	orig_node_free_ref(orig_node);
	batadv_orig_node_free_ref(orig_node);
}

static int bat_iv_ogm_receive(struct sk_buff *skb,
+2 −2
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ static struct backbone_gw *bla_get_backbone_gw(struct bat_priv *bat_priv,
	if (orig_node) {
		tt_global_del_orig(bat_priv, orig_node,
				   "became a backbone gateway");
		orig_node_free_ref(orig_node);
		batadv_orig_node_free_ref(orig_node);
	}
	return entry;
}
@@ -804,7 +804,7 @@ static int check_claim_group(struct bat_priv *bat_priv,
		bla_dst_own->group = bla_dst->group;
	}

	orig_node_free_ref(orig_node);
	batadv_orig_node_free_ref(orig_node);

	return 2;
}
+14 −14
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
			continue;

		orig_node = gw_node->orig_node;
		router = orig_node_get_router(orig_node);
		router = batadv_orig_node_get_router(orig_node);
		if (!router)
			continue;

@@ -177,7 +177,7 @@ static struct gw_node *gw_get_best_gw_node(struct bat_priv *bat_priv)
		gw_node_free_ref(gw_node);

next:
		neigh_node_free_ref(router);
		batadv_neigh_node_free_ref(router);
	}
	rcu_read_unlock();

@@ -212,7 +212,7 @@ void batadv_gw_election(struct bat_priv *bat_priv)
	if (next_gw) {
		sprintf(gw_addr, "%pM", next_gw->orig_node->orig);

		router = orig_node_get_router(next_gw->orig_node);
		router = batadv_orig_node_get_router(next_gw->orig_node);
		if (!router) {
			batadv_gw_deselect(bat_priv);
			goto out;
@@ -245,7 +245,7 @@ out:
	if (next_gw)
		gw_node_free_ref(next_gw);
	if (router)
		neigh_node_free_ref(router);
		batadv_neigh_node_free_ref(router);
}

void batadv_gw_check_election(struct bat_priv *bat_priv,
@@ -259,7 +259,7 @@ void batadv_gw_check_election(struct bat_priv *bat_priv,
	if (!curr_gw_orig)
		goto deselect;

	router_gw = orig_node_get_router(curr_gw_orig);
	router_gw = batadv_orig_node_get_router(curr_gw_orig);
	if (!router_gw)
		goto deselect;

@@ -267,7 +267,7 @@ void batadv_gw_check_election(struct bat_priv *bat_priv,
	if (curr_gw_orig == orig_node)
		goto out;

	router_orig = orig_node_get_router(orig_node);
	router_orig = batadv_orig_node_get_router(orig_node);
	if (!router_orig)
		goto out;

@@ -294,11 +294,11 @@ deselect:
	batadv_gw_deselect(bat_priv);
out:
	if (curr_gw_orig)
		orig_node_free_ref(curr_gw_orig);
		batadv_orig_node_free_ref(curr_gw_orig);
	if (router_gw)
		neigh_node_free_ref(router_gw);
		batadv_neigh_node_free_ref(router_gw);
	if (router_orig)
		neigh_node_free_ref(router_orig);
		batadv_neigh_node_free_ref(router_orig);

	return;
}
@@ -438,7 +438,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,

	batadv_gw_bandwidth_to_kbit(gw_node->orig_node->gw_flags, &down, &up);

	router = orig_node_get_router(gw_node->orig_node);
	router = batadv_orig_node_get_router(gw_node->orig_node);
	if (!router)
		goto out;

@@ -455,7 +455,7 @@ static int _write_buffer_text(struct bat_priv *bat_priv, struct seq_file *seq,
			 (up > 2048 ? up / 1024 : up),
			 (up > 2048 ? "MBit" : "KBit"));

	neigh_node_free_ref(router);
	batadv_neigh_node_free_ref(router);
	if (curr_gw)
		gw_node_free_ref(curr_gw);
out:
@@ -702,12 +702,12 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,

out:
	if (orig_dst_node)
		orig_node_free_ref(orig_dst_node);
		batadv_orig_node_free_ref(orig_dst_node);
	if (curr_gw)
		gw_node_free_ref(curr_gw);
	if (neigh_old)
		neigh_node_free_ref(neigh_old);
		batadv_neigh_node_free_ref(neigh_old);
	if (neigh_curr)
		neigh_node_free_ref(neigh_curr);
		batadv_neigh_node_free_ref(neigh_curr);
	return out_of_range;
}
+3 −3
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
	hard_iface->if_num = bat_priv->num_ifaces;
	bat_priv->num_ifaces++;
	hard_iface->if_status = IF_INACTIVE;
	orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
	batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);

	hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN);
	hard_iface->batman_adv_ptype.func = batman_skb_recv;
@@ -373,7 +373,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
	dev_remove_pack(&hard_iface->batman_adv_ptype);

	bat_priv->num_ifaces--;
	orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
	batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);

	primary_if = primary_if_get_selected(bat_priv);
	if (hard_iface == primary_if) {
@@ -390,7 +390,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
	hard_iface->if_status = IF_NOT_IN_USE;

	/* delete all references to this hard_iface */
	purge_orig_ref(bat_priv);
	batadv_purge_orig_ref(bat_priv);
	purge_outstanding_packets(bat_priv, hard_iface);
	dev_put(hard_iface->soft_iface);

Loading