* [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts
@ 2015-07-21 7:18 Ivan Vecera
2015-07-21 14:44 ` Toshiaki Makita
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vecera @ 2015-07-21 7:18 UTC (permalink / raw)
To: netdev; +Cc: vyasevich
Network header is set with offset ETH_HLEN but it is not true for VLAN
(multiple-)tagged and results in checksum issues in lower devices.
v2: leave skb->protocol untouched (thx Vlad), comment added
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/net/macvtap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3b933bb..b75776b 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -796,6 +796,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
skb_reset_mac_header(skb);
skb->protocol = eth_hdr(skb)->h_proto;
+ /* Move network header to the right position for VLAN tagged packets */
+ if (skb_vlan_tagged(skb)) {
+ int depth;
+ __vlan_get_protocol(skb, skb->protocol, &depth);
+ skb_set_network_header(skb, depth);
+ }
+
if (vnet_hdr_len) {
err = macvtap_skb_from_vnet_hdr(q, skb, &vnet_hdr);
if (err)
--
2.3.6
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts
2015-07-21 7:18 [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
@ 2015-07-21 14:44 ` Toshiaki Makita
0 siblings, 0 replies; 2+ messages in thread
From: Toshiaki Makita @ 2015-07-21 14:44 UTC (permalink / raw)
To: Ivan Vecera, netdev; +Cc: vyasevich
On 15/07/21 (火) 16:18, Ivan Vecera wrote:
> Network header is set with offset ETH_HLEN but it is not true for VLAN
> (multiple-)tagged and results in checksum issues in lower devices.
>
> v2: leave skb->protocol untouched (thx Vlad), comment added
>
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
> drivers/net/macvtap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 3b933bb..b75776b 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -796,6 +796,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
> skb_reset_mac_header(skb);
> skb->protocol = eth_hdr(skb)->h_proto;
>
> + /* Move network header to the right position for VLAN tagged packets */
> + if (skb_vlan_tagged(skb)) {
I guess you don't need the condition skb_vlan_tag_present(skb), i.e.,
if (skb->protocol == htons(ETH_P_8021Q) ||
skb->protocol == htons(ETH_P_8021AD))
> + int depth;
> + __vlan_get_protocol(skb, skb->protocol, &depth);
__vlan_get_protocol() can fail, and then, depth will not be initialized.
> + skb_set_network_header(skb, depth);
I think you should set network_header after
skb_probe_transport_header(). It calls skb_flow_dissect_flow_keys(),
which seems to expect network_header to be ETH_HLEN.
Toshiaki Makita
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-21 14:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 7:18 [PATCH net v2] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
2015-07-21 14:44 ` Toshiaki Makita
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).