virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Varka Bhadram <varkabhadram@gmail.com>
To: Ben Hutchings <ben@decadent.org.uk>, netdev@vger.kernel.org
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH net 1/2] drivers/net: Disable UFO through virtio
Date: Mon, 27 Oct 2014 10:15:56 +0530	[thread overview]
Message-ID: <544DCE04.50403@gmail.com> (raw)
In-Reply-To: <1414383748.16849.21.camel@decadent.org.uk>

On 10/27/2014 09:52 AM, Ben Hutchings wrote:
> IPv6 does not allow fragmentation by routers, so there is no
> fragmentation ID in the fixed header.  UFO for IPv6 requires the ID to
> be passed separately, but there is no provision for this in the virtio
> net protocol.
>
> Until recently our software implementation of UFO/IPv6 generated a new
> ID, but this was a bug.  Now we will use ID=0 for any UFO/IPv6 packet
> passed through a tap, which is even worse.
>
> Unfortunately there is no distinction between UFO/IPv4 and v6
> features, so disable UFO on taps and virtio_net completely until we
> have a proper solution.
>
> We cannot depend on VM managers respecting the tap feature flags, so
> keep accepting UFO packets but log a warning the first time we do
> this.

(...)

> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 186ce54..e8b949a 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -174,7 +174,7 @@ struct tun_struct {
>   	struct net_device	*dev;
>   	netdev_features_t	set_features;
>   #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \
> -			  NETIF_F_TSO6|NETIF_F_UFO)
> +			  NETIF_F_TSO6)
>   
>   	int			vnet_hdr_sz;
>   	int			sndbuf;
> @@ -1149,8 +1149,17 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
>   			skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
>   			break;
>   		case VIRTIO_NET_HDR_GSO_UDP:
> +		{
> +			static bool warned;

one line space after declaration..

> +			if (!warned) {
> +				warned = true;
> +				netdev_warn(tun->dev,
> +					    "%s: using disabled UFO feature; please fix this program\n",
> +					    current->comm);
> +			}
>   			skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
>   			break;
> +		}
>   		default:
>   			tun->dev->stats.rx_frame_errors++;
>   			kfree_skb(skb);
> @@ -1251,8 +1260,6 @@ static ssize_t tun_put_user(struct tun_struct *tun,
>   				gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
>   			else if (sinfo->gso_type & SKB_GSO_TCPV6)
>   				gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
> -			else if (sinfo->gso_type & SKB_GSO_UDP)
> -				gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
>   			else {
>   				pr_err("unexpected GSO type: "
>   				       "0x%x, gso_size %d, hdr_len %d\n",
> @@ -1762,11 +1769,6 @@ static int set_offload(struct tun_struct *tun, unsigned long arg)
>   				features |= NETIF_F_TSO6;
>   			arg &= ~(TUN_F_TSO4|TUN_F_TSO6);
>   		}
> -
> -		if (arg & TUN_F_UFO) {
> -			features |= NETIF_F_UFO;
> -			arg &= ~TUN_F_UFO;
> -		}
>   	}
>   
>   	/* This gives the user a way to test for new features in future by
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index d75256bd..e9e269d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -491,8 +491,16 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
>   			skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
>   			break;
>   		case VIRTIO_NET_HDR_GSO_UDP:
> +		{
> +			static bool warned;

dto...

> +			if (!warned) {
> +				warned = true;
> +				netdev_warn(dev,
> +					    "host using disabled UFO feature; please fix it\n");
> +			}
>   			skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
>   			break;
> +		}
>   

(...)

>
>
-- 
Thanks and Regards,
Varka Bhadram.

  reply	other threads:[~2014-10-27  4:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  4:17 [PATCH net 0/2] drivers/net,ipv6: Fix IPv6 fragment ID selection for virtio Ben Hutchings
2014-10-27  4:22 ` [PATCH net 1/2] drivers/net: Disable UFO through virtio Ben Hutchings
2014-10-27  4:45   ` Varka Bhadram [this message]
2014-10-27  4:23 ` [PATCH net 2/2] drivers/net,ipv6: Select IPv6 fragment idents for virtio UFO packets Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=544DCE04.50403@gmail.com \
    --to=varkabhadram@gmail.com \
    --cc=ben@decadent.org.uk \
    --cc=hannes@stressinduktion.org \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).