Sven Eckelmann | 7db7d9f | 2017-11-19 15:05:11 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Sven Eckelmann | ac79cbb | 2017-01-01 00:00:00 +0100 | [diff] [blame] | 2 | /* Copyright (C) 2009-2017 B.A.T.M.A.N. contributors: |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 3 | * |
| 4 | * Marek Lindner |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of version 2 of the GNU General Public |
| 8 | * License as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
Antonio Quartulli | ebf38fb | 2013-11-03 20:40:48 +0100 | [diff] [blame] | 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 17 | */ |
| 18 | |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 19 | #include "gateway_common.h" |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 20 | #include "main.h" |
| 21 | |
| 22 | #include <linux/atomic.h> |
| 23 | #include <linux/byteorder/generic.h> |
Sven Eckelmann | fcafa5e | 2016-05-15 11:07:42 +0200 | [diff] [blame] | 24 | #include <linux/errno.h> |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 25 | #include <linux/kernel.h> |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 26 | #include <linux/math64.h> |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 27 | #include <linux/netdevice.h> |
| 28 | #include <linux/stddef.h> |
| 29 | #include <linux/string.h> |
Sven Eckelmann | fec149f | 2017-12-21 10:17:41 +0100 | [diff] [blame] | 30 | #include <uapi/linux/batadv_packet.h> |
Sven Eckelmann | 1e2c2a4 | 2015-04-17 19:40:28 +0200 | [diff] [blame] | 31 | |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 32 | #include "gateway_client.h" |
Sven Eckelmann | ba41208 | 2016-05-15 23:48:31 +0200 | [diff] [blame] | 33 | #include "log.h" |
Markus Pargmann | 1f8dce4 | 2016-05-15 11:07:43 +0200 | [diff] [blame] | 34 | #include "tvlv.h" |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 35 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 36 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 37 | * batadv_parse_throughput() - parse supplied string buffer to extract |
| 38 | * throughput information |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 39 | * @net_dev: the soft interface net device |
| 40 | * @buff: string buffer to parse |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 41 | * @description: text shown when throughput string cannot be parsed |
| 42 | * @throughput: pointer holding the returned throughput information |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 43 | * |
Sven Eckelmann | 62fe710 | 2015-09-15 19:00:48 +0200 | [diff] [blame] | 44 | * Return: false on parse error and true otherwise. |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 45 | */ |
Antonio Quartulli | 0b5ecc6 | 2016-01-16 16:40:14 +0800 | [diff] [blame] | 46 | bool batadv_parse_throughput(struct net_device *net_dev, char *buff, |
| 47 | const char *description, u32 *throughput) |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 48 | { |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 49 | enum batadv_bandwidth_units bw_unit_type = BATADV_BW_UNIT_KBIT; |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 50 | u64 lthroughput; |
| 51 | char *tmp_ptr; |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 52 | int ret; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 53 | |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 54 | if (strlen(buff) > 4) { |
| 55 | tmp_ptr = buff + strlen(buff) - 4; |
| 56 | |
Rasmus Villemoes | b7a8d756 | 2014-10-13 15:54:42 -0700 | [diff] [blame] | 57 | if (strncasecmp(tmp_ptr, "mbit", 4) == 0) |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 58 | bw_unit_type = BATADV_BW_UNIT_MBIT; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 59 | |
Sven Eckelmann | 825ffe1 | 2017-08-23 21:52:13 +0200 | [diff] [blame] | 60 | if (strncasecmp(tmp_ptr, "kbit", 4) == 0 || |
| 61 | bw_unit_type == BATADV_BW_UNIT_MBIT) |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 62 | *tmp_ptr = '\0'; |
| 63 | } |
| 64 | |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 65 | ret = kstrtou64(buff, 10, <hroughput); |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 66 | if (ret) { |
Sven Eckelmann | 3e34819 | 2012-05-16 20:23:22 +0200 | [diff] [blame] | 67 | batadv_err(net_dev, |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 68 | "Invalid throughput speed for %s: %s\n", |
| 69 | description, buff); |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 70 | return false; |
| 71 | } |
| 72 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 73 | switch (bw_unit_type) { |
| 74 | case BATADV_BW_UNIT_MBIT: |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 75 | /* prevent overflow */ |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 76 | if (U64_MAX / 10 < lthroughput) { |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 77 | batadv_err(net_dev, |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 78 | "Throughput speed for %s too large: %s\n", |
| 79 | description, buff); |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 80 | return false; |
| 81 | } |
| 82 | |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 83 | lthroughput *= 10; |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 84 | break; |
| 85 | case BATADV_BW_UNIT_KBIT: |
| 86 | default: |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 87 | lthroughput = div_u64(lthroughput, 100); |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 88 | break; |
| 89 | } |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 90 | |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 91 | if (lthroughput > U32_MAX) { |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 92 | batadv_err(net_dev, |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 93 | "Throughput speed for %s too large: %s\n", |
| 94 | description, buff); |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 95 | return false; |
| 96 | } |
| 97 | |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 98 | *throughput = lthroughput; |
| 99 | |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 104 | * batadv_parse_gw_bandwidth() - parse supplied string buffer to extract |
| 105 | * download and upload bandwidth information |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 106 | * @net_dev: the soft interface net device |
| 107 | * @buff: string buffer to parse |
| 108 | * @down: pointer holding the returned download bandwidth information |
| 109 | * @up: pointer holding the returned upload bandwidth information |
| 110 | * |
| 111 | * Return: false on parse error and true otherwise. |
| 112 | */ |
| 113 | static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, |
| 114 | u32 *down, u32 *up) |
| 115 | { |
| 116 | char *slash_ptr; |
| 117 | bool ret; |
| 118 | |
| 119 | slash_ptr = strchr(buff, '/'); |
| 120 | if (slash_ptr) |
| 121 | *slash_ptr = 0; |
| 122 | |
| 123 | ret = batadv_parse_throughput(net_dev, buff, "download gateway speed", |
| 124 | down); |
| 125 | if (!ret) |
| 126 | return false; |
Sven Eckelmann | 0b8336f | 2015-06-21 19:40:09 +0200 | [diff] [blame] | 127 | |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 128 | /* we also got some upload info */ |
| 129 | if (slash_ptr) { |
Sven Eckelmann | d737ccb | 2015-09-13 09:44:45 +0200 | [diff] [blame] | 130 | ret = batadv_parse_throughput(net_dev, slash_ptr + 1, |
| 131 | "upload gateway speed", up); |
| 132 | if (!ret) |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 133 | return false; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | return true; |
| 137 | } |
| 138 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 139 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 140 | * batadv_gw_tvlv_container_update() - update the gw tvlv container after |
| 141 | * gateway setting change |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 142 | * @bat_priv: the bat priv with all the soft interface information |
| 143 | */ |
| 144 | void batadv_gw_tvlv_container_update(struct batadv_priv *bat_priv) |
| 145 | { |
| 146 | struct batadv_tvlv_gateway_data gw; |
Sven Eckelmann | 6b5e971 | 2015-05-26 18:34:26 +0200 | [diff] [blame] | 147 | u32 down, up; |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 148 | char gw_mode; |
| 149 | |
Antonio Quartulli | 3a24a63 | 2016-05-06 02:46:38 +0800 | [diff] [blame] | 150 | gw_mode = atomic_read(&bat_priv->gw.mode); |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 151 | |
| 152 | switch (gw_mode) { |
| 153 | case BATADV_GW_MODE_OFF: |
| 154 | case BATADV_GW_MODE_CLIENT: |
| 155 | batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_GW, 1); |
| 156 | break; |
| 157 | case BATADV_GW_MODE_SERVER: |
| 158 | down = atomic_read(&bat_priv->gw.bandwidth_down); |
| 159 | up = atomic_read(&bat_priv->gw.bandwidth_up); |
| 160 | gw.bandwidth_down = htonl(down); |
| 161 | gw.bandwidth_up = htonl(up); |
| 162 | batadv_tvlv_container_register(bat_priv, BATADV_TVLV_GW, 1, |
| 163 | &gw, sizeof(gw)); |
| 164 | break; |
| 165 | } |
| 166 | } |
| 167 | |
Sven Eckelmann | ff15c27 | 2017-12-02 19:51:53 +0100 | [diff] [blame] | 168 | /** |
| 169 | * batadv_gw_bandwidth_set() - Parse and set download/upload gateway bandwidth |
| 170 | * from supplied string buffer |
| 171 | * @net_dev: netdev struct of the soft interface |
| 172 | * @buff: the buffer containing the user data |
| 173 | * @count: number of bytes in the buffer |
| 174 | * |
| 175 | * Return: 'count' on success or a negative error code in case of failure |
| 176 | */ |
Sven Eckelmann | 84d5e5e | 2012-05-12 02:09:30 +0200 | [diff] [blame] | 177 | ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff, |
| 178 | size_t count) |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 179 | { |
Sven Eckelmann | 56303d3 | 2012-06-05 22:31:31 +0200 | [diff] [blame] | 180 | struct batadv_priv *bat_priv = netdev_priv(net_dev); |
Sven Eckelmann | 4f248cf | 2015-06-09 20:50:49 +0200 | [diff] [blame] | 181 | u32 down_curr; |
| 182 | u32 up_curr; |
| 183 | u32 down_new = 0; |
| 184 | u32 up_new = 0; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 185 | bool ret; |
| 186 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 187 | down_curr = (unsigned int)atomic_read(&bat_priv->gw.bandwidth_down); |
| 188 | up_curr = (unsigned int)atomic_read(&bat_priv->gw.bandwidth_up); |
| 189 | |
| 190 | ret = batadv_parse_gw_bandwidth(net_dev, buff, &down_new, &up_new); |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 191 | if (!ret) |
Sven Eckelmann | 77927b7 | 2015-06-21 14:42:49 +0200 | [diff] [blame] | 192 | return -EINVAL; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 193 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 194 | if (!down_new) |
| 195 | down_new = 1; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 196 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 197 | if (!up_new) |
| 198 | up_new = down_new / 5; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 199 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 200 | if (!up_new) |
| 201 | up_new = 1; |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 202 | |
Sven Eckelmann | 825ffe1 | 2017-08-23 21:52:13 +0200 | [diff] [blame] | 203 | if (down_curr == down_new && up_curr == up_new) |
Marek Lindner | dafe94b | 2012-05-11 16:10:50 +0800 | [diff] [blame] | 204 | return count; |
| 205 | |
Antonio Quartulli | 4e820e7 | 2013-11-04 20:59:41 +0100 | [diff] [blame] | 206 | batadv_gw_reselect(bat_priv); |
Sven Eckelmann | 3e34819 | 2012-05-16 20:23:22 +0200 | [diff] [blame] | 207 | batadv_info(net_dev, |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 208 | "Changing gateway bandwidth from: '%u.%u/%u.%u MBit' to: '%u.%u/%u.%u MBit'\n", |
| 209 | down_curr / 10, down_curr % 10, up_curr / 10, up_curr % 10, |
| 210 | down_new / 10, down_new % 10, up_new / 10, up_new % 10); |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 211 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 212 | atomic_set(&bat_priv->gw.bandwidth_down, down_new); |
| 213 | atomic_set(&bat_priv->gw.bandwidth_up, up_new); |
| 214 | batadv_gw_tvlv_container_update(bat_priv); |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 215 | |
Sven Eckelmann | c6c8fea | 2010-12-13 11:19:28 +0000 | [diff] [blame] | 216 | return count; |
| 217 | } |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 218 | |
| 219 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 220 | * batadv_gw_tvlv_ogm_handler_v1() - process incoming gateway tvlv container |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 221 | * @bat_priv: the bat priv with all the soft interface information |
| 222 | * @orig: the orig_node of the ogm |
| 223 | * @flags: flags indicating the tvlv state (see batadv_tvlv_handler_flags) |
| 224 | * @tvlv_value: tvlv buffer containing the gateway data |
| 225 | * @tvlv_value_len: tvlv buffer length |
| 226 | */ |
| 227 | static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, |
| 228 | struct batadv_orig_node *orig, |
Sven Eckelmann | 6b5e971 | 2015-05-26 18:34:26 +0200 | [diff] [blame] | 229 | u8 flags, |
| 230 | void *tvlv_value, u16 tvlv_value_len) |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 231 | { |
| 232 | struct batadv_tvlv_gateway_data gateway, *gateway_ptr; |
| 233 | |
| 234 | /* only fetch the tvlv value if the handler wasn't called via the |
| 235 | * CIFNOTFND flag and if there is data to fetch |
| 236 | */ |
Sven Eckelmann | 825ffe1 | 2017-08-23 21:52:13 +0200 | [diff] [blame] | 237 | if (flags & BATADV_TVLV_HANDLER_OGM_CIFNOTFND || |
| 238 | tvlv_value_len < sizeof(gateway)) { |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 239 | gateway.bandwidth_down = 0; |
| 240 | gateway.bandwidth_up = 0; |
| 241 | } else { |
| 242 | gateway_ptr = tvlv_value; |
| 243 | gateway.bandwidth_down = gateway_ptr->bandwidth_down; |
| 244 | gateway.bandwidth_up = gateway_ptr->bandwidth_up; |
Sven Eckelmann | 825ffe1 | 2017-08-23 21:52:13 +0200 | [diff] [blame] | 245 | if (gateway.bandwidth_down == 0 || |
| 246 | gateway.bandwidth_up == 0) { |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 247 | gateway.bandwidth_down = 0; |
| 248 | gateway.bandwidth_up = 0; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | batadv_gw_node_update(bat_priv, orig, &gateway); |
| 253 | |
Antonio Quartulli | 34d99cf | 2016-07-03 12:46:33 +0200 | [diff] [blame] | 254 | /* restart gateway selection */ |
Sven Eckelmann | 825ffe1 | 2017-08-23 21:52:13 +0200 | [diff] [blame] | 255 | if (gateway.bandwidth_down != 0 && |
| 256 | atomic_read(&bat_priv->gw.mode) == BATADV_GW_MODE_CLIENT) |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 257 | batadv_gw_check_election(bat_priv, orig); |
| 258 | } |
| 259 | |
| 260 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 261 | * batadv_gw_init() - initialise the gateway handling internals |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 262 | * @bat_priv: the bat priv with all the soft interface information |
| 263 | */ |
| 264 | void batadv_gw_init(struct batadv_priv *bat_priv) |
| 265 | { |
Sven Eckelmann | 1a9070e | 2017-03-04 15:48:50 +0100 | [diff] [blame] | 266 | if (bat_priv->algo_ops->gw.init_sel_class) |
| 267 | bat_priv->algo_ops->gw.init_sel_class(bat_priv); |
| 268 | else |
| 269 | atomic_set(&bat_priv->gw.sel_class, 1); |
| 270 | |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 271 | batadv_tvlv_handler_register(bat_priv, batadv_gw_tvlv_ogm_handler_v1, |
| 272 | NULL, BATADV_TVLV_GW, 1, |
| 273 | BATADV_TVLV_HANDLER_OGM_CIFNOTFND); |
| 274 | } |
| 275 | |
| 276 | /** |
Sven Eckelmann | 7e9a8c2 | 2017-12-02 19:51:47 +0100 | [diff] [blame] | 277 | * batadv_gw_free() - free the gateway handling internals |
Marek Lindner | 414254e | 2013-04-23 21:39:58 +0800 | [diff] [blame] | 278 | * @bat_priv: the bat priv with all the soft interface information |
| 279 | */ |
| 280 | void batadv_gw_free(struct batadv_priv *bat_priv) |
| 281 | { |
| 282 | batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_GW, 1); |
| 283 | batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_GW, 1); |
| 284 | } |