aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/hard-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r--net/batman-adv/hard-interface.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index c22c145d8224..e7eba9c32e70 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -196,7 +196,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
196 if (hard_iface->soft_iface != soft_iface) 196 if (hard_iface->soft_iface != soft_iface)
197 continue; 197 continue;
198 198
199 min_mtu = min_t(int, hard_iface->net_dev->mtu - BAT_HEADER_LEN, 199 min_mtu = min_t(int,
200 hard_iface->net_dev->mtu - BATADV_HEADER_LEN,
200 min_mtu); 201 min_mtu);
201 } 202 }
202 rcu_read_unlock(); 203 rcu_read_unlock();
@@ -234,8 +235,8 @@ static void batadv_hardif_activate_interface(struct hard_iface *hard_iface)
234 if (!primary_if) 235 if (!primary_if)
235 batadv_primary_if_select(bat_priv, hard_iface); 236 batadv_primary_if_select(bat_priv, hard_iface);
236 237
237 bat_info(hard_iface->soft_iface, "Interface activated: %s\n", 238 batadv_info(hard_iface->soft_iface, "Interface activated: %s\n",
238 hard_iface->net_dev->name); 239 hard_iface->net_dev->name);
239 240
240 batadv_update_min_mtu(hard_iface->soft_iface); 241 batadv_update_min_mtu(hard_iface->soft_iface);
241 242
@@ -252,8 +253,8 @@ static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface)
252 253
253 hard_iface->if_status = IF_INACTIVE; 254 hard_iface->if_status = IF_INACTIVE;
254 255
255 bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n", 256 batadv_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
256 hard_iface->net_dev->name); 257 hard_iface->net_dev->name);
257 258
258 batadv_update_min_mtu(hard_iface->soft_iface); 259 batadv_update_min_mtu(hard_iface->soft_iface);
259} 260}
@@ -263,6 +264,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
263{ 264{
264 struct bat_priv *bat_priv; 265 struct bat_priv *bat_priv;
265 struct net_device *soft_iface; 266 struct net_device *soft_iface;
267 __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
266 int ret; 268 int ret;
267 269
268 if (hard_iface->if_status != IF_NOT_IN_USE) 270 if (hard_iface->if_status != IF_NOT_IN_USE)
@@ -309,35 +311,35 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
309 hard_iface->if_status = IF_INACTIVE; 311 hard_iface->if_status = IF_INACTIVE;
310 batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces); 312 batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
311 313
312 hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN); 314 hard_iface->batman_adv_ptype.type = ethertype;
313 hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv; 315 hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
314 hard_iface->batman_adv_ptype.dev = hard_iface->net_dev; 316 hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
315 dev_add_pack(&hard_iface->batman_adv_ptype); 317 dev_add_pack(&hard_iface->batman_adv_ptype);
316 318
317 atomic_set(&hard_iface->frag_seqno, 1); 319 atomic_set(&hard_iface->frag_seqno, 1);
318 bat_info(hard_iface->soft_iface, "Adding interface: %s\n", 320 batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
319 hard_iface->net_dev->name); 321 hard_iface->net_dev->name);
320 322
321 if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < 323 if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
322 ETH_DATA_LEN + BAT_HEADER_LEN) 324 ETH_DATA_LEN + BATADV_HEADER_LEN)
323 bat_info(hard_iface->soft_iface, 325 batadv_info(hard_iface->soft_iface,
324 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n", 326 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n",
325 hard_iface->net_dev->name, hard_iface->net_dev->mtu, 327 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
326 ETH_DATA_LEN + BAT_HEADER_LEN); 328 ETH_DATA_LEN + BATADV_HEADER_LEN);
327 329
328 if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu < 330 if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
329 ETH_DATA_LEN + BAT_HEADER_LEN) 331 ETH_DATA_LEN + BATADV_HEADER_LEN)
330 bat_info(hard_iface->soft_iface, 332 batadv_info(hard_iface->soft_iface,
331 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n", 333 "The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n",
332 hard_iface->net_dev->name, hard_iface->net_dev->mtu, 334 hard_iface->net_dev->name, hard_iface->net_dev->mtu,
333 ETH_DATA_LEN + BAT_HEADER_LEN); 335 ETH_DATA_LEN + BATADV_HEADER_LEN);
334 336
335 if (batadv_hardif_is_iface_up(hard_iface)) 337 if (batadv_hardif_is_iface_up(hard_iface))
336 batadv_hardif_activate_interface(hard_iface); 338 batadv_hardif_activate_interface(hard_iface);
337 else 339 else
338 bat_err(hard_iface->soft_iface, 340 batadv_err(hard_iface->soft_iface,
339 "Not using interface %s (retrying later): interface not active\n", 341 "Not using interface %s (retrying later): interface not active\n",
340 hard_iface->net_dev->name); 342 hard_iface->net_dev->name);
341 343
342 /* begin scheduling originator messages on that interface */ 344 /* begin scheduling originator messages on that interface */
343 batadv_schedule_bat_ogm(hard_iface); 345 batadv_schedule_bat_ogm(hard_iface);
@@ -363,8 +365,8 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
363 if (hard_iface->if_status != IF_INACTIVE) 365 if (hard_iface->if_status != IF_INACTIVE)
364 goto out; 366 goto out;
365 367
366 bat_info(hard_iface->soft_iface, "Removing interface: %s\n", 368 batadv_info(hard_iface->soft_iface, "Removing interface: %s\n",
367 hard_iface->net_dev->name); 369 hard_iface->net_dev->name);
368 dev_remove_pack(&hard_iface->batman_adv_ptype); 370 dev_remove_pack(&hard_iface->batman_adv_ptype);
369 371
370 bat_priv->num_ifaces--; 372 bat_priv->num_ifaces--;
@@ -546,7 +548,7 @@ bool batadv_is_wifi_iface(int ifindex)
546 struct net_device *net_device = NULL; 548 struct net_device *net_device = NULL;
547 bool ret = false; 549 bool ret = false;
548 550
549 if (ifindex == NULL_IFINDEX) 551 if (ifindex == BATADV_NULL_IFINDEX)
550 goto out; 552 goto out;
551 553
552 net_device = dev_get_by_index(&init_net, ifindex); 554 net_device = dev_get_by_index(&init_net, ifindex);