diff options
author | Linus Lüssing <linus.luessing@c0d3.blue> | 2015-06-30 17:45:26 -0400 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2015-08-14 16:52:10 -0400 |
commit | 53cf037bf846417fd92dc92ddf97267f69b110f4 (patch) | |
tree | 677bf06ed90113864db8726610736564b4c13da2 /net/batman-adv/soft-interface.c | |
parent | 3f1e08d0ae6746379b9e21264dae52f4f35c7ad2 (diff) |
batman-adv: Fix potentially broken skb network header access
The two commits noted below added calls to ip_hdr() and ipv6_hdr(). They
need a correctly set skb network header.
Unfortunately we cannot rely on the device drivers to set it for us.
Therefore setting it in the beginning of the according ndo_start_xmit
handler.
Fixes: 1d8ab8d3c176 ("batman-adv: Modified forwarding behaviour for multicast packets")
Fixes: ab49886e3da7 ("batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r-- | net/batman-adv/soft-interface.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index c002961da75d..926292d5ffa8 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -202,6 +202,7 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
202 | int gw_mode; | 202 | int gw_mode; |
203 | enum batadv_forw_mode forw_mode; | 203 | enum batadv_forw_mode forw_mode; |
204 | struct batadv_orig_node *mcast_single_orig = NULL; | 204 | struct batadv_orig_node *mcast_single_orig = NULL; |
205 | int network_offset = ETH_HLEN; | ||
205 | 206 | ||
206 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) | 207 | if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) |
207 | goto dropped; | 208 | goto dropped; |
@@ -214,14 +215,18 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
214 | case ETH_P_8021Q: | 215 | case ETH_P_8021Q: |
215 | vhdr = vlan_eth_hdr(skb); | 216 | vhdr = vlan_eth_hdr(skb); |
216 | 217 | ||
217 | if (vhdr->h_vlan_encapsulated_proto != ethertype) | 218 | if (vhdr->h_vlan_encapsulated_proto != ethertype) { |
219 | network_offset += VLAN_HLEN; | ||
218 | break; | 220 | break; |
221 | } | ||
219 | 222 | ||
220 | /* fall through */ | 223 | /* fall through */ |
221 | case ETH_P_BATMAN: | 224 | case ETH_P_BATMAN: |
222 | goto dropped; | 225 | goto dropped; |
223 | } | 226 | } |
224 | 227 | ||
228 | skb_set_network_header(skb, network_offset); | ||
229 | |||
225 | if (batadv_bla_tx(bat_priv, skb, vid)) | 230 | if (batadv_bla_tx(bat_priv, skb, vid)) |
226 | goto dropped; | 231 | goto dropped; |
227 | 232 | ||