netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts
@ 2015-07-20 15:44 Ivan Vecera
  2015-07-20 16:42 ` Vlad Yasevich
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Vecera @ 2015-07-20 15:44 UTC (permalink / raw)
  To: netdev

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.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/macvtap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3b933bb..cdcbab4 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -796,6 +796,12 @@ 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;
 
+	if (skb_vlan_tagged(skb)) {
+		int depth;
+		skb->protocol = __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] 3+ messages in thread

* Re: [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts
  2015-07-20 15:44 [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
@ 2015-07-20 16:42 ` Vlad Yasevich
  2015-07-21  7:11   ` Ivan Vecera
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Yasevich @ 2015-07-20 16:42 UTC (permalink / raw)
  To: Ivan Vecera, netdev

On 07/20/2015 11:44 AM, 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.
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
> ---
>  drivers/net/macvtap.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 3b933bb..cdcbab4 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -796,6 +796,12 @@ 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;
>  
> +	if (skb_vlan_tagged(skb)) {
> +		int depth;
> +		skb->protocol = __vlan_get_protocol(skb, skb->protocol, &depth);

I don't think this is right.  This would reset the protocol to the encapsulated
protocol which isn't really the case since you are not really stripping vlan
encapsulations.

-vlad

> +		skb_set_network_header(skb, depth);
> +	}
> +
>  	if (vnet_hdr_len) {
>  		err = macvtap_skb_from_vnet_hdr(q, skb, &vnet_hdr);
>  		if (err)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts
  2015-07-20 16:42 ` Vlad Yasevich
@ 2015-07-21  7:11   ` Ivan Vecera
  0 siblings, 0 replies; 3+ messages in thread
From: Ivan Vecera @ 2015-07-21  7:11 UTC (permalink / raw)
  To: Vlad Yasevich, netdev

On 07/20/2015 06:42 PM, Vlad Yasevich wrote:
> On 07/20/2015 11:44 AM, 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.
>>
>> Signed-off-by: Ivan Vecera <ivecera@redhat.com>
>> ---
>>   drivers/net/macvtap.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
>> index 3b933bb..cdcbab4 100644
>> --- a/drivers/net/macvtap.c
>> +++ b/drivers/net/macvtap.c
>> @@ -796,6 +796,12 @@ 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;
>>
>> +	if (skb_vlan_tagged(skb)) {
>> +		int depth;
>> +		skb->protocol = __vlan_get_protocol(skb, skb->protocol, &depth);
>
> I don't think this is right.  This would reset the protocol to the encapsulated
> protocol which isn't really the case since you are not really stripping vlan
> encapsulations.
>
> -vlad
Yup, you are right, skb->protocol should be untouched. Will post v2.

Ivan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-21  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 15:44 [PATCH net] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
2015-07-20 16:42 ` Vlad Yasevich
2015-07-21  7:11   ` Ivan Vecera

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).