diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-class-net-mesh | 8 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 2 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 4 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 42 | ||||
-rw-r--r-- | net/batman-adv/translation-table.h | 1 | ||||
-rw-r--r-- | net/batman-adv/types.h | 1 |
6 files changed, 58 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-net-mesh b/Documentation/ABI/testing/sysfs-class-net-mesh index 748fe1701d25..b02001488eef 100644 --- a/Documentation/ABI/testing/sysfs-class-net-mesh +++ b/Documentation/ABI/testing/sysfs-class-net-mesh | |||
@@ -22,6 +22,14 @@ Description: | |||
22 | mesh will be fragmented or silently discarded if the | 22 | mesh will be fragmented or silently discarded if the |
23 | packet size exceeds the outgoing interface MTU. | 23 | packet size exceeds the outgoing interface MTU. |
24 | 24 | ||
25 | What: /sys/class/net/<mesh_iface>/mesh/ap_isolation | ||
26 | Date: May 2011 | ||
27 | Contact: Antonio Quartulli <ordex@autistici.org> | ||
28 | Description: | ||
29 | Indicates whether the data traffic going from a | ||
30 | wireless client to another wireless client will be | ||
31 | silently dropped. | ||
32 | |||
25 | What: /sys/class/net/<mesh_iface>/mesh/gw_bandwidth | 33 | What: /sys/class/net/<mesh_iface>/mesh/gw_bandwidth |
26 | Date: October 2010 | 34 | Date: October 2010 |
27 | Contact: Marek Lindner <lindner_marek@yahoo.de> | 35 | Contact: Marek Lindner <lindner_marek@yahoo.de> |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index cd15deba60a1..b8a7414c3571 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -380,6 +380,7 @@ static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr, | |||
380 | BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); | 380 | BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
381 | BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); | 381 | BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); |
382 | BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); | 382 | BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu); |
383 | BAT_ATTR_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL); | ||
383 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); | 384 | static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode); |
384 | static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode); | 385 | static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode); |
385 | BAT_ATTR_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); | 386 | BAT_ATTR_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL); |
@@ -396,6 +397,7 @@ static struct bat_attribute *mesh_attrs[] = { | |||
396 | &bat_attr_aggregated_ogms, | 397 | &bat_attr_aggregated_ogms, |
397 | &bat_attr_bonding, | 398 | &bat_attr_bonding, |
398 | &bat_attr_fragmentation, | 399 | &bat_attr_fragmentation, |
400 | &bat_attr_ap_isolation, | ||
399 | &bat_attr_vis_mode, | 401 | &bat_attr_vis_mode, |
400 | &bat_attr_gw_mode, | 402 | &bat_attr_gw_mode, |
401 | &bat_attr_orig_interval, | 403 | &bat_attr_orig_interval, |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 6deed44a3703..9addbab52999 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -739,6 +739,9 @@ void interface_rx(struct net_device *soft_iface, | |||
739 | 739 | ||
740 | soft_iface->last_rx = jiffies; | 740 | soft_iface->last_rx = jiffies; |
741 | 741 | ||
742 | if (is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest)) | ||
743 | goto dropped; | ||
744 | |||
742 | netif_rx(skb); | 745 | netif_rx(skb); |
743 | goto out; | 746 | goto out; |
744 | 747 | ||
@@ -812,6 +815,7 @@ struct net_device *softif_create(const char *name) | |||
812 | 815 | ||
813 | atomic_set(&bat_priv->aggregated_ogms, 1); | 816 | atomic_set(&bat_priv->aggregated_ogms, 1); |
814 | atomic_set(&bat_priv->bonding, 0); | 817 | atomic_set(&bat_priv->bonding, 0); |
818 | atomic_set(&bat_priv->ap_isolation, 0); | ||
815 | atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); | 819 | atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); |
816 | atomic_set(&bat_priv->gw_mode, GW_MODE_OFF); | 820 | atomic_set(&bat_priv->gw_mode, GW_MODE_OFF); |
817 | atomic_set(&bat_priv->gw_sel_class, 20); | 821 | atomic_set(&bat_priv->gw_sel_class, 20); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index d6305645e08d..d0ed931ad2e7 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -781,6 +781,18 @@ static void tt_global_table_free(struct bat_priv *bat_priv) | |||
781 | bat_priv->tt_global_hash = NULL; | 781 | bat_priv->tt_global_hash = NULL; |
782 | } | 782 | } |
783 | 783 | ||
784 | static bool _is_ap_isolated(struct tt_local_entry *tt_local_entry, | ||
785 | struct tt_global_entry *tt_global_entry) | ||
786 | { | ||
787 | bool ret = false; | ||
788 | |||
789 | if (tt_local_entry->flags & TT_CLIENT_WIFI && | ||
790 | tt_global_entry->flags & TT_CLIENT_WIFI) | ||
791 | ret = true; | ||
792 | |||
793 | return ret; | ||
794 | } | ||
795 | |||
784 | struct orig_node *transtable_search(struct bat_priv *bat_priv, | 796 | struct orig_node *transtable_search(struct bat_priv *bat_priv, |
785 | const uint8_t *addr) | 797 | const uint8_t *addr) |
786 | { | 798 | { |
@@ -1729,3 +1741,33 @@ void tt_commit_changes(struct bat_priv *bat_priv) | |||
1729 | atomic_inc(&bat_priv->ttvn); | 1741 | atomic_inc(&bat_priv->ttvn); |
1730 | bat_priv->tt_poss_change = false; | 1742 | bat_priv->tt_poss_change = false; |
1731 | } | 1743 | } |
1744 | |||
1745 | bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst) | ||
1746 | { | ||
1747 | struct tt_local_entry *tt_local_entry = NULL; | ||
1748 | struct tt_global_entry *tt_global_entry = NULL; | ||
1749 | bool ret = true; | ||
1750 | |||
1751 | if (!atomic_read(&bat_priv->ap_isolation)) | ||
1752 | return false; | ||
1753 | |||
1754 | tt_local_entry = tt_local_hash_find(bat_priv, dst); | ||
1755 | if (!tt_local_entry) | ||
1756 | goto out; | ||
1757 | |||
1758 | tt_global_entry = tt_global_hash_find(bat_priv, src); | ||
1759 | if (!tt_global_entry) | ||
1760 | goto out; | ||
1761 | |||
1762 | if (_is_ap_isolated(tt_local_entry, tt_global_entry)) | ||
1763 | goto out; | ||
1764 | |||
1765 | ret = false; | ||
1766 | |||
1767 | out: | ||
1768 | if (tt_global_entry) | ||
1769 | tt_global_entry_free_ref(tt_global_entry); | ||
1770 | if (tt_local_entry) | ||
1771 | tt_local_entry_free_ref(tt_local_entry); | ||
1772 | return ret; | ||
1773 | } | ||
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 4d1ca35c6818..f1d148ef0e36 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
@@ -63,5 +63,6 @@ void handle_tt_response(struct bat_priv *bat_priv, | |||
63 | void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, | 63 | void send_roam_adv(struct bat_priv *bat_priv, uint8_t *client, |
64 | struct orig_node *orig_node); | 64 | struct orig_node *orig_node); |
65 | void tt_commit_changes(struct bat_priv *bat_priv); | 65 | void tt_commit_changes(struct bat_priv *bat_priv); |
66 | bool is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src, uint8_t *dst); | ||
66 | 67 | ||
67 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ | 68 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index bd0ced8a9a9e..1ae355750511 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -146,6 +146,7 @@ struct bat_priv { | |||
146 | atomic_t aggregated_ogms; /* boolean */ | 146 | atomic_t aggregated_ogms; /* boolean */ |
147 | atomic_t bonding; /* boolean */ | 147 | atomic_t bonding; /* boolean */ |
148 | atomic_t fragmentation; /* boolean */ | 148 | atomic_t fragmentation; /* boolean */ |
149 | atomic_t ap_isolation; /* boolean */ | ||
149 | atomic_t vis_mode; /* VIS_TYPE_* */ | 150 | atomic_t vis_mode; /* VIS_TYPE_* */ |
150 | atomic_t gw_mode; /* GW_MODE_* */ | 151 | atomic_t gw_mode; /* GW_MODE_* */ |
151 | atomic_t gw_sel_class; /* uint */ | 152 | atomic_t gw_sel_class; /* uint */ |