aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2011-06-26 09:26:18 -0400
committerMarek Lindner <lindner_marek@yahoo.de>2011-07-05 08:28:54 -0400
commit6a020ab452d38b3878903de931c162429072a7d7 (patch)
tree4ab894a1b36943b6b4ea83e715e68391f2484c16 /net
parentff66c975d5e412817f8122012760e852b4571b5e (diff)
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: Linus Luessing <linus.luessing@web.de> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/send.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 2f62b2e4a47b..4b8e11bc14fa 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -163,6 +163,7 @@ static void send_packet(struct forw_packet *forw_packet)
163 struct hard_iface *hard_iface; 163 struct hard_iface *hard_iface;
164 struct net_device *soft_iface; 164 struct net_device *soft_iface;
165 struct bat_priv *bat_priv; 165 struct bat_priv *bat_priv;
166 struct hard_iface *primary_if = NULL;
166 struct batman_packet *batman_packet = 167 struct batman_packet *batman_packet =
167 (struct batman_packet *)(forw_packet->skb->data); 168 (struct batman_packet *)(forw_packet->skb->data);
168 int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); 169 int directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0);
@@ -170,19 +171,23 @@ static void send_packet(struct forw_packet *forw_packet)
170 if (!forw_packet->if_incoming) { 171 if (!forw_packet->if_incoming) {
171 pr_err("Error - can't forward packet: incoming iface not " 172 pr_err("Error - can't forward packet: incoming iface not "
172 "specified\n"); 173 "specified\n");
173 return; 174 goto out;
174 } 175 }
175 176
176 soft_iface = forw_packet->if_incoming->soft_iface; 177 soft_iface = forw_packet->if_incoming->soft_iface;
177 bat_priv = netdev_priv(soft_iface); 178 bat_priv = netdev_priv(soft_iface);
178 179
179 if (forw_packet->if_incoming->if_status != IF_ACTIVE) 180 if (forw_packet->if_incoming->if_status != IF_ACTIVE)
180 return; 181 goto out;
182
183 primary_if = primary_if_get_selected(bat_priv);
184 if (!primary_if)
185 goto out;
181 186
182 /* multihomed peer assumed */ 187 /* multihomed peer assumed */
183 /* non-primary OGMs are only broadcasted on their interface */ 188 /* non-primary OGMs are only broadcasted on their interface */
184 if ((directlink && (batman_packet->ttl == 1)) || 189 if ((directlink && (batman_packet->ttl == 1)) ||
185 (forw_packet->own && (forw_packet->if_incoming->if_num > 0))) { 190 (forw_packet->own && (forw_packet->if_incoming != primary_if))) {
186 191
187 /* FIXME: what about aggregated packets ? */ 192 /* FIXME: what about aggregated packets ? */
188 bat_dbg(DBG_BATMAN, bat_priv, 193 bat_dbg(DBG_BATMAN, bat_priv,
@@ -199,7 +204,7 @@ static void send_packet(struct forw_packet *forw_packet)
199 broadcast_addr); 204 broadcast_addr);
200 forw_packet->skb = NULL; 205 forw_packet->skb = NULL;
201 206
202 return; 207 goto out;
203 } 208 }
204 209
205 /* broadcast on every interface */ 210 /* broadcast on every interface */
@@ -211,6 +216,10 @@ static void send_packet(struct forw_packet *forw_packet)
211 send_packet_to_if(forw_packet, hard_iface); 216 send_packet_to_if(forw_packet, hard_iface);
212 } 217 }
213 rcu_read_unlock(); 218 rcu_read_unlock();
219
220out:
221 if (primary_if)
222 hardif_free_ref(primary_if);
214} 223}
215 224
216static void realloc_packet_buffer(struct hard_iface *hard_iface, 225static void realloc_packet_buffer(struct hard_iface *hard_iface,