hard-interface.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
  3. *
  4. * Marek Lindner, Simon Wunderlich
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of version 2 of the GNU General Public
  8. * License as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA
  19. *
  20. */
  21. #include "main.h"
  22. #include "hard-interface.h"
  23. #include "soft-interface.h"
  24. #include "send.h"
  25. #include "translation-table.h"
  26. #include "routing.h"
  27. #include "bat_sysfs.h"
  28. #include "originator.h"
  29. #include "hash.h"
  30. #include "bat_ogm.h"
  31. #include <linux/if_arp.h>
  32. static int batman_skb_recv(struct sk_buff *skb,
  33. struct net_device *dev,
  34. struct packet_type *ptype,
  35. struct net_device *orig_dev);
  36. void hardif_free_rcu(struct rcu_head *rcu)
  37. {
  38. struct hard_iface *hard_iface;
  39. hard_iface = container_of(rcu, struct hard_iface, rcu);
  40. dev_put(hard_iface->net_dev);
  41. kfree(hard_iface);
  42. }
  43. struct hard_iface *hardif_get_by_netdev(const struct net_device *net_dev)
  44. {
  45. struct hard_iface *hard_iface;
  46. rcu_read_lock();
  47. list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
  48. if (hard_iface->net_dev == net_dev &&
  49. atomic_inc_not_zero(&hard_iface->refcount))
  50. goto out;
  51. }
  52. hard_iface = NULL;
  53. out:
  54. rcu_read_unlock();
  55. return hard_iface;
  56. }
  57. static int is_valid_iface(const struct net_device *net_dev)
  58. {
  59. if (net_dev->flags & IFF_LOOPBACK)
  60. return 0;
  61. if (net_dev->type != ARPHRD_ETHER)
  62. return 0;
  63. if (net_dev->addr_len != ETH_ALEN)
  64. return 0;
  65. /* no batman over batman */
  66. if (softif_is_valid(net_dev))
  67. return 0;
  68. /* Device is being bridged */
  69. /* if (net_dev->priv_flags & IFF_BRIDGE_PORT)
  70. return 0; */
  71. return 1;
  72. }
  73. static struct hard_iface *hardif_get_active(const struct net_device *soft_iface)
  74. {
  75. struct hard_iface *hard_iface;
  76. rcu_read_lock();
  77. list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
  78. if (hard_iface->soft_iface != soft_iface)
  79. continue;
  80. if (hard_iface->if_status == IF_ACTIVE &&
  81. atomic_inc_not_zero(&hard_iface->refcount))
  82. goto out;
  83. }
  84. hard_iface = NULL;
  85. out:
  86. rcu_read_unlock();
  87. return hard_iface;
  88. }
  89. static void primary_if_update_addr(struct bat_priv *bat_priv)
  90. {
  91. struct vis_packet *vis_packet;
  92. struct hard_iface *primary_if;
  93. primary_if = primary_if_get_selected(bat_priv);
  94. if (!primary_if)
  95. goto out;
  96. vis_packet = (struct vis_packet *)
  97. bat_priv->my_vis_info->skb_packet->data;
  98. memcpy(vis_packet->vis_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
  99. memcpy(vis_packet->sender_orig,
  100. primary_if->net_dev->dev_addr, ETH_ALEN);
  101. out:
  102. if (primary_if)
  103. hardif_free_ref(primary_if);
  104. }
  105. static void primary_if_select(struct bat_priv *bat_priv,
  106. struct hard_iface *new_hard_iface)
  107. {
  108. struct hard_iface *curr_hard_iface;
  109. ASSERT_RTNL();
  110. if (new_hard_iface && !atomic_inc_not_zero(&new_hard_iface->refcount))
  111. new_hard_iface = NULL;
  112. curr_hard_iface = rcu_dereference_protected(bat_priv->primary_if, 1);
  113. rcu_assign_pointer(bat_priv->primary_if, new_hard_iface);
  114. if (curr_hard_iface)
  115. hardif_free_ref(curr_hard_iface);
  116. if (!new_hard_iface)
  117. return;
  118. bat_ogm_init_primary(new_hard_iface);
  119. primary_if_update_addr(bat_priv);
  120. }
  121. static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
  122. {
  123. if (hard_iface->net_dev->flags & IFF_UP)
  124. return true;
  125. return false;
  126. }
  127. static void check_known_mac_addr(const struct net_device *net_dev)
  128. {
  129. const struct hard_iface *hard_iface;
  130. rcu_read_lock();
  131. list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
  132. if ((hard_iface->if_status != IF_ACTIVE) &&
  133. (hard_iface->if_status != IF_TO_BE_ACTIVATED))
  134. continue;
  135. if (hard_iface->net_dev == net_dev)
  136. continue;
  137. if (!compare_eth(hard_iface->net_dev->dev_addr,
  138. net_dev->dev_addr))
  139. continue;
  140. pr_warning("The newly added mac address (%pM) already exists "
  141. "on: %s\n", net_dev->dev_addr,
  142. hard_iface->net_dev->name);
  143. pr_warning("It is strongly recommended to keep mac addresses "
  144. "unique to avoid problems!\n");
  145. }
  146. rcu_read_unlock();
  147. }
  148. int hardif_min_mtu(struct net_device *soft_iface)
  149. {
  150. const struct bat_priv *bat_priv = netdev_priv(soft_iface);
  151. const struct hard_iface *hard_iface;
  152. /* allow big frames if all devices are capable to do so
  153. * (have MTU > 1500 + BAT_HEADER_LEN) */
  154. int min_mtu = ETH_DATA_LEN;
  155. if (atomic_read(&bat_priv->fragmentation))
  156. goto out;
  157. rcu_read_lock();
  158. list_for_each_entry_rcu(hard_iface, &hardif_list, list) {
  159. if ((hard_iface->if_status != IF_ACTIVE) &&
  160. (hard_iface->if_status != IF_TO_BE_ACTIVATED))
  161. continue;
  162. if (hard_iface->soft_iface != soft_iface)
  163. continue;
  164. min_mtu = min_t(int, hard_iface->net_dev->mtu - BAT_HEADER_LEN,
  165. min_mtu);
  166. }
  167. rcu_read_unlock();
  168. out:
  169. return min_mtu;
  170. }
  171. /* adjusts the MTU if a new interface with a smaller MTU appeared. */
  172. void update_min_mtu(struct net_device *soft_iface)
  173. {
  174. int min_mtu;
  175. min_mtu = hardif_min_mtu(soft_iface);
  176. if (soft_iface->mtu != min_mtu)
  177. soft_iface->mtu = min_mtu;
  178. }
  179. static void hardif_activate_interface(struct hard_iface *hard_iface)
  180. {
  181. struct bat_priv *bat_priv;
  182. struct hard_iface *primary_if = NULL;
  183. if (hard_iface->if_status != IF_INACTIVE)
  184. goto out;
  185. bat_priv = netdev_priv(hard_iface->soft_iface);
  186. bat_ogm_update_mac(hard_iface);
  187. hard_iface->if_status = IF_TO_BE_ACTIVATED;
  188. /**
  189. * the first active interface becomes our primary interface or
  190. * the next active interface after the old primary interface was removed
  191. */
  192. primary_if = primary_if_get_selected(bat_priv);
  193. if (!primary_if)
  194. primary_if_select(bat_priv, hard_iface);
  195. bat_info(hard_iface->soft_iface, "Interface activated: %s\n",
  196. hard_iface->net_dev->name);
  197. update_min_mtu(hard_iface->soft_iface);
  198. out:
  199. if (primary_if)
  200. hardif_free_ref(primary_if);
  201. }
  202. static void hardif_deactivate_interface(struct hard_iface *hard_iface)
  203. {
  204. if ((hard_iface->if_status != IF_ACTIVE) &&
  205. (hard_iface->if_status != IF_TO_BE_ACTIVATED))
  206. return;
  207. hard_iface->if_status = IF_INACTIVE;
  208. bat_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
  209. hard_iface->net_dev->name);
  210. update_min_mtu(hard_iface->soft_iface);
  211. }
  212. int hardif_enable_interface(struct hard_iface *hard_iface,
  213. const char *iface_name)
  214. {
  215. struct bat_priv *bat_priv;
  216. struct net_device *soft_iface;
  217. int ret;
  218. if (hard_iface->if_status != IF_NOT_IN_USE)
  219. goto out;
  220. if (!atomic_inc_not_zero(&hard_iface->refcount))
  221. goto out;
  222. soft_iface = dev_get_by_name(&init_net, iface_name);
  223. if (!soft_iface) {
  224. soft_iface = softif_create(iface_name);
  225. if (!soft_iface) {
  226. ret = -ENOMEM;
  227. goto err;
  228. }
  229. /* dev_get_by_name() increases the reference counter for us */
  230. dev_hold(soft_iface);
  231. }
  232. if (!softif_is_valid(soft_iface)) {
  233. pr_err("Can't create batman mesh interface %s: "
  234. "already exists as regular interface\n",
  235. soft_iface->name);
  236. dev_put(soft_iface);
  237. ret = -EINVAL;
  238. goto err;
  239. }
  240. hard_iface->soft_iface = soft_iface;
  241. bat_priv = netdev_priv(hard_iface->soft_iface);
  242. bat_ogm_init(hard_iface);
  243. if (!hard_iface->packet_buff) {
  244. bat_err(hard_iface->soft_iface, "Can't add interface packet "
  245. "(%s): out of memory\n", hard_iface->net_dev->name);
  246. ret = -ENOMEM;
  247. goto err;
  248. }
  249. hard_iface->if_num = bat_priv->num_ifaces;
  250. bat_priv->num_ifaces++;
  251. hard_iface->if_status = IF_INACTIVE;
  252. orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
  253. hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN);
  254. hard_iface->batman_adv_ptype.func = batman_skb_recv;
  255. hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
  256. dev_add_pack(&hard_iface->batman_adv_ptype);
  257. atomic_set(&hard_iface->seqno, 1);
  258. atomic_set(&hard_iface->frag_seqno, 1);
  259. bat_info(hard_iface->soft_iface, "Adding interface: %s\n",
  260. hard_iface->net_dev->name);
  261. if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
  262. ETH_DATA_LEN + BAT_HEADER_LEN)
  263. bat_info(hard_iface->soft_iface,
  264. "The MTU of interface %s is too small (%i) to handle "
  265. "the transport of batman-adv packets. Packets going "
  266. "over this interface will be fragmented on layer2 "
  267. "which could impact the performance. Setting the MTU "
  268. "to %zi would solve the problem.\n",
  269. hard_iface->net_dev->name, hard_iface->net_dev->mtu,
  270. ETH_DATA_LEN + BAT_HEADER_LEN);
  271. if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
  272. ETH_DATA_LEN + BAT_HEADER_LEN)
  273. bat_info(hard_iface->soft_iface,
  274. "The MTU of interface %s is too small (%i) to handle "
  275. "the transport of batman-adv packets. If you experience"
  276. " problems getting traffic through try increasing the "
  277. "MTU to %zi.\n",
  278. hard_iface->net_dev->name, hard_iface->net_dev->mtu,
  279. ETH_DATA_LEN + BAT_HEADER_LEN);
  280. if (hardif_is_iface_up(hard_iface))
  281. hardif_activate_interface(hard_iface);
  282. else
  283. bat_err(hard_iface->soft_iface, "Not using interface %s "
  284. "(retrying later): interface not active\n",
  285. hard_iface->net_dev->name);
  286. /* begin scheduling originator messages on that interface */
  287. schedule_bat_ogm(hard_iface);
  288. out:
  289. return 0;
  290. err:
  291. hardif_free_ref(hard_iface);
  292. return ret;
  293. }
  294. void hardif_disable_interface(struct hard_iface *hard_iface)
  295. {
  296. struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
  297. struct hard_iface *primary_if = NULL;
  298. if (hard_iface->if_status == IF_ACTIVE)
  299. hardif_deactivate_interface(hard_iface);
  300. if (hard_iface->if_status != IF_INACTIVE)
  301. goto out;
  302. bat_info(hard_iface->soft_iface, "Removing interface: %s\n",
  303. hard_iface->net_dev->name);
  304. dev_remove_pack(&hard_iface->batman_adv_ptype);
  305. bat_priv->num_ifaces--;
  306. orig_hash_del_if(hard_iface, bat_priv->num_ifaces);
  307. primary_if = primary_if_get_selected(bat_priv);
  308. if (hard_iface == primary_if) {
  309. struct hard_iface *new_if;
  310. new_if = hardif_get_active(hard_iface->soft_iface);
  311. primary_if_select(bat_priv, new_if);
  312. if (new_if)
  313. hardif_free_ref(new_if);
  314. }
  315. kfree(hard_iface->packet_buff);
  316. hard_iface->packet_buff = NULL;
  317. hard_iface->if_status = IF_NOT_IN_USE;
  318. /* delete all references to this hard_iface */
  319. purge_orig_ref(bat_priv);
  320. purge_outstanding_packets(bat_priv, hard_iface);
  321. dev_put(hard_iface->soft_iface);
  322. /* nobody uses this interface anymore */
  323. if (!bat_priv->num_ifaces)
  324. softif_destroy(hard_iface->soft_iface);
  325. hard_iface->soft_iface = NULL;
  326. hardif_free_ref(hard_iface);
  327. out:
  328. if (primary_if)
  329. hardif_free_ref(primary_if);
  330. }
  331. static struct hard_iface *hardif_add_interface(struct net_device *net_dev)
  332. {
  333. struct hard_iface *hard_iface;
  334. int ret;
  335. ASSERT_RTNL();
  336. ret = is_valid_iface(net_dev);
  337. if (ret != 1)
  338. goto out;
  339. dev_hold(net_dev);
  340. hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC);
  341. if (!hard_iface)
  342. goto release_dev;
  343. ret = sysfs_add_hardif(&hard_iface->hardif_obj, net_dev);
  344. if (ret)
  345. goto free_if;
  346. hard_iface->if_num = -1;
  347. hard_iface->net_dev = net_dev;
  348. hard_iface->soft_iface = NULL;
  349. hard_iface->if_status = IF_NOT_IN_USE;
  350. INIT_LIST_HEAD(&hard_iface->list);
  351. /* extra reference for return */
  352. atomic_set(&hard_iface->refcount, 2);
  353. check_known_mac_addr(hard_iface->net_dev);
  354. list_add_tail_rcu(&hard_iface->list, &hardif_list);
  355. return hard_iface;
  356. free_if:
  357. kfree(hard_iface);
  358. release_dev:
  359. dev_put(net_dev);
  360. out:
  361. return NULL;
  362. }
  363. static void hardif_remove_interface(struct hard_iface *hard_iface)
  364. {
  365. ASSERT_RTNL();
  366. /* first deactivate interface */
  367. if (hard_iface->if_status != IF_NOT_IN_USE)
  368. hardif_disable_interface(hard_iface);
  369. if (hard_iface->if_status != IF_NOT_IN_USE)
  370. return;
  371. hard_iface->if_status = IF_TO_BE_REMOVED;
  372. sysfs_del_hardif(&hard_iface->hardif_obj);
  373. hardif_free_ref(hard_iface);
  374. }
  375. void hardif_remove_interfaces(void)
  376. {
  377. struct hard_iface *hard_iface, *hard_iface_tmp;
  378. rtnl_lock();
  379. list_for_each_entry_safe(hard_iface, hard_iface_tmp,
  380. &hardif_list, list) {
  381. list_del_rcu(&hard_iface->list);
  382. hardif_remove_interface(hard_iface);
  383. }
  384. rtnl_unlock();
  385. }
  386. static int hard_if_event(struct notifier_block *this,
  387. unsigned long event, void *ptr)
  388. {
  389. struct net_device *net_dev = ptr;
  390. struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
  391. struct hard_iface *primary_if = NULL;
  392. struct bat_priv *bat_priv;
  393. if (!hard_iface && event == NETDEV_REGISTER)
  394. hard_iface = hardif_add_interface(net_dev);
  395. if (!hard_iface)
  396. goto out;
  397. switch (event) {
  398. case NETDEV_UP:
  399. hardif_activate_interface(hard_iface);
  400. break;
  401. case NETDEV_GOING_DOWN:
  402. case NETDEV_DOWN:
  403. hardif_deactivate_interface(hard_iface);
  404. break;
  405. case NETDEV_UNREGISTER:
  406. list_del_rcu(&hard_iface->list);
  407. hardif_remove_interface(hard_iface);
  408. break;
  409. case NETDEV_CHANGEMTU:
  410. if (hard_iface->soft_iface)
  411. update_min_mtu(hard_iface->soft_iface);
  412. break;
  413. case NETDEV_CHANGEADDR:
  414. if (hard_iface->if_status == IF_NOT_IN_USE)
  415. goto hardif_put;
  416. check_known_mac_addr(hard_iface->net_dev);
  417. bat_ogm_update_mac(hard_iface);
  418. bat_priv = netdev_priv(hard_iface->soft_iface);
  419. primary_if = primary_if_get_selected(bat_priv);
  420. if (!primary_if)
  421. goto hardif_put;
  422. if (hard_iface == primary_if)
  423. primary_if_update_addr(bat_priv);
  424. break;
  425. default:
  426. break;
  427. }
  428. hardif_put:
  429. hardif_free_ref(hard_iface);
  430. out:
  431. if (primary_if)
  432. hardif_free_ref(primary_if);
  433. return NOTIFY_DONE;
  434. }
  435. /* incoming packets with the batman ethertype received on any active hard
  436. * interface */
  437. static int batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
  438. struct packet_type *ptype,
  439. struct net_device *orig_dev)
  440. {
  441. struct bat_priv *bat_priv;
  442. struct batman_ogm_packet *batman_ogm_packet;
  443. struct hard_iface *hard_iface;
  444. int ret;
  445. hard_iface = container_of(ptype, struct hard_iface, batman_adv_ptype);
  446. skb = skb_share_check(skb, GFP_ATOMIC);
  447. /* skb was released by skb_share_check() */
  448. if (!skb)
  449. goto err_out;
  450. /* packet should hold at least type and version */
  451. if (unlikely(!pskb_may_pull(skb, 2)))
  452. goto err_free;
  453. /* expect a valid ethernet header here. */
  454. if (unlikely(skb->mac_len != sizeof(struct ethhdr)
  455. || !skb_mac_header(skb)))
  456. goto err_free;
  457. if (!hard_iface->soft_iface)
  458. goto err_free;
  459. bat_priv = netdev_priv(hard_iface->soft_iface);
  460. if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
  461. goto err_free;
  462. /* discard frames on not active interfaces */
  463. if (hard_iface->if_status != IF_ACTIVE)
  464. goto err_free;
  465. batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
  466. if (batman_ogm_packet->version != COMPAT_VERSION) {
  467. bat_dbg(DBG_BATMAN, bat_priv,
  468. "Drop packet: incompatible batman version (%i)\n",
  469. batman_ogm_packet->version);
  470. goto err_free;
  471. }
  472. /* all receive handlers return whether they received or reused
  473. * the supplied skb. if not, we have to free the skb. */
  474. switch (batman_ogm_packet->packet_type) {
  475. /* batman originator packet */
  476. case BAT_OGM:
  477. ret = recv_bat_ogm_packet(skb, hard_iface);
  478. break;
  479. /* batman icmp packet */
  480. case BAT_ICMP:
  481. ret = recv_icmp_packet(skb, hard_iface);
  482. break;
  483. /* unicast packet */
  484. case BAT_UNICAST:
  485. ret = recv_unicast_packet(skb, hard_iface);
  486. break;
  487. /* fragmented unicast packet */
  488. case BAT_UNICAST_FRAG:
  489. ret = recv_ucast_frag_packet(skb, hard_iface);
  490. break;
  491. /* broadcast packet */
  492. case BAT_BCAST:
  493. ret = recv_bcast_packet(skb, hard_iface);
  494. break;
  495. /* vis packet */
  496. case BAT_VIS:
  497. ret = recv_vis_packet(skb, hard_iface);
  498. break;
  499. /* Translation table query (request or response) */
  500. case BAT_TT_QUERY:
  501. ret = recv_tt_query(skb, hard_iface);
  502. break;
  503. /* Roaming advertisement */
  504. case BAT_ROAM_ADV:
  505. ret = recv_roam_adv(skb, hard_iface);
  506. break;
  507. default:
  508. ret = NET_RX_DROP;
  509. }
  510. if (ret == NET_RX_DROP)
  511. kfree_skb(skb);
  512. /* return NET_RX_SUCCESS in any case as we
  513. * most probably dropped the packet for
  514. * routing-logical reasons. */
  515. return NET_RX_SUCCESS;
  516. err_free:
  517. kfree_skb(skb);
  518. err_out:
  519. return NET_RX_DROP;
  520. }
  521. /* This function returns true if the interface represented by ifindex is a
  522. * 802.11 wireless device */
  523. bool is_wifi_iface(int ifindex)
  524. {
  525. struct net_device *net_device = NULL;
  526. bool ret = false;
  527. if (ifindex == NULL_IFINDEX)
  528. goto out;
  529. net_device = dev_get_by_index(&init_net, ifindex);
  530. if (!net_device)
  531. goto out;
  532. #ifdef CONFIG_WIRELESS_EXT
  533. /* pre-cfg80211 drivers have to implement WEXT, so it is possible to
  534. * check for wireless_handlers != NULL */
  535. if (net_device->wireless_handlers)
  536. ret = true;
  537. else
  538. #endif
  539. /* cfg80211 drivers have to set ieee80211_ptr */
  540. if (net_device->ieee80211_ptr)
  541. ret = true;
  542. out:
  543. if (net_device)
  544. dev_put(net_device);
  545. return ret;
  546. }
  547. struct notifier_block hard_if_notifier = {
  548. .notifier_call = hard_if_event,
  549. };