hard-interface.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /* Copyright (C) 2007-2012 B.A.T.M.A.N. contributors:
  2. *
  3. * Marek Lindner, Simon Wunderlich
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of version 2 of the GNU General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA
  18. */
  19. #include "main.h"
  20. #include "distributed-arp-table.h"
  21. #include "hard-interface.h"
  22. #include "soft-interface.h"
  23. #include "send.h"
  24. #include "translation-table.h"
  25. #include "routing.h"
  26. #include "sysfs.h"
  27. #include "originator.h"
  28. #include "hash.h"
  29. #include "bridge_loop_avoidance.h"
  30. #include <linux/if_arp.h>
  31. void batadv_hardif_free_rcu(struct rcu_head *rcu)
  32. {
  33. struct batadv_hard_iface *hard_iface;
  34. hard_iface = container_of(rcu, struct batadv_hard_iface, rcu);
  35. dev_put(hard_iface->net_dev);
  36. kfree(hard_iface);
  37. }
  38. struct batadv_hard_iface *
  39. batadv_hardif_get_by_netdev(const struct net_device *net_dev)
  40. {
  41. struct batadv_hard_iface *hard_iface;
  42. rcu_read_lock();
  43. list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
  44. if (hard_iface->net_dev == net_dev &&
  45. atomic_inc_not_zero(&hard_iface->refcount))
  46. goto out;
  47. }
  48. hard_iface = NULL;
  49. out:
  50. rcu_read_unlock();
  51. return hard_iface;
  52. }
  53. /**
  54. * batadv_is_on_batman_iface - check if a device is a batman iface descendant
  55. * @net_dev: the device to check
  56. *
  57. * If the user creates any virtual device on top of a batman-adv interface, it
  58. * is important to prevent this new interface to be used to create a new mesh
  59. * network (this behaviour would lead to a batman-over-batman configuration).
  60. * This function recursively checks all the fathers of the device passed as
  61. * argument looking for a batman-adv soft interface.
  62. *
  63. * Returns true if the device is descendant of a batman-adv mesh interface (or
  64. * if it is a batman-adv interface itself), false otherwise
  65. */
  66. static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
  67. {
  68. struct net_device *parent_dev;
  69. bool ret;
  70. /* check if this is a batman-adv mesh interface */
  71. if (batadv_softif_is_valid(net_dev))
  72. return true;
  73. /* no more parents..stop recursion */
  74. if (net_dev->iflink == net_dev->ifindex)
  75. return false;
  76. /* recurse over the parent device */
  77. parent_dev = dev_get_by_index(&init_net, net_dev->iflink);
  78. /* if we got a NULL parent_dev there is something broken.. */
  79. if (WARN(!parent_dev, "Cannot find parent device"))
  80. return false;
  81. ret = batadv_is_on_batman_iface(parent_dev);
  82. if (parent_dev)
  83. dev_put(parent_dev);
  84. return ret;
  85. }
  86. static int batadv_is_valid_iface(const struct net_device *net_dev)
  87. {
  88. if (net_dev->flags & IFF_LOOPBACK)
  89. return 0;
  90. if (net_dev->type != ARPHRD_ETHER)
  91. return 0;
  92. if (net_dev->addr_len != ETH_ALEN)
  93. return 0;
  94. /* no batman over batman */
  95. if (batadv_is_on_batman_iface(net_dev))
  96. return 0;
  97. return 1;
  98. }
  99. static struct batadv_hard_iface *
  100. batadv_hardif_get_active(const struct net_device *soft_iface)
  101. {
  102. struct batadv_hard_iface *hard_iface;
  103. rcu_read_lock();
  104. list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
  105. if (hard_iface->soft_iface != soft_iface)
  106. continue;
  107. if (hard_iface->if_status == BATADV_IF_ACTIVE &&
  108. atomic_inc_not_zero(&hard_iface->refcount))
  109. goto out;
  110. }
  111. hard_iface = NULL;
  112. out:
  113. rcu_read_unlock();
  114. return hard_iface;
  115. }
  116. static void batadv_primary_if_update_addr(struct batadv_priv *bat_priv,
  117. struct batadv_hard_iface *oldif)
  118. {
  119. struct batadv_vis_packet *vis_packet;
  120. struct batadv_hard_iface *primary_if;
  121. struct sk_buff *skb;
  122. primary_if = batadv_primary_if_get_selected(bat_priv);
  123. if (!primary_if)
  124. goto out;
  125. batadv_dat_init_own_addr(bat_priv, primary_if);
  126. skb = bat_priv->vis.my_info->skb_packet;
  127. vis_packet = (struct batadv_vis_packet *)skb->data;
  128. memcpy(vis_packet->vis_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
  129. memcpy(vis_packet->sender_orig,
  130. primary_if->net_dev->dev_addr, ETH_ALEN);
  131. batadv_bla_update_orig_address(bat_priv, primary_if, oldif);
  132. out:
  133. if (primary_if)
  134. batadv_hardif_free_ref(primary_if);
  135. }
  136. static void batadv_primary_if_select(struct batadv_priv *bat_priv,
  137. struct batadv_hard_iface *new_hard_iface)
  138. {
  139. struct batadv_hard_iface *curr_hard_iface;
  140. ASSERT_RTNL();
  141. if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount))
  142. new_hard_iface = NULL;
  143. curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1);
  144. rcu_assign_pointer(bat_priv->primary_if, new_hard_iface);
  145. if (!new_hard_iface)
  146. goto out;
  147. bat_priv->bat_algo_ops->bat_primary_iface_set(new_hard_iface);
  148. batadv_primary_if_update_addr(bat_priv, curr_hard_iface);
  149. out:
  150. if (curr_hard_iface)
  151. batadv_hardif_free_ref(curr_hard_iface);
  152. }
  153. static bool
  154. batadv_hardif_is_iface_up(const struct batadv_hard_iface *hard_iface)
  155. {
  156. if (hard_iface->net_dev->flags & IFF_UP)
  157. return true;
  158. return false;
  159. }
  160. static void batadv_check_known_mac_addr(const struct net_device *net_dev)
  161. {
  162. const struct batadv_hard_iface *hard_iface;
  163. rcu_read_lock();
  164. list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
  165. if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
  166. (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
  167. continue;
  168. if (hard_iface->net_dev == net_dev)
  169. continue;
  170. if (!batadv_compare_eth(hard_iface->net_dev->dev_addr,
  171. net_dev->dev_addr))
  172. continue;
  173. pr_warn("The newly added mac address (%pM) already exists on: %s\n",
  174. net_dev->dev_addr, hard_iface->net_dev->name);
  175. pr_warn("It is strongly recommended to keep mac addresses unique to avoid problems!\n");
  176. }
  177. rcu_read_unlock();
  178. }
  179. int batadv_hardif_min_mtu(struct net_device *soft_iface)
  180. {
  181. const struct batadv_priv *bat_priv = netdev_priv(soft_iface);
  182. const struct batadv_hard_iface *hard_iface;
  183. /* allow big frames if all devices are capable to do so
  184. * (have MTU > 1500 + BAT_HEADER_LEN)
  185. */
  186. int min_mtu = ETH_DATA_LEN;
  187. if (atomic_read(&bat_priv->fragmentation))
  188. goto out;
  189. rcu_read_lock();
  190. list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
  191. if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
  192. (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
  193. continue;
  194. if (hard_iface->soft_iface != soft_iface)
  195. continue;
  196. min_mtu = min_t(int,
  197. hard_iface->net_dev->mtu - BATADV_HEADER_LEN,
  198. min_mtu);
  199. }
  200. rcu_read_unlock();
  201. out:
  202. return min_mtu;
  203. }
  204. /* adjusts the MTU if a new interface with a smaller MTU appeared. */
  205. void batadv_update_min_mtu(struct net_device *soft_iface)
  206. {
  207. int min_mtu;
  208. min_mtu = batadv_hardif_min_mtu(soft_iface);
  209. if (soft_iface->mtu != min_mtu)
  210. soft_iface->mtu = min_mtu;
  211. }
  212. static void
  213. batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)
  214. {
  215. struct batadv_priv *bat_priv;
  216. struct batadv_hard_iface *primary_if = NULL;
  217. if (hard_iface->if_status != BATADV_IF_INACTIVE)
  218. goto out;
  219. bat_priv = netdev_priv(hard_iface->soft_iface);
  220. bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
  221. hard_iface->if_status = BATADV_IF_TO_BE_ACTIVATED;
  222. /* the first active interface becomes our primary interface or
  223. * the next active interface after the old primary interface was removed
  224. */
  225. primary_if = batadv_primary_if_get_selected(bat_priv);
  226. if (!primary_if)
  227. batadv_primary_if_select(bat_priv, hard_iface);
  228. batadv_info(hard_iface->soft_iface, "Interface activated: %s\n",
  229. hard_iface->net_dev->name);
  230. batadv_update_min_mtu(hard_iface->soft_iface);
  231. out:
  232. if (primary_if)
  233. batadv_hardif_free_ref(primary_if);
  234. }
  235. static void
  236. batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
  237. {
  238. if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
  239. (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
  240. return;
  241. hard_iface->if_status = BATADV_IF_INACTIVE;
  242. batadv_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
  243. hard_iface->net_dev->name);
  244. batadv_update_min_mtu(hard_iface->soft_iface);
  245. }
  246. int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
  247. const char *iface_name)
  248. {
  249. struct batadv_priv *bat_priv;
  250. struct net_device *soft_iface;
  251. __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
  252. int ret;
  253. if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
  254. goto out;
  255. if (!atomic_inc_not_zero(&hard_iface->refcount))
  256. goto out;
  257. /* hard-interface is part of a bridge */
  258. if (hard_iface->net_dev->priv_flags & IFF_BRIDGE_PORT)
  259. pr_err("You are about to enable batman-adv on '%s' which already is part of a bridge. Unless you know exactly what you are doing this is probably wrong and won't work the way you think it would.\n",
  260. hard_iface->net_dev->name);
  261. soft_iface = dev_get_by_name(&init_net, iface_name);
  262. if (!soft_iface) {
  263. soft_iface = batadv_softif_create(iface_name);
  264. if (!soft_iface) {
  265. ret = -ENOMEM;
  266. goto err;
  267. }
  268. /* dev_get_by_name() increases the reference counter for us */
  269. dev_hold(soft_iface);
  270. }
  271. if (!batadv_softif_is_valid(soft_iface)) {
  272. pr_err("Can't create batman mesh interface %s: already exists as regular interface\n",
  273. soft_iface->name);
  274. ret = -EINVAL;
  275. goto err_dev;
  276. }
  277. hard_iface->soft_iface = soft_iface;
  278. bat_priv = netdev_priv(hard_iface->soft_iface);
  279. ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface);
  280. if (ret < 0)
  281. goto err_dev;
  282. hard_iface->if_num = bat_priv->num_ifaces;
  283. bat_priv->num_ifaces++;
  284. hard_iface->if_status = BATADV_IF_INACTIVE;
  285. ret = batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
  286. if (ret < 0) {
  287. bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
  288. bat_priv->num_ifaces--;
  289. hard_iface->if_status = BATADV_IF_NOT_IN_USE;
  290. goto err_dev;
  291. }
  292. hard_iface->batman_adv_ptype.type = ethertype;
  293. hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
  294. hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
  295. dev_add_pack(&hard_iface->batman_adv_ptype);
  296. atomic_set(&hard_iface->frag_seqno, 1);
  297. batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
  298. hard_iface->net_dev->name);
  299. if (atomic_read(&bat_priv->fragmentation) &&
  300. hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
  301. batadv_info(hard_iface->soft_iface,
  302. "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",
  303. hard_iface->net_dev->name, hard_iface->net_dev->mtu,
  304. ETH_DATA_LEN + BATADV_HEADER_LEN);
  305. if (!atomic_read(&bat_priv->fragmentation) &&
  306. hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
  307. batadv_info(hard_iface->soft_iface,
  308. "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",
  309. hard_iface->net_dev->name, hard_iface->net_dev->mtu,
  310. ETH_DATA_LEN + BATADV_HEADER_LEN);
  311. if (batadv_hardif_is_iface_up(hard_iface))
  312. batadv_hardif_activate_interface(hard_iface);
  313. else
  314. batadv_err(hard_iface->soft_iface,
  315. "Not using interface %s (retrying later): interface not active\n",
  316. hard_iface->net_dev->name);
  317. /* begin scheduling originator messages on that interface */
  318. batadv_schedule_bat_ogm(hard_iface);
  319. out:
  320. return 0;
  321. err_dev:
  322. dev_put(soft_iface);
  323. err:
  324. batadv_hardif_free_ref(hard_iface);
  325. return ret;
  326. }
  327. void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
  328. {
  329. struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
  330. struct batadv_hard_iface *primary_if = NULL;
  331. if (hard_iface->if_status == BATADV_IF_ACTIVE)
  332. batadv_hardif_deactivate_interface(hard_iface);
  333. if (hard_iface->if_status != BATADV_IF_INACTIVE)
  334. goto out;
  335. batadv_info(hard_iface->soft_iface, "Removing interface: %s\n",
  336. hard_iface->net_dev->name);
  337. dev_remove_pack(&hard_iface->batman_adv_ptype);
  338. bat_priv->num_ifaces--;
  339. batadv_orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
  340. primary_if = batadv_primary_if_get_selected(bat_priv);
  341. if (hard_iface == primary_if) {
  342. struct batadv_hard_iface *new_if;
  343. new_if = batadv_hardif_get_active(hard_iface->soft_iface);
  344. batadv_primary_if_select(bat_priv, new_if);
  345. if (new_if)
  346. batadv_hardif_free_ref(new_if);
  347. }
  348. bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
  349. hard_iface->if_status = BATADV_IF_NOT_IN_USE;
  350. /* delete all references to this hard_iface */
  351. batadv_purge_orig_ref(bat_priv);
  352. batadv_purge_outstanding_packets(bat_priv, hard_iface);
  353. dev_put(hard_iface->soft_iface);
  354. /* nobody uses this interface anymore */
  355. if (!bat_priv->num_ifaces)
  356. batadv_softif_destroy(hard_iface->soft_iface);
  357. hard_iface->soft_iface = NULL;
  358. batadv_hardif_free_ref(hard_iface);
  359. out:
  360. if (primary_if)
  361. batadv_hardif_free_ref(primary_if);
  362. }
  363. static struct batadv_hard_iface *
  364. batadv_hardif_add_interface(struct net_device *net_dev)
  365. {
  366. struct batadv_hard_iface *hard_iface;
  367. int ret;
  368. ASSERT_RTNL();
  369. ret = batadv_is_valid_iface(net_dev);
  370. if (ret != 1)
  371. goto out;
  372. dev_hold(net_dev);
  373. hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC);
  374. if (!hard_iface)
  375. goto release_dev;
  376. ret = batadv_sysfs_add_hardif(&hard_iface->hardif_obj, net_dev);
  377. if (ret)
  378. goto free_if;
  379. hard_iface->if_num = -1;
  380. hard_iface->net_dev = net_dev;
  381. hard_iface->soft_iface = NULL;
  382. hard_iface->if_status = BATADV_IF_NOT_IN_USE;
  383. INIT_LIST_HEAD(&hard_iface->list);
  384. /* extra reference for return */
  385. atomic_set(&hard_iface->refcount, 2);
  386. batadv_check_known_mac_addr(hard_iface->net_dev);
  387. list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
  388. /* This can't be called via a bat_priv callback because
  389. * we have no bat_priv yet.
  390. */
  391. atomic_set(&hard_iface->bat_iv.ogm_seqno, 1);
  392. hard_iface->bat_iv.ogm_buff = NULL;
  393. return hard_iface;
  394. free_if:
  395. kfree(hard_iface);
  396. release_dev:
  397. dev_put(net_dev);
  398. out:
  399. return NULL;
  400. }
  401. static void batadv_hardif_remove_interface(struct batadv_hard_iface *hard_iface)
  402. {
  403. ASSERT_RTNL();
  404. /* first deactivate interface */
  405. if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
  406. batadv_hardif_disable_interface(hard_iface);
  407. if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
  408. return;
  409. hard_iface->if_status = BATADV_IF_TO_BE_REMOVED;
  410. batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
  411. batadv_hardif_free_ref(hard_iface);
  412. }
  413. void batadv_hardif_remove_interfaces(void)
  414. {
  415. struct batadv_hard_iface *hard_iface, *hard_iface_tmp;
  416. rtnl_lock();
  417. list_for_each_entry_safe(hard_iface, hard_iface_tmp,
  418. &batadv_hardif_list, list) {
  419. list_del_rcu(&hard_iface->list);
  420. batadv_hardif_remove_interface(hard_iface);
  421. }
  422. rtnl_unlock();
  423. }
  424. static int batadv_hard_if_event(struct notifier_block *this,
  425. unsigned long event, void *ptr)
  426. {
  427. struct net_device *net_dev = ptr;
  428. struct batadv_hard_iface *hard_iface;
  429. struct batadv_hard_iface *primary_if = NULL;
  430. struct batadv_priv *bat_priv;
  431. hard_iface = batadv_hardif_get_by_netdev(net_dev);
  432. if (!hard_iface && event == NETDEV_REGISTER)
  433. hard_iface = batadv_hardif_add_interface(net_dev);
  434. if (!hard_iface)
  435. goto out;
  436. switch (event) {
  437. case NETDEV_UP:
  438. batadv_hardif_activate_interface(hard_iface);
  439. break;
  440. case NETDEV_GOING_DOWN:
  441. case NETDEV_DOWN:
  442. batadv_hardif_deactivate_interface(hard_iface);
  443. break;
  444. case NETDEV_UNREGISTER:
  445. list_del_rcu(&hard_iface->list);
  446. batadv_hardif_remove_interface(hard_iface);
  447. break;
  448. case NETDEV_CHANGEMTU:
  449. if (hard_iface->soft_iface)
  450. batadv_update_min_mtu(hard_iface->soft_iface);
  451. break;
  452. case NETDEV_CHANGEADDR:
  453. if (hard_iface->if_status == BATADV_IF_NOT_IN_USE)
  454. goto hardif_put;
  455. batadv_check_known_mac_addr(hard_iface->net_dev);
  456. bat_priv = netdev_priv(hard_iface->soft_iface);
  457. bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
  458. primary_if = batadv_primary_if_get_selected(bat_priv);
  459. if (!primary_if)
  460. goto hardif_put;
  461. if (hard_iface == primary_if)
  462. batadv_primary_if_update_addr(bat_priv, NULL);
  463. break;
  464. default:
  465. break;
  466. }
  467. hardif_put:
  468. batadv_hardif_free_ref(hard_iface);
  469. out:
  470. if (primary_if)
  471. batadv_hardif_free_ref(primary_if);
  472. return NOTIFY_DONE;
  473. }
  474. /* This function returns true if the interface represented by ifindex is a
  475. * 802.11 wireless device
  476. */
  477. bool batadv_is_wifi_iface(int ifindex)
  478. {
  479. struct net_device *net_device = NULL;
  480. bool ret = false;
  481. if (ifindex == BATADV_NULL_IFINDEX)
  482. goto out;
  483. net_device = dev_get_by_index(&init_net, ifindex);
  484. if (!net_device)
  485. goto out;
  486. #ifdef CONFIG_WIRELESS_EXT
  487. /* pre-cfg80211 drivers have to implement WEXT, so it is possible to
  488. * check for wireless_handlers != NULL
  489. */
  490. if (net_device->wireless_handlers)
  491. ret = true;
  492. else
  493. #endif
  494. /* cfg80211 drivers have to set ieee80211_ptr */
  495. if (net_device->ieee80211_ptr)
  496. ret = true;
  497. out:
  498. if (net_device)
  499. dev_put(net_device);
  500. return ret;
  501. }
  502. struct notifier_block batadv_hard_if_notifier = {
  503. .notifier_call = batadv_hard_if_event,
  504. };