aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/hard-interface.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2011-07-07 09:35:35 -0400
committerMarek Lindner <lindner_marek@yahoo.de>2011-08-22 09:16:20 -0400
commitbc2790808a7a3699a7c9f72f7ad225c8504824aa (patch)
treea1b0e88091facf44e0afb78d3438c55cfd6633ad /net/batman-adv/hard-interface.c
parent015758d00251a4dd9287806cdab4b9c1298f97ed (diff)
batman-adv: detect clients connected through a 802.11 device
Clients connected through a 802.11 device are now marked with the TT_CLIENT_WIFI flag. This flag is also advertised with the tt announcement. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r--net/batman-adv/hard-interface.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 0d73e1e9e3d5..bf91e4d8a47f 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -681,6 +681,36 @@ err_out:
681 return NET_RX_DROP; 681 return NET_RX_DROP;
682} 682}
683 683
684/* This function returns true if the interface represented by ifindex is a
685 * 802.11 wireless device */
686bool is_wifi_iface(int ifindex)
687{
688 struct net_device *net_device = NULL;
689 bool ret = false;
690
691 if (ifindex == NULL_IFINDEX)
692 goto out;
693
694 net_device = dev_get_by_index(&init_net, ifindex);
695 if (!net_device)
696 goto out;
697
698#ifdef CONFIG_WIRELESS_EXT
699 /* pre-cfg80211 drivers have to implement WEXT, so it is possible to
700 * check for wireless_handlers != NULL */
701 if (net_device->wireless_handlers)
702 ret = true;
703 else
704#endif
705 /* cfg80211 drivers have to set ieee80211_ptr */
706 if (net_device->ieee80211_ptr)
707 ret = true;
708out:
709 if (net_device)
710 dev_put(net_device);
711 return ret;
712}
713
684struct notifier_block hard_if_notifier = { 714struct notifier_block hard_if_notifier = {
685 .notifier_call = hard_if_event, 715 .notifier_call = hard_if_event,
686}; 716};