search for: skb_partial_csum_set

Displaying 20 results from an estimated 66 matches for "skb_partial_csum_set".

2008 Jan 15
2
[PATCH 1/3] skb_partial_csum_set
Implement skb_partial_csum_set, for setting partial csums on untrusted packets. Use it in virtio_net (replacing buggy version there), it's also going to be used by TAP for partial csum support. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/net/virtio_net.c | 11 +---------- include/linux/skbuff....
2008 Jan 15
2
[PATCH 1/3] skb_partial_csum_set
Implement skb_partial_csum_set, for setting partial csums on untrusted packets. Use it in virtio_net (replacing buggy version there), it's also going to be used by TAP for partial csum support. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> --- drivers/net/virtio_net.c | 11 +---------- include/linux/skbuff....
2008 May 29
1
[PATCH 3/3] virtio_net: Fix skb->csum_start computation
On Tue, May 27, 2008 at 12:20:47PM +0100, Mark McLoughlin wrote: > hdr->csum_start is the offset from the start of the ethernet > header to the transport layer checksum field. skb->csum_start > is the offset from skb->head. > > skb_partial_csum_set() assumes that skb->data points to the > ethernet header - i.e. it computes skb->csum_start by adding > the headroom to hdr->csum_start. > > Since eth_type_trans() skb_pull()s the ethernet header, > skb_partial_csum_set() should be called before > eth_type_trans(). >...
2008 May 29
1
[PATCH 3/3] virtio_net: Fix skb->csum_start computation
On Tue, May 27, 2008 at 12:20:47PM +0100, Mark McLoughlin wrote: > hdr->csum_start is the offset from the start of the ethernet > header to the transport layer checksum field. skb->csum_start > is the offset from skb->head. > > skb_partial_csum_set() assumes that skb->data points to the > ethernet header - i.e. it computes skb->csum_start by adding > the headroom to hdr->csum_start. > > Since eth_type_trans() skb_pull()s the ethernet header, > skb_partial_csum_set() should be called before > eth_type_trans(). >...
2008 Jun 16
1
[PATCH] virtio_net: Fix skb->csum_start computation (2.6.24, 2.6.25)
From: Mark McLoughlin <markmc at redhat.com> hdr->csum_start is the offset from the start of the ethernet header to the transport layer checksum field. skb->csum_start is the offset from skb->head. skb_partial_csum_set() assumes that skb->data points to the ethernet header - i.e. it computes skb->csum_start by adding the headroom to hdr->csum_start. Since eth_type_trans() skb_pull()s the ethernet header, skb_partial_csum_set() should be called before eth_type_trans(). (Without this patch, GSO packets f...
2008 Jun 16
1
[PATCH] virtio_net: Fix skb->csum_start computation (2.6.24, 2.6.25)
From: Mark McLoughlin <markmc at redhat.com> hdr->csum_start is the offset from the start of the ethernet header to the transport layer checksum field. skb->csum_start is the offset from skb->head. skb_partial_csum_set() assumes that skb->data points to the ethernet header - i.e. it computes skb->csum_start by adding the headroom to hdr->csum_start. Since eth_type_trans() skb_pull()s the ethernet header, skb_partial_csum_set() should be called before eth_type_trans(). (Without this patch, GSO packets f...
2008 Jun 08
2
[PATCH 1/4] virtio_net: Fix skb->csum_start computation
From: Mark McLoughlin <markmc at redhat.com> hdr->csum_start is the offset from the start of the ethernet header to the transport layer checksum field. skb->csum_start is the offset from skb->head. skb_partial_csum_set() assumes that skb->data points to the ethernet header - i.e. it computes skb->csum_start by adding the headroom to hdr->csum_start. Since eth_type_trans() skb_pull()s the ethernet header, skb_partial_csum_set() should be called before eth_type_trans(). (Without this patch, GSO packets f...
2008 Jun 19
0
[patch 05/15] virtio_net: Fix skb->csum_start computation
...know. ------------------ From: Mark McLoughlin <markmc at redhat.com> commit 23cde76d801246a702e7a84c3fe3d655b35c89a1 upstream. hdr->csum_start is the offset from the start of the ethernet header to the transport layer checksum field. skb->csum_start is the offset from skb->head. skb_partial_csum_set() assumes that skb->data points to the ethernet header - i.e. it computes skb->csum_start by adding the headroom to hdr->csum_start. Since eth_type_trans() skb_pull()s the ethernet header, skb_partial_csum_set() should be called before eth_type_trans(). (Without this patch, GSO packets f...
2008 May 29
0
[PATCH 2/3] virtio_net: Trivial coding style fix
On Tuesday 27 May 2008 21:20:46 Mark McLoughlin wrote: > - if (!skb_partial_csum_set(skb,hdr->csum_start,hdr->csum_offset)) > + if (!skb_partial_csum_set(skb, hdr->csum_start, hdr->csum_offset)) I compressed the whitespace to avoid going over 80 cols. A choice of lesser evils :) Cheers, Rusty.
2014 Oct 23
0
[PATCH RFC] tun: fix sparse warnings for virtio headers
...gso.hdr_len; + linear = __virtio16_to_cpu(false, gso.hdr_len); } skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); @@ -1105,8 +1105,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { - if (!skb_partial_csum_set(skb, gso.csum_start, - gso.csum_offset)) { + if (!skb_partial_csum_set(skb, __virtio16_to_cpu(false, gso.csum_start), + __virtio16_to_cpu(false, gso.csum_offset))) { tun->dev->stats.rx_frame_errors++; kfree_skb(skb); return -EINVAL; @@ -1160,7 +1160,7 @@ static ssize_...
2014 Oct 23
0
[PATCH RFC] tun: fix sparse warnings for virtio headers
...gso.hdr_len; + linear = __virtio16_to_cpu(false, gso.hdr_len); } skb = tun_alloc_skb(tfile, align, copylen, linear, noblock); @@ -1105,8 +1105,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, } if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { - if (!skb_partial_csum_set(skb, gso.csum_start, - gso.csum_offset)) { + if (!skb_partial_csum_set(skb, __virtio16_to_cpu(false, gso.csum_start), + __virtio16_to_cpu(false, gso.csum_offset))) { tun->dev->stats.rx_frame_errors++; kfree_skb(skb); return -EINVAL; @@ -1160,7 +1160,7 @@ static ssize_...
2018 Apr 11
3
[PATCH net-next 1/5] virtio: Add support for SCTP checksum offloading
...ST_TSO6, \ > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index f144216..2e7a64a 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -39,6 +39,9 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, > > if (!skb_partial_csum_set(skb, start, off)) > return -EINVAL; > + > + if (hdr->flags & VIRTIO_NET_HDR_F_CSUM_NOT_INET) > + skb->csum_not_inet = 1; > } > > if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { > @@ -96,6 +99,9 @@ static inline int virtio_net_hdr_from_skb(const stru...
2018 Apr 11
3
[PATCH net-next 1/5] virtio: Add support for SCTP checksum offloading
...ST_TSO6, \ > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h > index f144216..2e7a64a 100644 > --- a/include/linux/virtio_net.h > +++ b/include/linux/virtio_net.h > @@ -39,6 +39,9 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, > > if (!skb_partial_csum_set(skb, start, off)) > return -EINVAL; > + > + if (hdr->flags & VIRTIO_NET_HDR_F_CSUM_NOT_INET) > + skb->csum_not_inet = 1; > } > > if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { > @@ -96,6 +99,9 @@ static inline int virtio_net_hdr_from_skb(const stru...
2013 Nov 28
4
[PATCH net] xen-netback: fix fragment detection in checksum setup
...(skb, header_size); + if (ntohs(iph->frag_off) & 0x3fff) + fragment = true; + off = iph->ihl * 4; + if (fragment) { + if (net_ratelimit()) + netdev_err(vif->dev, "Packet is a fragment!\n"); + goto out; + } + switch (iph->protocol) { case IPPROTO_TCP: if (!skb_partial_csum_set(skb, off, @@ -1237,6 +1249,7 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, bool fragment; bool done; + fragment = false; done = false; off = sizeof(struct ipv6hdr); @@ -1275,9 +1288,21 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb...
2016 Jun 08
7
[PATCH 0/6] virtio_net: use common code for virtio_net_hdr and skb GSO conversion
Hi, This patches introduce virtio_net_hdr_{from,to}_skb functions for conversion of GSO information between skb and virtio_net_hdr. Mike Rapoport (6): virtio_net: add _UAPI prefix to virtio_net header guards virtio_net: introduce virtio_net_hdr_{from,to}_skb macvtap: use common code for virtio_net_hdr and skb GSO conversion tuntap: use common code for virtio_net_hdr and skb GSO
2016 Jun 08
7
[PATCH 0/6] virtio_net: use common code for virtio_net_hdr and skb GSO conversion
Hi, This patches introduce virtio_net_hdr_{from,to}_skb functions for conversion of GSO information between skb and virtio_net_hdr. Mike Rapoport (6): virtio_net: add _UAPI prefix to virtio_net header guards virtio_net: introduce virtio_net_hdr_{from,to}_skb macvtap: use common code for virtio_net_hdr and skb GSO conversion tuntap: use common code for virtio_net_hdr and skb GSO
2018 Apr 16
1
[PATCH net-next 1/5] virtio: Add support for SCTP checksum offloading
...h b/include/linux/virtio_net.h > >> index f144216..2e7a64a 100644 > >> --- a/include/linux/virtio_net.h > >> +++ b/include/linux/virtio_net.h > >> @@ -39,6 +39,9 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, > >> > >> if (!skb_partial_csum_set(skb, start, off)) > >> return -EINVAL; > >> + > >> + if (hdr->flags & VIRTIO_NET_HDR_F_CSUM_NOT_INET) > >> + skb->csum_not_inet = 1; > >> } > >> > >> if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { > >&gt...
2015 Sep 24
2
[PATCH v2] Fix AF_PACKET ABI breakage in 4.2
...T_HDR_F_NEEDS_CSUM) { > - u16 s = __virtio16_to_cpu(false, vnet_hdr.csum_start); > - u16 o = __virtio16_to_cpu(false, vnet_hdr.csum_offset); > + u16 s = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_start); > + u16 o = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_offset); > if (!skb_partial_csum_set(skb, s, o)) { > err = -EINVAL; > goto out_free; > @@ -2787,7 +2789,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) > } > > skb_shinfo(skb)->gso_size = > - __virtio16_to_cpu(false, vnet_hdr.gso_size); > + __virtio16_to_...
2015 Sep 24
2
[PATCH v2] Fix AF_PACKET ABI breakage in 4.2
...T_HDR_F_NEEDS_CSUM) { > - u16 s = __virtio16_to_cpu(false, vnet_hdr.csum_start); > - u16 o = __virtio16_to_cpu(false, vnet_hdr.csum_offset); > + u16 s = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_start); > + u16 o = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_offset); > if (!skb_partial_csum_set(skb, s, o)) { > err = -EINVAL; > goto out_free; > @@ -2787,7 +2789,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) > } > > skb_shinfo(skb)->gso_size = > - __virtio16_to_cpu(false, vnet_hdr.gso_size); > + __virtio16_to_...
2020 Jun 05
0
[PATCH AUTOSEL 5.6 06/17] net: check untrusted gso_size at kernel entry
...e int virtio_net_hdr_to_skb(struct sk_buff *skb, { unsigned int gso_type = 0; unsigned int thlen = 0; + unsigned int p_off = 0; unsigned int ip_proto; if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { @@ -68,7 +69,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, if (!skb_partial_csum_set(skb, start, off)) return -EINVAL; - if (skb_transport_offset(skb) + thlen > skb_headlen(skb)) + p_off = skb_transport_offset(skb) + thlen; + if (p_off > skb_headlen(skb)) return -EINVAL; } else { /* gso packets without NEEDS_CSUM do not set transport_offset. @@ -92,17 +94,25...