diff options
42 files changed, 437 insertions, 311 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-net-mesh b/Documentation/ABI/testing/sysfs-class-net-mesh index 0baa657b18c4..4793d3dff6af 100644 --- a/Documentation/ABI/testing/sysfs-class-net-mesh +++ b/Documentation/ABI/testing/sysfs-class-net-mesh | |||
| @@ -68,6 +68,14 @@ Description: | |||
| 68 | Defines the penalty which will be applied to an | 68 | Defines the penalty which will be applied to an |
| 69 | originator message's tq-field on every hop. | 69 | originator message's tq-field on every hop. |
| 70 | 70 | ||
| 71 | What: /sys/class/net/<mesh_iface>/mesh/isolation_mark | ||
| 72 | Date: Nov 2013 | ||
| 73 | Contact: Antonio Quartulli <antonio@meshcoding.com> | ||
| 74 | Description: | ||
| 75 | Defines the isolation mark (and its bitmask) which | ||
| 76 | is used to classify clients as "isolated" by the | ||
| 77 | Extended Isolation feature. | ||
| 78 | |||
| 71 | What: /sys/class/net/<mesh_iface>/mesh/network_coding | 79 | What: /sys/class/net/<mesh_iface>/mesh/network_coding |
| 72 | Date: Nov 2012 | 80 | Date: Nov 2012 |
| 73 | Contact: Martin Hundeboll <martin@hundeboll.net> | 81 | Contact: Martin Hundeboll <martin@hundeboll.net> |
diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index 4f4aabbd8eab..e5954152cfe0 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile | |||
| @@ -13,9 +13,7 @@ | |||
| 13 | # General Public License for more details. | 13 | # General Public License for more details. |
| 14 | # | 14 | # |
| 15 | # You should have received a copy of the GNU General Public License | 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 | 16 | # along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 18 | # 02110-1301, USA | ||
| 19 | # | 17 | # |
| 20 | 18 | ||
| 21 | obj-$(CONFIG_BATMAN_ADV) += batman-adv.o | 19 | obj-$(CONFIG_BATMAN_ADV) += batman-adv.o |
diff --git a/net/batman-adv/bat_algo.h b/net/batman-adv/bat_algo.h index a4808c29ea3d..92435bfc7471 100644 --- a/net/batman-adv/bat_algo.h +++ b/net/batman-adv/bat_algo.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_ | 18 | #ifndef _NET_BATMAN_ADV_BAT_ALGO_H_ |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index b9c8a6eedf45..278d78bd7735 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index 973982414d58..89d3a5bcacc1 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index a81b9322e382..685e0af1fef2 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ | 18 | #ifndef _NET_BATMAN_ADV_BITARRAY_H_ |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 28eb5e6d0a02..b164a073a215 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index da173e760e77..377dae069177 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_BLA_H_ | 18 | #ifndef _NET_BATMAN_ADV_BLA_H_ |
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index 049a7a2ac5b6..0adbcee80d24 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/debugfs.h b/net/batman-adv/debugfs.h index f8c3849edff4..0861b629e1a8 100644 --- a/net/batman-adv/debugfs.h +++ b/net/batman-adv/debugfs.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_DEBUGFS_H_ | 18 | #ifndef _NET_BATMAN_ADV_DEBUGFS_H_ |
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index b316a4cb6f14..997ae6ac51ff 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include <linux/if_ether.h> | 18 | #include <linux/if_ether.h> |
| @@ -141,7 +139,7 @@ static int batadv_compare_dat(const struct hlist_node *node, const void *data2) | |||
| 141 | const void *data1 = container_of(node, struct batadv_dat_entry, | 139 | const void *data1 = container_of(node, struct batadv_dat_entry, |
| 142 | hash_entry); | 140 | hash_entry); |
| 143 | 141 | ||
| 144 | return (memcmp(data1, data2, sizeof(__be32)) == 0 ? 1 : 0); | 142 | return memcmp(data1, data2, sizeof(__be32)) == 0 ? 1 : 0; |
| 145 | } | 143 | } |
| 146 | 144 | ||
| 147 | /** | 145 | /** |
| @@ -1039,9 +1037,9 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, | |||
| 1039 | if (hdr_size == sizeof(struct batadv_unicast_4addr_packet)) | 1037 | if (hdr_size == sizeof(struct batadv_unicast_4addr_packet)) |
| 1040 | err = batadv_send_skb_via_tt_4addr(bat_priv, skb_new, | 1038 | err = batadv_send_skb_via_tt_4addr(bat_priv, skb_new, |
| 1041 | BATADV_P_DAT_CACHE_REPLY, | 1039 | BATADV_P_DAT_CACHE_REPLY, |
| 1042 | vid); | 1040 | NULL, vid); |
| 1043 | else | 1041 | else |
| 1044 | err = batadv_send_skb_via_tt(bat_priv, skb_new, vid); | 1042 | err = batadv_send_skb_via_tt(bat_priv, skb_new, NULL, vid); |
| 1045 | 1043 | ||
| 1046 | if (err != NET_XMIT_DROP) { | 1044 | if (err != NET_XMIT_DROP) { |
| 1047 | batadv_inc_counter(bat_priv, BATADV_CNT_DAT_CACHED_REPLY_TX); | 1045 | batadv_inc_counter(bat_priv, BATADV_CNT_DAT_CACHED_REPLY_TX); |
diff --git a/net/batman-adv/distributed-arp-table.h b/net/batman-adv/distributed-arp-table.h index 60d853beb8d8..afa13ca2371a 100644 --- a/net/batman-adv/distributed-arp-table.h +++ b/net/batman-adv/distributed-arp-table.h | |||
| @@ -12,13 +12,11 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_ARP_H_ | 18 | #ifndef _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_ |
| 21 | #define _NET_BATMAN_ADV_ARP_H_ | 19 | #define _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_ |
| 22 | 20 | ||
| 23 | #ifdef CONFIG_BATMAN_ADV_DAT | 21 | #ifdef CONFIG_BATMAN_ADV_DAT |
| 24 | 22 | ||
| @@ -169,4 +167,4 @@ static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv, | |||
| 169 | 167 | ||
| 170 | #endif /* CONFIG_BATMAN_ADV_DAT */ | 168 | #endif /* CONFIG_BATMAN_ADV_DAT */ |
| 171 | 169 | ||
| 172 | #endif /* _NET_BATMAN_ADV_ARP_H_ */ | 170 | #endif /* _NET_BATMAN_ADV_DISTRIBUTED_ARP_TABLE_H_ */ |
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 6ddb6145ffb5..43185ca9da17 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/fragmentation.h b/net/batman-adv/fragmentation.h index ca029e2676e7..0347f0ce0f61 100644 --- a/net/batman-adv/fragmentation.h +++ b/net/batman-adv/fragmentation.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_ | 18 | #ifndef _NET_BATMAN_ADV_FRAGMENTATION_H_ |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 2449afaa7638..4150a641c52e 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -30,11 +28,17 @@ | |||
| 30 | #include <linux/udp.h> | 28 | #include <linux/udp.h> |
| 31 | #include <linux/if_vlan.h> | 29 | #include <linux/if_vlan.h> |
| 32 | 30 | ||
| 33 | /* This is the offset of the options field in a dhcp packet starting at | 31 | /* These are the offsets of the "hw type" and "hw address length" in the dhcp |
| 34 | * the beginning of the dhcp header | 32 | * packet starting at the beginning of the dhcp header |
| 35 | */ | 33 | */ |
| 36 | #define BATADV_DHCP_OPTIONS_OFFSET 240 | 34 | #define BATADV_DHCP_HTYPE_OFFSET 1 |
| 37 | #define BATADV_DHCP_REQUEST 3 | 35 | #define BATADV_DHCP_HLEN_OFFSET 2 |
| 36 | /* Value of htype representing Ethernet */ | ||
| 37 | #define BATADV_DHCP_HTYPE_ETHERNET 0x01 | ||
| 38 | /* This is the offset of the "chaddr" field in the dhcp packet starting at the | ||
| 39 | * beginning of the dhcp header | ||
| 40 | */ | ||
| 41 | #define BATADV_DHCP_CHADDR_OFFSET 28 | ||
| 38 | 42 | ||
| 39 | static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node) | 43 | static void batadv_gw_node_free_ref(struct batadv_gw_node *gw_node) |
| 40 | { | 44 | { |
| @@ -105,7 +109,18 @@ static void batadv_gw_select(struct batadv_priv *bat_priv, | |||
| 105 | spin_unlock_bh(&bat_priv->gw.list_lock); | 109 | spin_unlock_bh(&bat_priv->gw.list_lock); |
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | void batadv_gw_deselect(struct batadv_priv *bat_priv) | 112 | /** |
| 113 | * batadv_gw_reselect - force a gateway reselection | ||
| 114 | * @bat_priv: the bat priv with all the soft interface information | ||
| 115 | * | ||
| 116 | * Set a flag to remind the GW component to perform a new gateway reselection. | ||
| 117 | * However this function does not ensure that the current gateway is going to be | ||
| 118 | * deselected. The reselection mechanism may elect the same gateway once again. | ||
| 119 | * | ||
| 120 | * This means that invoking batadv_gw_reselect() does not guarantee a gateway | ||
| 121 | * change and therefore a uevent is not necessarily expected. | ||
| 122 | */ | ||
| 123 | void batadv_gw_reselect(struct batadv_priv *bat_priv) | ||
| 109 | { | 124 | { |
| 110 | atomic_set(&bat_priv->gw.reselect, 1); | 125 | atomic_set(&bat_priv->gw.reselect, 1); |
| 111 | } | 126 | } |
| @@ -207,6 +222,11 @@ void batadv_gw_check_client_stop(struct batadv_priv *bat_priv) | |||
| 207 | if (!curr_gw) | 222 | if (!curr_gw) |
| 208 | return; | 223 | return; |
| 209 | 224 | ||
| 225 | /* deselect the current gateway so that next time that client mode is | ||
| 226 | * enabled a proper GW_ADD event can be sent | ||
| 227 | */ | ||
| 228 | batadv_gw_select(bat_priv, NULL); | ||
| 229 | |||
| 210 | /* if batman-adv is switching the gw client mode off and a gateway was | 230 | /* if batman-adv is switching the gw client mode off and a gateway was |
| 211 | * already selected, send a DEL uevent | 231 | * already selected, send a DEL uevent |
| 212 | */ | 232 | */ |
| @@ -239,7 +259,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv) | |||
| 239 | 259 | ||
| 240 | router = batadv_orig_node_get_router(next_gw->orig_node); | 260 | router = batadv_orig_node_get_router(next_gw->orig_node); |
| 241 | if (!router) { | 261 | if (!router) { |
| 242 | batadv_gw_deselect(bat_priv); | 262 | batadv_gw_reselect(bat_priv); |
| 243 | goto out; | 263 | goto out; |
| 244 | } | 264 | } |
| 245 | } | 265 | } |
| @@ -291,11 +311,11 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv, | |||
| 291 | 311 | ||
| 292 | curr_gw_orig = batadv_gw_get_selected_orig(bat_priv); | 312 | curr_gw_orig = batadv_gw_get_selected_orig(bat_priv); |
| 293 | if (!curr_gw_orig) | 313 | if (!curr_gw_orig) |
| 294 | goto deselect; | 314 | goto reselect; |
| 295 | 315 | ||
| 296 | router_gw = batadv_orig_node_get_router(curr_gw_orig); | 316 | router_gw = batadv_orig_node_get_router(curr_gw_orig); |
| 297 | if (!router_gw) | 317 | if (!router_gw) |
| 298 | goto deselect; | 318 | goto reselect; |
| 299 | 319 | ||
| 300 | /* this node already is the gateway */ | 320 | /* this node already is the gateway */ |
| 301 | if (curr_gw_orig == orig_node) | 321 | if (curr_gw_orig == orig_node) |
| @@ -323,8 +343,8 @@ void batadv_gw_check_election(struct batadv_priv *bat_priv, | |||
| 323 | "Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n", | 343 | "Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n", |
| 324 | gw_tq_avg, orig_tq_avg); | 344 | gw_tq_avg, orig_tq_avg); |
| 325 | 345 | ||
| 326 | deselect: | 346 | reselect: |
| 327 | batadv_gw_deselect(bat_priv); | 347 | batadv_gw_reselect(bat_priv); |
| 328 | out: | 348 | out: |
| 329 | if (curr_gw_orig) | 349 | if (curr_gw_orig) |
| 330 | batadv_orig_node_free_ref(curr_gw_orig); | 350 | batadv_orig_node_free_ref(curr_gw_orig); |
| @@ -454,7 +474,7 @@ void batadv_gw_node_update(struct batadv_priv *bat_priv, | |||
| 454 | */ | 474 | */ |
| 455 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); | 475 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
| 456 | if (gw_node == curr_gw) | 476 | if (gw_node == curr_gw) |
| 457 | batadv_gw_deselect(bat_priv); | 477 | batadv_gw_reselect(bat_priv); |
| 458 | } | 478 | } |
| 459 | 479 | ||
| 460 | out: | 480 | out: |
| @@ -480,7 +500,7 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv) | |||
| 480 | struct batadv_gw_node *gw_node, *curr_gw; | 500 | struct batadv_gw_node *gw_node, *curr_gw; |
| 481 | struct hlist_node *node_tmp; | 501 | struct hlist_node *node_tmp; |
| 482 | unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT); | 502 | unsigned long timeout = msecs_to_jiffies(2 * BATADV_PURGE_TIMEOUT); |
| 483 | int do_deselect = 0; | 503 | int do_reselect = 0; |
| 484 | 504 | ||
| 485 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); | 505 | curr_gw = batadv_gw_get_selected_gw_node(bat_priv); |
| 486 | 506 | ||
| @@ -494,7 +514,7 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv) | |||
| 494 | continue; | 514 | continue; |
| 495 | 515 | ||
| 496 | if (curr_gw == gw_node) | 516 | if (curr_gw == gw_node) |
| 497 | do_deselect = 1; | 517 | do_reselect = 1; |
| 498 | 518 | ||
| 499 | hlist_del_rcu(&gw_node->list); | 519 | hlist_del_rcu(&gw_node->list); |
| 500 | batadv_gw_node_free_ref(gw_node); | 520 | batadv_gw_node_free_ref(gw_node); |
| @@ -502,9 +522,9 @@ void batadv_gw_node_purge(struct batadv_priv *bat_priv) | |||
| 502 | 522 | ||
| 503 | spin_unlock_bh(&bat_priv->gw.list_lock); | 523 | spin_unlock_bh(&bat_priv->gw.list_lock); |
| 504 | 524 | ||
| 505 | /* gw_deselect() needs to acquire the gw_list_lock */ | 525 | /* gw_reselect() needs to acquire the gw_list_lock */ |
| 506 | if (do_deselect) | 526 | if (do_reselect) |
| 507 | batadv_gw_deselect(bat_priv); | 527 | batadv_gw_reselect(bat_priv); |
| 508 | 528 | ||
| 509 | if (curr_gw) | 529 | if (curr_gw) |
| 510 | batadv_gw_node_free_ref(curr_gw); | 530 | batadv_gw_node_free_ref(curr_gw); |
| @@ -582,80 +602,39 @@ out: | |||
| 582 | return 0; | 602 | return 0; |
| 583 | } | 603 | } |
| 584 | 604 | ||
| 585 | /* this call might reallocate skb data */ | 605 | /** |
| 586 | static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) | 606 | * batadv_gw_dhcp_recipient_get - check if a packet is a DHCP message |
| 587 | { | 607 | * @skb: the packet to check |
| 588 | int ret = false; | 608 | * @header_len: a pointer to the batman-adv header size |
| 589 | unsigned char *p; | 609 | * @chaddr: buffer where the client address will be stored. Valid |
| 590 | int pkt_len; | 610 | * only if the function returns BATADV_DHCP_TO_CLIENT |
| 591 | 611 | * | |
| 592 | if (skb_linearize(skb) < 0) | 612 | * Returns: |
| 593 | goto out; | 613 | * - BATADV_DHCP_NO if the packet is not a dhcp message or if there was an error |
| 594 | 614 | * while parsing it | |
| 595 | pkt_len = skb_headlen(skb); | 615 | * - BATADV_DHCP_TO_SERVER if this is a message going to the DHCP server |
| 596 | 616 | * - BATADV_DHCP_TO_CLIENT if this is a message going to a DHCP client | |
| 597 | if (pkt_len < header_len + BATADV_DHCP_OPTIONS_OFFSET + 1) | 617 | * |
| 598 | goto out; | 618 | * This function may re-allocate the data buffer of the skb passed as argument. |
| 599 | 619 | */ | |
| 600 | p = skb->data + header_len + BATADV_DHCP_OPTIONS_OFFSET; | 620 | enum batadv_dhcp_recipient |
| 601 | pkt_len -= header_len + BATADV_DHCP_OPTIONS_OFFSET + 1; | 621 | batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, |
| 602 | 622 | uint8_t *chaddr) | |
| 603 | /* Access the dhcp option lists. Each entry is made up by: | ||
| 604 | * - octet 1: option type | ||
| 605 | * - octet 2: option data len (only if type != 255 and 0) | ||
| 606 | * - octet 3: option data | ||
| 607 | */ | ||
| 608 | while (*p != 255 && !ret) { | ||
| 609 | /* p now points to the first octet: option type */ | ||
| 610 | if (*p == 53) { | ||
| 611 | /* type 53 is the message type option. | ||
| 612 | * Jump the len octet and go to the data octet | ||
| 613 | */ | ||
| 614 | if (pkt_len < 2) | ||
| 615 | goto out; | ||
| 616 | p += 2; | ||
| 617 | |||
| 618 | /* check if the message type is what we need */ | ||
| 619 | if (*p == BATADV_DHCP_REQUEST) | ||
| 620 | ret = true; | ||
| 621 | break; | ||
| 622 | } else if (*p == 0) { | ||
| 623 | /* option type 0 (padding), just go forward */ | ||
| 624 | if (pkt_len < 1) | ||
| 625 | goto out; | ||
| 626 | pkt_len--; | ||
| 627 | p++; | ||
| 628 | } else { | ||
| 629 | /* This is any other option. So we get the length... */ | ||
| 630 | if (pkt_len < 1) | ||
| 631 | goto out; | ||
| 632 | pkt_len--; | ||
| 633 | p++; | ||
| 634 | |||
| 635 | /* ...and then we jump over the data */ | ||
| 636 | if (pkt_len < 1 + (*p)) | ||
| 637 | goto out; | ||
| 638 | pkt_len -= 1 + (*p); | ||
| 639 | p += 1 + (*p); | ||
| 640 | } | ||
| 641 | } | ||
| 642 | out: | ||
| 643 | return ret; | ||
| 644 | } | ||
| 645 | |||
| 646 | /* this call might reallocate skb data */ | ||
| 647 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | ||
| 648 | { | 623 | { |
| 624 | enum batadv_dhcp_recipient ret = BATADV_DHCP_NO; | ||
| 649 | struct ethhdr *ethhdr; | 625 | struct ethhdr *ethhdr; |
| 650 | struct iphdr *iphdr; | 626 | struct iphdr *iphdr; |
| 651 | struct ipv6hdr *ipv6hdr; | 627 | struct ipv6hdr *ipv6hdr; |
| 652 | struct udphdr *udphdr; | 628 | struct udphdr *udphdr; |
| 653 | struct vlan_ethhdr *vhdr; | 629 | struct vlan_ethhdr *vhdr; |
| 630 | int chaddr_offset; | ||
| 654 | __be16 proto; | 631 | __be16 proto; |
| 632 | uint8_t *p; | ||
| 655 | 633 | ||
| 656 | /* check for ethernet header */ | 634 | /* check for ethernet header */ |
| 657 | if (!pskb_may_pull(skb, *header_len + ETH_HLEN)) | 635 | if (!pskb_may_pull(skb, *header_len + ETH_HLEN)) |
| 658 | return false; | 636 | return BATADV_DHCP_NO; |
| 637 | |||
| 659 | ethhdr = (struct ethhdr *)skb->data; | 638 | ethhdr = (struct ethhdr *)skb->data; |
| 660 | proto = ethhdr->h_proto; | 639 | proto = ethhdr->h_proto; |
| 661 | *header_len += ETH_HLEN; | 640 | *header_len += ETH_HLEN; |
| @@ -663,7 +642,7 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 663 | /* check for initial vlan header */ | 642 | /* check for initial vlan header */ |
| 664 | if (proto == htons(ETH_P_8021Q)) { | 643 | if (proto == htons(ETH_P_8021Q)) { |
| 665 | if (!pskb_may_pull(skb, *header_len + VLAN_HLEN)) | 644 | if (!pskb_may_pull(skb, *header_len + VLAN_HLEN)) |
| 666 | return false; | 645 | return BATADV_DHCP_NO; |
| 667 | 646 | ||
| 668 | vhdr = (struct vlan_ethhdr *)skb->data; | 647 | vhdr = (struct vlan_ethhdr *)skb->data; |
| 669 | proto = vhdr->h_vlan_encapsulated_proto; | 648 | proto = vhdr->h_vlan_encapsulated_proto; |
| @@ -674,32 +653,34 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 674 | switch (proto) { | 653 | switch (proto) { |
| 675 | case htons(ETH_P_IP): | 654 | case htons(ETH_P_IP): |
| 676 | if (!pskb_may_pull(skb, *header_len + sizeof(*iphdr))) | 655 | if (!pskb_may_pull(skb, *header_len + sizeof(*iphdr))) |
| 677 | return false; | 656 | return BATADV_DHCP_NO; |
| 657 | |||
| 678 | iphdr = (struct iphdr *)(skb->data + *header_len); | 658 | iphdr = (struct iphdr *)(skb->data + *header_len); |
| 679 | *header_len += iphdr->ihl * 4; | 659 | *header_len += iphdr->ihl * 4; |
| 680 | 660 | ||
| 681 | /* check for udp header */ | 661 | /* check for udp header */ |
| 682 | if (iphdr->protocol != IPPROTO_UDP) | 662 | if (iphdr->protocol != IPPROTO_UDP) |
| 683 | return false; | 663 | return BATADV_DHCP_NO; |
| 684 | 664 | ||
| 685 | break; | 665 | break; |
| 686 | case htons(ETH_P_IPV6): | 666 | case htons(ETH_P_IPV6): |
| 687 | if (!pskb_may_pull(skb, *header_len + sizeof(*ipv6hdr))) | 667 | if (!pskb_may_pull(skb, *header_len + sizeof(*ipv6hdr))) |
| 688 | return false; | 668 | return BATADV_DHCP_NO; |
| 669 | |||
| 689 | ipv6hdr = (struct ipv6hdr *)(skb->data + *header_len); | 670 | ipv6hdr = (struct ipv6hdr *)(skb->data + *header_len); |
| 690 | *header_len += sizeof(*ipv6hdr); | 671 | *header_len += sizeof(*ipv6hdr); |
| 691 | 672 | ||
| 692 | /* check for udp header */ | 673 | /* check for udp header */ |
| 693 | if (ipv6hdr->nexthdr != IPPROTO_UDP) | 674 | if (ipv6hdr->nexthdr != IPPROTO_UDP) |
| 694 | return false; | 675 | return BATADV_DHCP_NO; |
| 695 | 676 | ||
| 696 | break; | 677 | break; |
| 697 | default: | 678 | default: |
| 698 | return false; | 679 | return BATADV_DHCP_NO; |
| 699 | } | 680 | } |
| 700 | 681 | ||
| 701 | if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) | 682 | if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) |
| 702 | return false; | 683 | return BATADV_DHCP_NO; |
| 703 | 684 | ||
| 704 | /* skb->data might have been reallocated by pskb_may_pull() */ | 685 | /* skb->data might have been reallocated by pskb_may_pull() */ |
| 705 | ethhdr = (struct ethhdr *)skb->data; | 686 | ethhdr = (struct ethhdr *)skb->data; |
| @@ -710,17 +691,40 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 710 | *header_len += sizeof(*udphdr); | 691 | *header_len += sizeof(*udphdr); |
| 711 | 692 | ||
| 712 | /* check for bootp port */ | 693 | /* check for bootp port */ |
| 713 | if ((proto == htons(ETH_P_IP)) && | 694 | switch (proto) { |
| 714 | (udphdr->dest != htons(67))) | 695 | case htons(ETH_P_IP): |
| 715 | return false; | 696 | if (udphdr->dest == htons(67)) |
| 697 | ret = BATADV_DHCP_TO_SERVER; | ||
| 698 | else if (udphdr->source == htons(67)) | ||
| 699 | ret = BATADV_DHCP_TO_CLIENT; | ||
| 700 | break; | ||
| 701 | case htons(ETH_P_IPV6): | ||
| 702 | if (udphdr->dest == htons(547)) | ||
| 703 | ret = BATADV_DHCP_TO_SERVER; | ||
| 704 | else if (udphdr->source == htons(547)) | ||
| 705 | ret = BATADV_DHCP_TO_CLIENT; | ||
| 706 | break; | ||
| 707 | } | ||
| 716 | 708 | ||
| 717 | if ((proto == htons(ETH_P_IPV6)) && | 709 | chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET; |
| 718 | (udphdr->dest != htons(547))) | 710 | /* store the client address if the message is going to a client */ |
| 719 | return false; | 711 | if (ret == BATADV_DHCP_TO_CLIENT && |
| 712 | pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) { | ||
| 713 | /* check if the DHCP packet carries an Ethernet DHCP */ | ||
| 714 | p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET; | ||
| 715 | if (*p != BATADV_DHCP_HTYPE_ETHERNET) | ||
| 716 | return BATADV_DHCP_NO; | ||
| 717 | |||
| 718 | /* check if the DHCP packet carries a valid Ethernet address */ | ||
| 719 | p = skb->data + *header_len + BATADV_DHCP_HLEN_OFFSET; | ||
| 720 | if (*p != ETH_ALEN) | ||
| 721 | return BATADV_DHCP_NO; | ||
| 722 | |||
| 723 | memcpy(chaddr, skb->data + chaddr_offset, ETH_ALEN); | ||
| 724 | } | ||
| 720 | 725 | ||
| 721 | return true; | 726 | return ret; |
| 722 | } | 727 | } |
| 723 | |||
| 724 | /** | 728 | /** |
| 725 | * batadv_gw_out_of_range - check if the dhcp request destination is the best gw | 729 | * batadv_gw_out_of_range - check if the dhcp request destination is the best gw |
| 726 | * @bat_priv: the bat priv with all the soft interface information | 730 | * @bat_priv: the bat priv with all the soft interface information |
| @@ -734,6 +738,7 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 734 | * false otherwise. | 738 | * false otherwise. |
| 735 | * | 739 | * |
| 736 | * This call might reallocate skb data. | 740 | * This call might reallocate skb data. |
| 741 | * Must be invoked only when the DHCP packet is going TO a DHCP SERVER. | ||
| 737 | */ | 742 | */ |
| 738 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | 743 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, |
| 739 | struct sk_buff *skb) | 744 | struct sk_buff *skb) |
| @@ -741,19 +746,13 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | |||
| 741 | struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; | 746 | struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; |
| 742 | struct batadv_orig_node *orig_dst_node = NULL; | 747 | struct batadv_orig_node *orig_dst_node = NULL; |
| 743 | struct batadv_gw_node *gw_node = NULL, *curr_gw = NULL; | 748 | struct batadv_gw_node *gw_node = NULL, *curr_gw = NULL; |
| 744 | struct ethhdr *ethhdr; | 749 | struct ethhdr *ethhdr = (struct ethhdr *)skb->data; |
| 745 | bool ret, out_of_range = false; | 750 | bool out_of_range = false; |
| 746 | unsigned int header_len = 0; | ||
| 747 | uint8_t curr_tq_avg; | 751 | uint8_t curr_tq_avg; |
| 748 | unsigned short vid; | 752 | unsigned short vid; |
| 749 | 753 | ||
| 750 | vid = batadv_get_vid(skb, 0); | 754 | vid = batadv_get_vid(skb, 0); |
| 751 | 755 | ||
| 752 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | ||
| 753 | if (!ret) | ||
| 754 | goto out; | ||
| 755 | |||
| 756 | ethhdr = (struct ethhdr *)skb->data; | ||
| 757 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, | 756 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, |
| 758 | ethhdr->h_dest, vid); | 757 | ethhdr->h_dest, vid); |
| 759 | if (!orig_dst_node) | 758 | if (!orig_dst_node) |
| @@ -763,10 +762,6 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | |||
| 763 | if (!gw_node->bandwidth_down == 0) | 762 | if (!gw_node->bandwidth_down == 0) |
| 764 | goto out; | 763 | goto out; |
| 765 | 764 | ||
| 766 | ret = batadv_is_type_dhcprequest(skb, header_len); | ||
| 767 | if (!ret) | ||
| 768 | goto out; | ||
| 769 | |||
| 770 | switch (atomic_read(&bat_priv->gw_mode)) { | 765 | switch (atomic_read(&bat_priv->gw_mode)) { |
| 771 | case BATADV_GW_MODE_SERVER: | 766 | case BATADV_GW_MODE_SERVER: |
| 772 | /* If we are a GW then we are our best GW. We can artificially | 767 | /* If we are a GW then we are our best GW. We can artificially |
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h index d95c2d23195e..006befb8c7b8 100644 --- a/net/batman-adv/gateway_client.h +++ b/net/batman-adv/gateway_client.h | |||
| @@ -12,16 +12,14 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ | 18 | #ifndef _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ |
| 21 | #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ | 19 | #define _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ |
| 22 | 20 | ||
| 23 | void batadv_gw_check_client_stop(struct batadv_priv *bat_priv); | 21 | void batadv_gw_check_client_stop(struct batadv_priv *bat_priv); |
| 24 | void batadv_gw_deselect(struct batadv_priv *bat_priv); | 22 | void batadv_gw_reselect(struct batadv_priv *bat_priv); |
| 25 | void batadv_gw_election(struct batadv_priv *bat_priv); | 23 | void batadv_gw_election(struct batadv_priv *bat_priv); |
| 26 | struct batadv_orig_node * | 24 | struct batadv_orig_node * |
| 27 | batadv_gw_get_selected_orig(struct batadv_priv *bat_priv); | 25 | batadv_gw_get_selected_orig(struct batadv_priv *bat_priv); |
| @@ -34,7 +32,9 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv, | |||
| 34 | struct batadv_orig_node *orig_node); | 32 | struct batadv_orig_node *orig_node); |
| 35 | void batadv_gw_node_purge(struct batadv_priv *bat_priv); | 33 | void batadv_gw_node_purge(struct batadv_priv *bat_priv); |
| 36 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); | 34 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); |
| 37 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); | ||
| 38 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb); | 35 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb); |
| 36 | enum batadv_dhcp_recipient | ||
| 37 | batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, | ||
| 38 | uint8_t *chaddr); | ||
| 39 | 39 | ||
| 40 | #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ | 40 | #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ |
diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index b211b0f9cb78..f76816ce9faf 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -164,7 +162,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, | |||
| 164 | if ((down_curr == down_new) && (up_curr == up_new)) | 162 | if ((down_curr == down_new) && (up_curr == up_new)) |
| 165 | return count; | 163 | return count; |
| 166 | 164 | ||
| 167 | batadv_gw_deselect(bat_priv); | 165 | batadv_gw_reselect(bat_priv); |
| 168 | batadv_info(net_dev, | 166 | batadv_info(net_dev, |
| 169 | "Changing gateway bandwidth from: '%u.%u/%u.%u MBit' to: '%u.%u/%u.%u MBit'\n", | 167 | "Changing gateway bandwidth from: '%u.%u/%u.%u MBit' to: '%u.%u/%u.%u MBit'\n", |
| 170 | down_curr / 10, down_curr % 10, up_curr / 10, up_curr % 10, | 168 | down_curr / 10, down_curr % 10, up_curr / 10, up_curr % 10, |
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h index 56384a4cd18c..c47b17a0a6b6 100644 --- a/net/batman-adv/gateway_common.h +++ b/net/batman-adv/gateway_common.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_ | 18 | #ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_ |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 57c2a19dcb5c..bebd46ce0ebd 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index df4c8bd45c40..d8ca8ac829c1 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ | 18 | #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ |
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index 7198dafd3bf3..d9cfa03b9e12 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 1b4da72f2093..df5ece96ac12 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_HASH_H_ | 18 | #ifndef _NET_BATMAN_ADV_HASH_H_ |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 130cc3217e2b..3c08eee1b920 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/icmp_socket.h b/net/batman-adv/icmp_socket.h index 6665080dff79..559e54ad64a2 100644 --- a/net/batman-adv/icmp_socket.h +++ b/net/batman-adv/icmp_socket.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_ | 18 | #ifndef _NET_BATMAN_ADV_ICMP_SOCKET_H_ |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 1511f64a6cea..945e441b579d 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include <linux/crc32c.h> | 18 | #include <linux/crc32c.h> |
| @@ -1173,6 +1171,32 @@ unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len) | |||
| 1173 | return vid; | 1171 | return vid; |
| 1174 | } | 1172 | } |
| 1175 | 1173 | ||
| 1174 | /** | ||
| 1175 | * batadv_vlan_ap_isola_get - return the AP isolation status for the given vlan | ||
| 1176 | * @bat_priv: the bat priv with all the soft interface information | ||
| 1177 | * @vid: the VLAN identifier for which the AP isolation attributed as to be | ||
| 1178 | * looked up | ||
| 1179 | * | ||
| 1180 | * Returns true if AP isolation is on for the VLAN idenfied by vid, false | ||
| 1181 | * otherwise | ||
| 1182 | */ | ||
| 1183 | bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid) | ||
| 1184 | { | ||
| 1185 | bool ap_isolation_enabled = false; | ||
| 1186 | struct batadv_softif_vlan *vlan; | ||
| 1187 | |||
| 1188 | /* if the AP isolation is requested on a VLAN, then check for its | ||
| 1189 | * setting in the proper VLAN private data structure | ||
| 1190 | */ | ||
| 1191 | vlan = batadv_softif_vlan_get(bat_priv, vid); | ||
| 1192 | if (vlan) { | ||
| 1193 | ap_isolation_enabled = atomic_read(&vlan->ap_isolation); | ||
| 1194 | batadv_softif_vlan_free_ref(vlan); | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | return ap_isolation_enabled; | ||
| 1198 | } | ||
| 1199 | |||
| 1176 | static int batadv_param_set_ra(const char *val, const struct kernel_param *kp) | 1200 | static int batadv_param_set_ra(const char *val, const struct kernel_param *kp) |
| 1177 | { | 1201 | { |
| 1178 | struct batadv_algo_ops *bat_algo_ops; | 1202 | struct batadv_algo_ops *bat_algo_ops; |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 322dd7323732..a468760b11ea 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_MAIN_H_ | 18 | #ifndef _NET_BATMAN_ADV_MAIN_H_ |
| @@ -72,6 +70,8 @@ | |||
| 72 | 70 | ||
| 73 | #define BATADV_NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */ | 71 | #define BATADV_NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */ |
| 74 | 72 | ||
| 73 | #define BATADV_NO_MARK 0 | ||
| 74 | |||
| 75 | #define BATADV_NUM_WORDS BITS_TO_LONGS(BATADV_TQ_LOCAL_WINDOW_SIZE) | 75 | #define BATADV_NUM_WORDS BITS_TO_LONGS(BATADV_TQ_LOCAL_WINDOW_SIZE) |
| 76 | 76 | ||
| 77 | #define BATADV_LOG_BUF_LEN 8192 /* has to be a power of 2 */ | 77 | #define BATADV_LOG_BUF_LEN 8192 /* has to be a power of 2 */ |
| @@ -369,5 +369,6 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src, | |||
| 369 | uint8_t *dst, uint8_t type, uint8_t version, | 369 | uint8_t *dst, uint8_t type, uint8_t version, |
| 370 | void *tvlv_value, uint16_t tvlv_value_len); | 370 | void *tvlv_value, uint16_t tvlv_value_len); |
| 371 | unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len); | 371 | unsigned short batadv_get_vid(struct sk_buff *skb, size_t header_len); |
| 372 | bool batadv_vlan_ap_isola_get(struct batadv_priv *bat_priv, unsigned short vid); | ||
| 372 | 373 | ||
| 373 | #endif /* _NET_BATMAN_ADV_MAIN_H_ */ | 374 | #endif /* _NET_BATMAN_ADV_MAIN_H_ */ |
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index 511d7e1eea38..d6f0be346a3d 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include <linux/debugfs.h> | 18 | #include <linux/debugfs.h> |
diff --git a/net/batman-adv/network-coding.h b/net/batman-adv/network-coding.h index d4fd315b5261..ab59b3d7cf0f 100644 --- a/net/batman-adv/network-coding.h +++ b/net/batman-adv/network-coding.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_ | 18 | #ifndef _NET_BATMAN_ADV_NETWORK_CODING_H_ |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 803ab4be40c2..04a6d51f1d58 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 6f77d808a916..99ed3c61e4f9 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_ | 18 | #ifndef _NET_BATMAN_ADV_ORIGINATOR_H_ |
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h index 2dd8f2422550..ef2010c27146 100644 --- a/net/batman-adv/packet.h +++ b/net/batman-adv/packet.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_PACKET_H_ | 18 | #ifndef _NET_BATMAN_ADV_PACKET_H_ |
| @@ -117,6 +115,7 @@ enum batadv_tt_client_flags { | |||
| 117 | BATADV_TT_CLIENT_DEL = BIT(0), | 115 | BATADV_TT_CLIENT_DEL = BIT(0), |
| 118 | BATADV_TT_CLIENT_ROAM = BIT(1), | 116 | BATADV_TT_CLIENT_ROAM = BIT(1), |
| 119 | BATADV_TT_CLIENT_WIFI = BIT(4), | 117 | BATADV_TT_CLIENT_WIFI = BIT(4), |
| 118 | BATADV_TT_CLIENT_ISOLA = BIT(5), | ||
| 120 | BATADV_TT_CLIENT_NOPURGE = BIT(8), | 119 | BATADV_TT_CLIENT_NOPURGE = BIT(8), |
| 121 | BATADV_TT_CLIENT_NEW = BIT(9), | 120 | BATADV_TT_CLIENT_NEW = BIT(9), |
| 122 | BATADV_TT_CLIENT_PENDING = BIT(10), | 121 | BATADV_TT_CLIENT_PENDING = BIT(10), |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 46278bfb8fdb..7e8aa177eb1d 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -1135,6 +1133,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
| 1135 | int hdr_size = sizeof(*bcast_packet); | 1133 | int hdr_size = sizeof(*bcast_packet); |
| 1136 | int ret = NET_RX_DROP; | 1134 | int ret = NET_RX_DROP; |
| 1137 | int32_t seq_diff; | 1135 | int32_t seq_diff; |
| 1136 | uint32_t seqno; | ||
| 1138 | 1137 | ||
| 1139 | /* drop packet if it has not necessary minimum size */ | 1138 | /* drop packet if it has not necessary minimum size */ |
| 1140 | if (unlikely(!pskb_may_pull(skb, hdr_size))) | 1139 | if (unlikely(!pskb_may_pull(skb, hdr_size))) |
| @@ -1170,12 +1169,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
| 1170 | 1169 | ||
| 1171 | spin_lock_bh(&orig_node->bcast_seqno_lock); | 1170 | spin_lock_bh(&orig_node->bcast_seqno_lock); |
| 1172 | 1171 | ||
| 1172 | seqno = ntohl(bcast_packet->seqno); | ||
| 1173 | /* check whether the packet is a duplicate */ | 1173 | /* check whether the packet is a duplicate */ |
| 1174 | if (batadv_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno, | 1174 | if (batadv_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno, |
| 1175 | ntohl(bcast_packet->seqno))) | 1175 | seqno)) |
| 1176 | goto spin_unlock; | 1176 | goto spin_unlock; |
| 1177 | 1177 | ||
| 1178 | seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno; | 1178 | seq_diff = seqno - orig_node->last_bcast_seqno; |
| 1179 | 1179 | ||
| 1180 | /* check whether the packet is old and the host just restarted. */ | 1180 | /* check whether the packet is old and the host just restarted. */ |
| 1181 | if (batadv_window_protected(bat_priv, seq_diff, | 1181 | if (batadv_window_protected(bat_priv, seq_diff, |
| @@ -1186,7 +1186,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
| 1186 | * if required. | 1186 | * if required. |
| 1187 | */ | 1187 | */ |
| 1188 | if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1)) | 1188 | if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1)) |
| 1189 | orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno); | 1189 | orig_node->last_bcast_seqno = seqno; |
| 1190 | 1190 | ||
| 1191 | spin_unlock_bh(&orig_node->bcast_seqno_lock); | 1191 | spin_unlock_bh(&orig_node->bcast_seqno_lock); |
| 1192 | 1192 | ||
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index 19544ddb81b5..c1eadfa67945 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ | 18 | #ifndef _NET_BATMAN_ADV_ROUTING_H_ |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index fba4dcfcfac2..30d12c445ea3 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -321,13 +319,23 @@ out: | |||
| 321 | */ | 319 | */ |
| 322 | int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, | 320 | int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, |
| 323 | struct sk_buff *skb, int packet_type, | 321 | struct sk_buff *skb, int packet_type, |
| 324 | int packet_subtype, unsigned short vid) | 322 | int packet_subtype, uint8_t *dst_hint, |
| 323 | unsigned short vid) | ||
| 325 | { | 324 | { |
| 326 | struct ethhdr *ethhdr = (struct ethhdr *)skb->data; | 325 | struct ethhdr *ethhdr = (struct ethhdr *)skb->data; |
| 327 | struct batadv_orig_node *orig_node; | 326 | struct batadv_orig_node *orig_node; |
| 327 | uint8_t *src, *dst; | ||
| 328 | |||
| 329 | src = ethhdr->h_source; | ||
| 330 | dst = ethhdr->h_dest; | ||
| 331 | |||
| 332 | /* if we got an hint! let's send the packet to this client (if any) */ | ||
| 333 | if (dst_hint) { | ||
| 334 | src = NULL; | ||
| 335 | dst = dst_hint; | ||
| 336 | } | ||
| 337 | orig_node = batadv_transtable_search(bat_priv, src, dst, vid); | ||
| 328 | 338 | ||
| 329 | orig_node = batadv_transtable_search(bat_priv, ethhdr->h_source, | ||
| 330 | ethhdr->h_dest, vid); | ||
| 331 | return batadv_send_skb_unicast(bat_priv, skb, packet_type, | 339 | return batadv_send_skb_unicast(bat_priv, skb, packet_type, |
| 332 | packet_subtype, orig_node, vid); | 340 | packet_subtype, orig_node, vid); |
| 333 | } | 341 | } |
diff --git a/net/batman-adv/send.h b/net/batman-adv/send.h index aa2e2537a739..0b17f8d56f2e 100644 --- a/net/batman-adv/send.h +++ b/net/batman-adv/send.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_SEND_H_ | 18 | #ifndef _NET_BATMAN_ADV_SEND_H_ |
| @@ -40,7 +38,8 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv, | |||
| 40 | int packet_subtype); | 38 | int packet_subtype); |
| 41 | int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, | 39 | int batadv_send_skb_via_tt_generic(struct batadv_priv *bat_priv, |
| 42 | struct sk_buff *skb, int packet_type, | 40 | struct sk_buff *skb, int packet_type, |
| 43 | int packet_subtype, unsigned short vid); | 41 | int packet_subtype, uint8_t *dst_hint, |
| 42 | unsigned short vid); | ||
| 44 | int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, | 43 | int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 45 | unsigned short vid); | 44 | unsigned short vid); |
| 46 | 45 | ||
| @@ -57,11 +56,11 @@ int batadv_send_skb_via_gw(struct batadv_priv *bat_priv, struct sk_buff *skb, | |||
| 57 | * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. | 56 | * Returns NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise. |
| 58 | */ | 57 | */ |
| 59 | static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, | 58 | static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, |
| 60 | struct sk_buff *skb, | 59 | struct sk_buff *skb, uint8_t *dst_hint, |
| 61 | unsigned short vid) | 60 | unsigned short vid) |
| 62 | { | 61 | { |
| 63 | return batadv_send_skb_via_tt_generic(bat_priv, skb, BATADV_UNICAST, 0, | 62 | return batadv_send_skb_via_tt_generic(bat_priv, skb, BATADV_UNICAST, 0, |
| 64 | vid); | 63 | dst_hint, vid); |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | /** | 66 | /** |
| @@ -81,11 +80,12 @@ static inline int batadv_send_skb_via_tt(struct batadv_priv *bat_priv, | |||
| 81 | static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv, | 80 | static inline int batadv_send_skb_via_tt_4addr(struct batadv_priv *bat_priv, |
| 82 | struct sk_buff *skb, | 81 | struct sk_buff *skb, |
| 83 | int packet_subtype, | 82 | int packet_subtype, |
| 83 | uint8_t *dst_hint, | ||
| 84 | unsigned short vid) | 84 | unsigned short vid) |
| 85 | { | 85 | { |
| 86 | return batadv_send_skb_via_tt_generic(bat_priv, skb, | 86 | return batadv_send_skb_via_tt_generic(bat_priv, skb, |
| 87 | BATADV_UNICAST_4ADDR, | 87 | BATADV_UNICAST_4ADDR, |
| 88 | packet_subtype, vid); | 88 | packet_subtype, dst_hint, vid); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | #endif /* _NET_BATMAN_ADV_SEND_H_ */ | 91 | #endif /* _NET_BATMAN_ADV_SEND_H_ */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index a8f99d1486c0..c50f64337f55 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -121,7 +119,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p) | |||
| 121 | batadv_tt_local_remove(bat_priv, old_addr, BATADV_NO_FLAGS, | 119 | batadv_tt_local_remove(bat_priv, old_addr, BATADV_NO_FLAGS, |
| 122 | "mac address changed", false); | 120 | "mac address changed", false); |
| 123 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NO_FLAGS, | 121 | batadv_tt_local_add(dev, addr->sa_data, BATADV_NO_FLAGS, |
| 124 | BATADV_NULL_IFINDEX); | 122 | BATADV_NULL_IFINDEX, BATADV_NO_MARK); |
| 125 | } | 123 | } |
| 126 | 124 | ||
| 127 | return 0; | 125 | return 0; |
| @@ -162,6 +160,8 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 162 | 0x00, 0x00}; | 160 | 0x00, 0x00}; |
| 163 | static const uint8_t ectp_addr[ETH_ALEN] = {0xCF, 0x00, 0x00, 0x00, | 161 | static const uint8_t ectp_addr[ETH_ALEN] = {0xCF, 0x00, 0x00, 0x00, |
| 164 | 0x00, 0x00}; | 162 | 0x00, 0x00}; |
| 163 | enum batadv_dhcp_recipient dhcp_rcp = BATADV_DHCP_NO; | ||
| 164 | uint8_t *dst_hint = NULL, chaddr[ETH_ALEN]; | ||
| 165 | struct vlan_ethhdr *vhdr; | 165 | struct vlan_ethhdr *vhdr; |
| 166 | unsigned int header_len = 0; | 166 | unsigned int header_len = 0; |
| 167 | int data_len = skb->len, ret; | 167 | int data_len = skb->len, ret; |
| @@ -169,6 +169,7 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 169 | bool do_bcast = false, client_added; | 169 | bool do_bcast = false, client_added; |
| 170 | unsigned short vid; | 170 | unsigned short vid; |
| 171 | uint32_t seqno; | 171 | uint32_t seqno; |
| 172 | int gw_mode; | ||
| 172 | 173 | ||
| 173 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) | 174 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) |
| 174 | goto dropped; | 175 | goto dropped; |
| @@ -198,7 +199,8 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 198 | /* Register the client MAC in the transtable */ | 199 | /* Register the client MAC in the transtable */ |
| 199 | if (!is_multicast_ether_addr(ethhdr->h_source)) { | 200 | if (!is_multicast_ether_addr(ethhdr->h_source)) { |
| 200 | client_added = batadv_tt_local_add(soft_iface, ethhdr->h_source, | 201 | client_added = batadv_tt_local_add(soft_iface, ethhdr->h_source, |
| 201 | vid, skb->skb_iif); | 202 | vid, skb->skb_iif, |
| 203 | skb->mark); | ||
| 202 | if (!client_added) | 204 | if (!client_added) |
| 203 | goto dropped; | 205 | goto dropped; |
| 204 | } | 206 | } |
| @@ -215,36 +217,39 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 215 | if (batadv_compare_eth(ethhdr->h_dest, ectp_addr)) | 217 | if (batadv_compare_eth(ethhdr->h_dest, ectp_addr)) |
| 216 | goto dropped; | 218 | goto dropped; |
| 217 | 219 | ||
| 220 | gw_mode = atomic_read(&bat_priv->gw_mode); | ||
| 218 | if (is_multicast_ether_addr(ethhdr->h_dest)) { | 221 | if (is_multicast_ether_addr(ethhdr->h_dest)) { |
| 219 | do_bcast = true; | 222 | /* if gw mode is off, broadcast every packet */ |
| 220 | 223 | if (gw_mode == BATADV_GW_MODE_OFF) { | |
| 221 | switch (atomic_read(&bat_priv->gw_mode)) { | 224 | do_bcast = true; |
| 222 | case BATADV_GW_MODE_SERVER: | 225 | goto send; |
| 223 | /* gateway servers should not send dhcp | ||
| 224 | * requests into the mesh | ||
| 225 | */ | ||
| 226 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | ||
| 227 | if (ret) | ||
| 228 | goto dropped; | ||
| 229 | break; | ||
| 230 | case BATADV_GW_MODE_CLIENT: | ||
| 231 | /* gateway clients should send dhcp requests | ||
| 232 | * via unicast to their gateway | ||
| 233 | */ | ||
| 234 | ret = batadv_gw_is_dhcp_target(skb, &header_len); | ||
| 235 | if (ret) | ||
| 236 | do_bcast = false; | ||
| 237 | break; | ||
| 238 | case BATADV_GW_MODE_OFF: | ||
| 239 | default: | ||
| 240 | break; | ||
| 241 | } | 226 | } |
| 242 | 227 | ||
| 243 | /* reminder: ethhdr might have become unusable from here on | 228 | dhcp_rcp = batadv_gw_dhcp_recipient_get(skb, &header_len, |
| 244 | * (batadv_gw_is_dhcp_target() might have reallocated skb data) | 229 | chaddr); |
| 230 | /* skb->data may have been modified by | ||
| 231 | * batadv_gw_dhcp_recipient_get() | ||
| 245 | */ | 232 | */ |
| 233 | ethhdr = (struct ethhdr *)skb->data; | ||
| 234 | /* if gw_mode is on, broadcast any non-DHCP message. | ||
| 235 | * All the DHCP packets are going to be sent as unicast | ||
| 236 | */ | ||
| 237 | if (dhcp_rcp == BATADV_DHCP_NO) { | ||
| 238 | do_bcast = true; | ||
| 239 | goto send; | ||
| 240 | } | ||
| 241 | |||
| 242 | if (dhcp_rcp == BATADV_DHCP_TO_CLIENT) | ||
| 243 | dst_hint = chaddr; | ||
| 244 | else if ((gw_mode == BATADV_GW_MODE_SERVER) && | ||
| 245 | (dhcp_rcp == BATADV_DHCP_TO_SERVER)) | ||
| 246 | /* gateways should not forward any DHCP message if | ||
| 247 | * directed to a DHCP server | ||
| 248 | */ | ||
| 249 | goto dropped; | ||
| 246 | } | 250 | } |
| 247 | 251 | ||
| 252 | send: | ||
| 248 | batadv_skb_set_priority(skb, 0); | 253 | batadv_skb_set_priority(skb, 0); |
| 249 | 254 | ||
| 250 | /* ethernet packet should be broadcasted */ | 255 | /* ethernet packet should be broadcasted */ |
| @@ -290,22 +295,22 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 290 | 295 | ||
| 291 | /* unicast packet */ | 296 | /* unicast packet */ |
| 292 | } else { | 297 | } else { |
| 293 | if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) { | 298 | /* DHCP packets going to a server will use the GW feature */ |
| 299 | if (dhcp_rcp == BATADV_DHCP_TO_SERVER) { | ||
| 294 | ret = batadv_gw_out_of_range(bat_priv, skb); | 300 | ret = batadv_gw_out_of_range(bat_priv, skb); |
| 295 | if (ret) | 301 | if (ret) |
| 296 | goto dropped; | 302 | goto dropped; |
| 297 | } | ||
| 298 | |||
| 299 | if (batadv_dat_snoop_outgoing_arp_request(bat_priv, skb)) | ||
| 300 | goto dropped; | ||
| 301 | |||
| 302 | batadv_dat_snoop_outgoing_arp_reply(bat_priv, skb); | ||
| 303 | |||
| 304 | if (is_multicast_ether_addr(ethhdr->h_dest)) | ||
| 305 | ret = batadv_send_skb_via_gw(bat_priv, skb, vid); | 303 | ret = batadv_send_skb_via_gw(bat_priv, skb, vid); |
| 306 | else | 304 | } else { |
| 307 | ret = batadv_send_skb_via_tt(bat_priv, skb, vid); | 305 | if (batadv_dat_snoop_outgoing_arp_request(bat_priv, |
| 306 | skb)) | ||
| 307 | goto dropped; | ||
| 308 | 308 | ||
| 309 | batadv_dat_snoop_outgoing_arp_reply(bat_priv, skb); | ||
| 310 | |||
| 311 | ret = batadv_send_skb_via_tt(bat_priv, skb, dst_hint, | ||
| 312 | vid); | ||
| 313 | } | ||
| 309 | if (ret == NET_XMIT_DROP) | 314 | if (ret == NET_XMIT_DROP) |
| 310 | goto dropped_freed; | 315 | goto dropped_freed; |
| 311 | } | 316 | } |
| @@ -394,9 +399,23 @@ void batadv_interface_rx(struct net_device *soft_iface, | |||
| 394 | batadv_tt_add_temporary_global_entry(bat_priv, orig_node, | 399 | batadv_tt_add_temporary_global_entry(bat_priv, orig_node, |
| 395 | ethhdr->h_source, vid); | 400 | ethhdr->h_source, vid); |
| 396 | 401 | ||
| 397 | if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest, | 402 | if (is_multicast_ether_addr(ethhdr->h_dest)) { |
| 398 | vid)) | 403 | /* set the mark on broadcast packets if AP isolation is ON and |
| 404 | * the packet is coming from an "isolated" client | ||
| 405 | */ | ||
| 406 | if (batadv_vlan_ap_isola_get(bat_priv, vid) && | ||
| 407 | batadv_tt_global_is_isolated(bat_priv, ethhdr->h_source, | ||
| 408 | vid)) { | ||
| 409 | /* save bits in skb->mark not covered by the mask and | ||
| 410 | * apply the mark on the rest | ||
| 411 | */ | ||
| 412 | skb->mark &= ~bat_priv->isolation_mark_mask; | ||
| 413 | skb->mark |= bat_priv->isolation_mark; | ||
| 414 | } | ||
| 415 | } else if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, | ||
| 416 | ethhdr->h_dest, vid)) { | ||
| 399 | goto dropped; | 417 | goto dropped; |
| 418 | } | ||
| 400 | 419 | ||
| 401 | netif_rx(skb); | 420 | netif_rx(skb); |
| 402 | goto out; | 421 | goto out; |
| @@ -485,7 +504,7 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid) | |||
| 485 | */ | 504 | */ |
| 486 | batadv_tt_local_add(bat_priv->soft_iface, | 505 | batadv_tt_local_add(bat_priv->soft_iface, |
| 487 | bat_priv->soft_iface->dev_addr, vid, | 506 | bat_priv->soft_iface->dev_addr, vid, |
| 488 | BATADV_NULL_IFINDEX); | 507 | BATADV_NULL_IFINDEX, BATADV_NO_MARK); |
| 489 | 508 | ||
| 490 | spin_lock_bh(&bat_priv->softif_vlan_list_lock); | 509 | spin_lock_bh(&bat_priv->softif_vlan_list_lock); |
| 491 | hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list); | 510 | hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list); |
| @@ -697,6 +716,8 @@ static int batadv_softif_init_late(struct net_device *dev) | |||
| 697 | #endif | 716 | #endif |
| 698 | bat_priv->tt.last_changeset = NULL; | 717 | bat_priv->tt.last_changeset = NULL; |
| 699 | bat_priv->tt.last_changeset_len = 0; | 718 | bat_priv->tt.last_changeset_len = 0; |
| 719 | bat_priv->isolation_mark = 0; | ||
| 720 | bat_priv->isolation_mark_mask = 0; | ||
| 700 | 721 | ||
| 701 | /* randomize initial seqno to avoid collision */ | 722 | /* randomize initial seqno to avoid collision */ |
| 702 | get_random_bytes(&random_seqno, sizeof(random_seqno)); | 723 | get_random_bytes(&random_seqno, sizeof(random_seqno)); |
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index 06fc91ff5a02..4ab0167ac6ac 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_ | 18 | #ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_ |
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c index 6335433310af..b6a4403b7007 100644 --- a/net/batman-adv/sysfs.c +++ b/net/batman-adv/sysfs.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -329,10 +327,10 @@ static ssize_t batadv_show_bat_algo(struct kobject *kobj, | |||
| 329 | return sprintf(buff, "%s\n", bat_priv->bat_algo_ops->name); | 327 | return sprintf(buff, "%s\n", bat_priv->bat_algo_ops->name); |
| 330 | } | 328 | } |
| 331 | 329 | ||
| 332 | static void batadv_post_gw_deselect(struct net_device *net_dev) | 330 | static void batadv_post_gw_reselect(struct net_device *net_dev) |
| 333 | { | 331 | { |
| 334 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | 332 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
| 335 | batadv_gw_deselect(bat_priv); | 333 | batadv_gw_reselect(bat_priv); |
| 336 | } | 334 | } |
| 337 | 335 | ||
| 338 | static ssize_t batadv_show_gw_mode(struct kobject *kobj, struct attribute *attr, | 336 | static ssize_t batadv_show_gw_mode(struct kobject *kobj, struct attribute *attr, |
| @@ -408,7 +406,16 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj, | |||
| 408 | batadv_info(net_dev, "Changing gw mode from: %s to: %s\n", | 406 | batadv_info(net_dev, "Changing gw mode from: %s to: %s\n", |
| 409 | curr_gw_mode_str, buff); | 407 | curr_gw_mode_str, buff); |
| 410 | 408 | ||
| 411 | batadv_gw_deselect(bat_priv); | 409 | /* Invoking batadv_gw_reselect() is not enough to really de-select the |
| 410 | * current GW. It will only instruct the gateway client code to perform | ||
| 411 | * a re-election the next time that this is needed. | ||
| 412 | * | ||
| 413 | * When gw client mode is being switched off the current GW must be | ||
| 414 | * de-selected explicitly otherwise no GW_ADD uevent is thrown on | ||
| 415 | * client mode re-activation. This is operation is performed in | ||
| 416 | * batadv_gw_check_client_stop(). | ||
| 417 | */ | ||
| 418 | batadv_gw_reselect(bat_priv); | ||
| 412 | /* always call batadv_gw_check_client_stop() before changing the gateway | 419 | /* always call batadv_gw_check_client_stop() before changing the gateway |
| 413 | * state | 420 | * state |
| 414 | */ | 421 | */ |
| @@ -443,6 +450,74 @@ static ssize_t batadv_store_gw_bwidth(struct kobject *kobj, | |||
| 443 | return batadv_gw_bandwidth_set(net_dev, buff, count); | 450 | return batadv_gw_bandwidth_set(net_dev, buff, count); |
| 444 | } | 451 | } |
| 445 | 452 | ||
| 453 | /** | ||
| 454 | * batadv_show_isolation_mark - print the current isolation mark/mask | ||
| 455 | * @kobj: kobject representing the private mesh sysfs directory | ||
| 456 | * @attr: the batman-adv attribute the user is interacting with | ||
| 457 | * @buff: the buffer that will contain the data to send back to the user | ||
| 458 | * | ||
| 459 | * Returns the number of bytes written into 'buff' on success or a negative | ||
| 460 | * error code in case of failure | ||
| 461 | */ | ||
| 462 | static ssize_t batadv_show_isolation_mark(struct kobject *kobj, | ||
| 463 | struct attribute *attr, char *buff) | ||
| 464 | { | ||
| 465 | struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj); | ||
| 466 | |||
| 467 | return sprintf(buff, "%#.8x/%#.8x\n", bat_priv->isolation_mark, | ||
| 468 | bat_priv->isolation_mark_mask); | ||
| 469 | } | ||
| 470 | |||
| 471 | /** | ||
| 472 | * batadv_store_isolation_mark - parse and store the isolation mark/mask entered | ||
| 473 | * by the user | ||
| 474 | * @kobj: kobject representing the private mesh sysfs directory | ||
| 475 | * @attr: the batman-adv attribute the user is interacting with | ||
| 476 | * @buff: the buffer containing the user data | ||
| 477 | * @count: number of bytes in the buffer | ||
| 478 | * | ||
| 479 | * Returns 'count' on success or a negative error code in case of failure | ||
| 480 | */ | ||
| 481 | static ssize_t batadv_store_isolation_mark(struct kobject *kobj, | ||
| 482 | struct attribute *attr, char *buff, | ||
| 483 | size_t count) | ||
| 484 | { | ||
| 485 | struct net_device *net_dev = batadv_kobj_to_netdev(kobj); | ||
| 486 | struct batadv_priv *bat_priv = netdev_priv(net_dev); | ||
| 487 | uint32_t mark, mask; | ||
| 488 | char *mask_ptr; | ||
| 489 | |||
| 490 | /* parse the mask if it has been specified, otherwise assume the mask is | ||
| 491 | * the biggest possible | ||
| 492 | */ | ||
| 493 | mask = 0xFFFFFFFF; | ||
| 494 | mask_ptr = strchr(buff, '/'); | ||
| 495 | if (mask_ptr) { | ||
| 496 | *mask_ptr = '\0'; | ||
| 497 | mask_ptr++; | ||
| 498 | |||
| 499 | /* the mask must be entered in hex base as it is going to be a | ||
| 500 | * bitmask and not a prefix length | ||
| 501 | */ | ||
| 502 | if (kstrtou32(mask_ptr, 16, &mask) < 0) | ||
| 503 | return -EINVAL; | ||
| 504 | } | ||
| 505 | |||
| 506 | /* the mark can be entered in any base */ | ||
| 507 | if (kstrtou32(buff, 0, &mark) < 0) | ||
| 508 | return -EINVAL; | ||
| 509 | |||
| 510 | bat_priv->isolation_mark_mask = mask; | ||
| 511 | /* erase bits not covered by the mask */ | ||
| 512 | bat_priv->isolation_mark = mark & bat_priv->isolation_mark_mask; | ||
| 513 | |||
| 514 | batadv_info(net_dev, | ||
| 515 | "New skb mark for extended isolation: %#.8x/%#.8x\n", | ||
| 516 | bat_priv->isolation_mark, bat_priv->isolation_mark_mask); | ||
| 517 | |||
| 518 | return count; | ||
| 519 | } | ||
| 520 | |||
| 446 | BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); | 521 | BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL); |
| 447 | BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); | 522 | BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL); |
| 448 | #ifdef CONFIG_BATMAN_ADV_BLA | 523 | #ifdef CONFIG_BATMAN_ADV_BLA |
| @@ -461,7 +536,7 @@ BATADV_ATTR_SIF_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * BATADV_JITTER, | |||
| 461 | BATADV_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, BATADV_TQ_MAX_VALUE, | 536 | BATADV_ATTR_SIF_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, BATADV_TQ_MAX_VALUE, |
| 462 | NULL); | 537 | NULL); |
| 463 | BATADV_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, BATADV_TQ_MAX_VALUE, | 538 | BATADV_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, BATADV_TQ_MAX_VALUE, |
| 464 | batadv_post_gw_deselect); | 539 | batadv_post_gw_reselect); |
| 465 | static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, | 540 | static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth, |
| 466 | batadv_store_gw_bwidth); | 541 | batadv_store_gw_bwidth); |
| 467 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 542 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
| @@ -471,6 +546,8 @@ BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, BATADV_DBG_ALL, NULL); | |||
| 471 | BATADV_ATTR_SIF_BOOL(network_coding, S_IRUGO | S_IWUSR, | 546 | BATADV_ATTR_SIF_BOOL(network_coding, S_IRUGO | S_IWUSR, |
| 472 | batadv_nc_status_update); | 547 | batadv_nc_status_update); |
| 473 | #endif | 548 | #endif |
| 549 | static BATADV_ATTR(isolation_mark, S_IRUGO | S_IWUSR, | ||
| 550 | batadv_show_isolation_mark, batadv_store_isolation_mark); | ||
| 474 | 551 | ||
| 475 | static struct batadv_attribute *batadv_mesh_attrs[] = { | 552 | static struct batadv_attribute *batadv_mesh_attrs[] = { |
| 476 | &batadv_attr_aggregated_ogms, | 553 | &batadv_attr_aggregated_ogms, |
| @@ -494,6 +571,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = { | |||
| 494 | #ifdef CONFIG_BATMAN_ADV_NC | 571 | #ifdef CONFIG_BATMAN_ADV_NC |
| 495 | &batadv_attr_network_coding, | 572 | &batadv_attr_network_coding, |
| 496 | #endif | 573 | #endif |
| 574 | &batadv_attr_isolation_mark, | ||
| 497 | NULL, | 575 | NULL, |
| 498 | }; | 576 | }; |
| 499 | 577 | ||
diff --git a/net/batman-adv/sysfs.h b/net/batman-adv/sysfs.h index c7d725de50ad..ed80b727dfd8 100644 --- a/net/batman-adv/sysfs.h +++ b/net/batman-adv/sysfs.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_SYSFS_H_ | 18 | #ifndef _NET_BATMAN_ADV_SYSFS_H_ |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 19bc42f8b8be..63d25705cec6 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #include "main.h" | 18 | #include "main.h" |
| @@ -476,11 +474,13 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, | |||
| 476 | * @vid: VLAN identifier | 474 | * @vid: VLAN identifier |
| 477 | * @ifindex: index of the interface where the client is connected to (useful to | 475 | * @ifindex: index of the interface where the client is connected to (useful to |
| 478 | * identify wireless clients) | 476 | * identify wireless clients) |
| 477 | * @mark: the value contained in the skb->mark field of the received packet (if | ||
| 478 | * any) | ||
| 479 | * | 479 | * |
| 480 | * Returns true if the client was successfully added, false otherwise. | 480 | * Returns true if the client was successfully added, false otherwise. |
| 481 | */ | 481 | */ |
| 482 | bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | 482 | bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
| 483 | unsigned short vid, int ifindex) | 483 | unsigned short vid, int ifindex, uint32_t mark) |
| 484 | { | 484 | { |
| 485 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); | 485 | struct batadv_priv *bat_priv = netdev_priv(soft_iface); |
| 486 | struct batadv_tt_local_entry *tt_local; | 486 | struct batadv_tt_local_entry *tt_local; |
| @@ -491,6 +491,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
| 491 | int hash_added, table_size, packet_size_max; | 491 | int hash_added, table_size, packet_size_max; |
| 492 | bool ret = false, roamed_back = false; | 492 | bool ret = false, roamed_back = false; |
| 493 | uint8_t remote_flags; | 493 | uint8_t remote_flags; |
| 494 | uint32_t match_mark; | ||
| 494 | 495 | ||
| 495 | if (ifindex != BATADV_NULL_IFINDEX) | 496 | if (ifindex != BATADV_NULL_IFINDEX) |
| 496 | in_dev = dev_get_by_index(&init_net, ifindex); | 497 | in_dev = dev_get_by_index(&init_net, ifindex); |
| @@ -615,6 +616,17 @@ check_roaming: | |||
| 615 | else | 616 | else |
| 616 | tt_local->common.flags &= ~BATADV_TT_CLIENT_WIFI; | 617 | tt_local->common.flags &= ~BATADV_TT_CLIENT_WIFI; |
| 617 | 618 | ||
| 619 | /* check the mark in the skb: if it's equal to the configured | ||
| 620 | * isolation_mark, it means the packet is coming from an isolated | ||
| 621 | * non-mesh client | ||
| 622 | */ | ||
| 623 | match_mark = (mark & bat_priv->isolation_mark_mask); | ||
| 624 | if (bat_priv->isolation_mark_mask && | ||
| 625 | match_mark == bat_priv->isolation_mark) | ||
| 626 | tt_local->common.flags |= BATADV_TT_CLIENT_ISOLA; | ||
| 627 | else | ||
| 628 | tt_local->common.flags &= ~BATADV_TT_CLIENT_ISOLA; | ||
| 629 | |||
| 618 | /* if any "dynamic" flag has been modified, resend an ADD event for this | 630 | /* if any "dynamic" flag has been modified, resend an ADD event for this |
| 619 | * entry so that all the nodes can get the new flags | 631 | * entry so that all the nodes can get the new flags |
| 620 | */ | 632 | */ |
| @@ -875,7 +887,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
| 875 | seq_printf(seq, | 887 | seq_printf(seq, |
| 876 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", | 888 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", |
| 877 | net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn)); | 889 | net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn)); |
| 878 | seq_printf(seq, " %-13s %s %-7s %-9s (%-10s)\n", "Client", "VID", | 890 | seq_printf(seq, " %-13s %s %-8s %-9s (%-10s)\n", "Client", "VID", |
| 879 | "Flags", "Last seen", "CRC"); | 891 | "Flags", "Last seen", "CRC"); |
| 880 | 892 | ||
| 881 | for (i = 0; i < hash->size; i++) { | 893 | for (i = 0; i < hash->size; i++) { |
| @@ -903,7 +915,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
| 903 | } | 915 | } |
| 904 | 916 | ||
| 905 | seq_printf(seq, | 917 | seq_printf(seq, |
| 906 | " * %pM %4i [%c%c%c%c%c] %3u.%03u (%#.8x)\n", | 918 | " * %pM %4i [%c%c%c%c%c%c] %3u.%03u (%#.8x)\n", |
| 907 | tt_common_entry->addr, | 919 | tt_common_entry->addr, |
| 908 | BATADV_PRINT_VID(tt_common_entry->vid), | 920 | BATADV_PRINT_VID(tt_common_entry->vid), |
| 909 | (tt_common_entry->flags & | 921 | (tt_common_entry->flags & |
| @@ -915,6 +927,8 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
| 915 | BATADV_TT_CLIENT_PENDING ? 'X' : '.'), | 927 | BATADV_TT_CLIENT_PENDING ? 'X' : '.'), |
| 916 | (tt_common_entry->flags & | 928 | (tt_common_entry->flags & |
| 917 | BATADV_TT_CLIENT_WIFI ? 'W' : '.'), | 929 | BATADV_TT_CLIENT_WIFI ? 'W' : '.'), |
| 930 | (tt_common_entry->flags & | ||
| 931 | BATADV_TT_CLIENT_ISOLA ? 'I' : '.'), | ||
| 918 | no_purge ? 0 : last_seen_secs, | 932 | no_purge ? 0 : last_seen_secs, |
| 919 | no_purge ? 0 : last_seen_msecs, | 933 | no_purge ? 0 : last_seen_msecs, |
| 920 | vlan->tt.crc); | 934 | vlan->tt.crc); |
| @@ -1447,13 +1461,14 @@ batadv_tt_global_print_entry(struct batadv_priv *bat_priv, | |||
| 1447 | 1461 | ||
| 1448 | last_ttvn = atomic_read(&best_entry->orig_node->last_ttvn); | 1462 | last_ttvn = atomic_read(&best_entry->orig_node->last_ttvn); |
| 1449 | seq_printf(seq, | 1463 | seq_printf(seq, |
| 1450 | " %c %pM %4i (%3u) via %pM (%3u) (%#.8x) [%c%c%c]\n", | 1464 | " %c %pM %4i (%3u) via %pM (%3u) (%#.8x) [%c%c%c%c]\n", |
| 1451 | '*', tt_global_entry->common.addr, | 1465 | '*', tt_global_entry->common.addr, |
| 1452 | BATADV_PRINT_VID(tt_global_entry->common.vid), | 1466 | BATADV_PRINT_VID(tt_global_entry->common.vid), |
| 1453 | best_entry->ttvn, best_entry->orig_node->orig, | 1467 | best_entry->ttvn, best_entry->orig_node->orig, |
| 1454 | last_ttvn, vlan->tt.crc, | 1468 | last_ttvn, vlan->tt.crc, |
| 1455 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), | 1469 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
| 1456 | (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.'), | 1470 | (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.'), |
| 1471 | (flags & BATADV_TT_CLIENT_ISOLA ? 'I' : '.'), | ||
| 1457 | (flags & BATADV_TT_CLIENT_TEMP ? 'T' : '.')); | 1472 | (flags & BATADV_TT_CLIENT_TEMP ? 'T' : '.')); |
| 1458 | 1473 | ||
| 1459 | batadv_orig_node_vlan_free_ref(vlan); | 1474 | batadv_orig_node_vlan_free_ref(vlan); |
| @@ -1478,13 +1493,14 @@ print_list: | |||
| 1478 | 1493 | ||
| 1479 | last_ttvn = atomic_read(&orig_entry->orig_node->last_ttvn); | 1494 | last_ttvn = atomic_read(&orig_entry->orig_node->last_ttvn); |
| 1480 | seq_printf(seq, | 1495 | seq_printf(seq, |
| 1481 | " %c %pM %4d (%3u) via %pM (%3u) (%#.8x) [%c%c%c]\n", | 1496 | " %c %pM %4d (%3u) via %pM (%3u) (%#.8x) [%c%c%c%c]\n", |
| 1482 | '+', tt_global_entry->common.addr, | 1497 | '+', tt_global_entry->common.addr, |
| 1483 | BATADV_PRINT_VID(tt_global_entry->common.vid), | 1498 | BATADV_PRINT_VID(tt_global_entry->common.vid), |
| 1484 | orig_entry->ttvn, orig_entry->orig_node->orig, | 1499 | orig_entry->ttvn, orig_entry->orig_node->orig, |
| 1485 | last_ttvn, vlan->tt.crc, | 1500 | last_ttvn, vlan->tt.crc, |
| 1486 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), | 1501 | (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'), |
| 1487 | (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.'), | 1502 | (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.'), |
| 1503 | (flags & BATADV_TT_CLIENT_ISOLA ? 'I' : '.'), | ||
| 1488 | (flags & BATADV_TT_CLIENT_TEMP ? 'T' : '.')); | 1504 | (flags & BATADV_TT_CLIENT_TEMP ? 'T' : '.')); |
| 1489 | 1505 | ||
| 1490 | batadv_orig_node_vlan_free_ref(vlan); | 1506 | batadv_orig_node_vlan_free_ref(vlan); |
| @@ -1853,6 +1869,11 @@ _batadv_is_ap_isolated(struct batadv_tt_local_entry *tt_local_entry, | |||
| 1853 | tt_global_entry->common.flags & BATADV_TT_CLIENT_WIFI) | 1869 | tt_global_entry->common.flags & BATADV_TT_CLIENT_WIFI) |
| 1854 | ret = true; | 1870 | ret = true; |
| 1855 | 1871 | ||
| 1872 | /* check if the two clients are marked as isolated */ | ||
| 1873 | if (tt_local_entry->common.flags & BATADV_TT_CLIENT_ISOLA && | ||
| 1874 | tt_global_entry->common.flags & BATADV_TT_CLIENT_ISOLA) | ||
| 1875 | ret = true; | ||
| 1876 | |||
| 1856 | return ret; | 1877 | return ret; |
| 1857 | } | 1878 | } |
| 1858 | 1879 | ||
| @@ -1879,19 +1900,8 @@ struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, | |||
| 1879 | struct batadv_tt_global_entry *tt_global_entry = NULL; | 1900 | struct batadv_tt_global_entry *tt_global_entry = NULL; |
| 1880 | struct batadv_orig_node *orig_node = NULL; | 1901 | struct batadv_orig_node *orig_node = NULL; |
| 1881 | struct batadv_tt_orig_list_entry *best_entry; | 1902 | struct batadv_tt_orig_list_entry *best_entry; |
| 1882 | bool ap_isolation_enabled = false; | ||
| 1883 | struct batadv_softif_vlan *vlan; | ||
| 1884 | 1903 | ||
| 1885 | /* if the AP isolation is requested on a VLAN, then check for its | 1904 | if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { |
| 1886 | * setting in the proper VLAN private data structure | ||
| 1887 | */ | ||
| 1888 | vlan = batadv_softif_vlan_get(bat_priv, vid); | ||
| 1889 | if (vlan) { | ||
| 1890 | ap_isolation_enabled = atomic_read(&vlan->ap_isolation); | ||
| 1891 | batadv_softif_vlan_free_ref(vlan); | ||
| 1892 | } | ||
| 1893 | |||
| 1894 | if (src && ap_isolation_enabled) { | ||
| 1895 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); | 1905 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); |
| 1896 | if (!tt_local_entry || | 1906 | if (!tt_local_entry || |
| 1897 | (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING)) | 1907 | (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING)) |
| @@ -3567,3 +3577,29 @@ int batadv_tt_init(struct batadv_priv *bat_priv) | |||
| 3567 | 3577 | ||
| 3568 | return 1; | 3578 | return 1; |
| 3569 | } | 3579 | } |
| 3580 | |||
| 3581 | /** | ||
| 3582 | * batadv_tt_global_is_isolated - check if a client is marked as isolated | ||
| 3583 | * @bat_priv: the bat priv with all the soft interface information | ||
| 3584 | * @addr: the mac address of the client | ||
| 3585 | * @vid: the identifier of the VLAN where this client is connected | ||
| 3586 | * | ||
| 3587 | * Returns true if the client is marked with the TT_CLIENT_ISOLA flag, false | ||
| 3588 | * otherwise | ||
| 3589 | */ | ||
| 3590 | bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, | ||
| 3591 | const uint8_t *addr, unsigned short vid) | ||
| 3592 | { | ||
| 3593 | struct batadv_tt_global_entry *tt; | ||
| 3594 | bool ret; | ||
| 3595 | |||
| 3596 | tt = batadv_tt_global_hash_find(bat_priv, addr, vid); | ||
| 3597 | if (!tt) | ||
| 3598 | return false; | ||
| 3599 | |||
| 3600 | ret = tt->common.flags & BATADV_TT_CLIENT_ISOLA; | ||
| 3601 | |||
| 3602 | batadv_tt_global_entry_free_ref(tt); | ||
| 3603 | |||
| 3604 | return ret; | ||
| 3605 | } | ||
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h index 026b1ffa6746..daa8ab728f71 100644 --- a/net/batman-adv/translation-table.h +++ b/net/batman-adv/translation-table.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ | 18 | #ifndef _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ |
| @@ -22,7 +20,7 @@ | |||
| 22 | 20 | ||
| 23 | int batadv_tt_init(struct batadv_priv *bat_priv); | 21 | int batadv_tt_init(struct batadv_priv *bat_priv); |
| 24 | bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | 22 | bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
| 25 | unsigned short vid, int ifindex); | 23 | unsigned short vid, int ifindex, uint32_t mark); |
| 26 | uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | 24 | uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, |
| 27 | const uint8_t *addr, unsigned short vid, | 25 | const uint8_t *addr, unsigned short vid, |
| 28 | const char *message, bool roaming); | 26 | const char *message, bool roaming); |
| @@ -50,5 +48,7 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, | |||
| 50 | struct batadv_orig_node *orig_node, | 48 | struct batadv_orig_node *orig_node, |
| 51 | const unsigned char *addr, | 49 | const unsigned char *addr, |
| 52 | unsigned short vid); | 50 | unsigned short vid); |
| 51 | bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, | ||
| 52 | const uint8_t *addr, unsigned short vid); | ||
| 53 | 53 | ||
| 54 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ | 54 | #endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */ |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 91dd369b0ff2..0430a0474506 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
| @@ -12,9 +12,7 @@ | |||
| 12 | * General Public License for more details. | 12 | * General Public License for more details. |
| 13 | * | 13 | * |
| 14 | * You should have received a copy of the GNU General Public License | 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 | 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 17 | * 02110-1301, USA | ||
| 18 | */ | 16 | */ |
| 19 | 17 | ||
| 20 | #ifndef _NET_BATMAN_ADV_TYPES_H_ | 18 | #ifndef _NET_BATMAN_ADV_TYPES_H_ |
| @@ -36,6 +34,18 @@ | |||
| 36 | #endif /* CONFIG_BATMAN_ADV_DAT */ | 34 | #endif /* CONFIG_BATMAN_ADV_DAT */ |
| 37 | 35 | ||
| 38 | /** | 36 | /** |
| 37 | * enum batadv_dhcp_recipient - dhcp destination | ||
| 38 | * @BATADV_DHCP_NO: packet is not a dhcp message | ||
| 39 | * @BATADV_DHCP_TO_SERVER: dhcp message is directed to a server | ||
| 40 | * @BATADV_DHCP_TO_CLIENT: dhcp message is directed to a client | ||
| 41 | */ | ||
| 42 | enum batadv_dhcp_recipient { | ||
| 43 | BATADV_DHCP_NO = 0, | ||
| 44 | BATADV_DHCP_TO_SERVER, | ||
| 45 | BATADV_DHCP_TO_CLIENT, | ||
| 46 | }; | ||
| 47 | |||
| 48 | /** | ||
| 39 | * BATADV_TT_REMOTE_MASK - bitmask selecting the flags that are sent over the | 49 | * BATADV_TT_REMOTE_MASK - bitmask selecting the flags that are sent over the |
| 40 | * wire only | 50 | * wire only |
| 41 | */ | 51 | */ |
| @@ -687,6 +697,8 @@ struct batadv_priv { | |||
| 687 | #ifdef CONFIG_BATMAN_ADV_DEBUG | 697 | #ifdef CONFIG_BATMAN_ADV_DEBUG |
| 688 | atomic_t log_level; | 698 | atomic_t log_level; |
| 689 | #endif | 699 | #endif |
| 700 | uint32_t isolation_mark; | ||
| 701 | uint32_t isolation_mark_mask; | ||
| 690 | atomic_t bcast_seqno; | 702 | atomic_t bcast_seqno; |
| 691 | atomic_t bcast_queue_left; | 703 | atomic_t bcast_queue_left; |
| 692 | atomic_t batman_queue_left; | 704 | atomic_t batman_queue_left; |
