提交 6a020ab4 编写于 作者: M Marek Lindner

batman-adv: broadcast primary OGM on all active hard-interfaces

The primary interface OGM has to be broadcasted on all hard-interfaces
even if the primary interface is not the first interface (if_num = 0).
Therefore the code has to compare the originating interface with the
primary interface instead of checking the if_num.
Reported-by: NLinus Luessing <linus.luessing@web.de>
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
上级 ff66c975
...@@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet)
struct hard_iface *hard_iface; struct hard_iface *hard_iface;
struct net_device *soft_iface; struct net_device *soft_iface;
struct bat_priv *bat_priv; struct bat_priv *bat_priv;
struct hard_iface *primary_if = NULL;
struct batman_packet *batman_packet = struct batman_packet *batman_packet =
(struct batman_packet *)(forw_packet->skb->data); (struct batman_packet *)(forw_packet->skb->data);
int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
...@@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet)
if (!forw_packet->if_incoming) { if (!forw_packet->if_incoming) {
pr_err("Error - can't forward packet: incoming iface not " pr_err("Error - can't forward packet: incoming iface not "
"specified\n"); "specified\n");
return; goto out;
} }
soft_iface = forw_packet->if_incoming->soft_iface; soft_iface = forw_packet->if_incoming->soft_iface;
bat_priv = netdev_priv(soft_iface); bat_priv = netdev_priv(soft_iface);
if (forw_packet->if_incoming->if_status != IF_ACTIVE) if (forw_packet->if_incoming->if_status != IF_ACTIVE)
return; goto out;
primary_if = primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
/* multihomed peer assumed */ /* multihomed peer assumed */
/* non-primary OGMs are only broadcasted on their interface */ /* non-primary OGMs are only broadcasted on their interface */
if ((directlink && (batman_packet->ttl == 1)) || if ((directlink && (batman_packet->ttl == 1)) ||
(forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { (forw_packet->own && (forw_packet->if_incoming != primary_if))) {
/* FIXME: what about aggregated packets ? */ /* FIXME: what about aggregated packets ? */
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
...@@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet)
broadcast_addr); broadcast_addr);
forw_packet->skb = NULL; forw_packet->skb = NULL;
return; goto out;
} }
/* broadcast on every interface */ /* broadcast on every interface */
...@@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet) ...@@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet)
send_packet_to_if(forw_packet, hard_iface); send_packet_to_if(forw_packet, hard_iface);
} }
rcu_read_unlock(); rcu_read_unlock();
out:
if (primary_if)
hardif_free_ref(primary_if);
} }
static void realloc_packet_buffer(struct hard_iface *hard_iface, static void realloc_packet_buffer(struct hard_iface *hard_iface,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册