search for: skb_network_header

Displaying 20 results from an estimated 34 matches for "skb_network_header".

2014 Oct 21
2
IPv6 UFO for VMs
...macvtap.c: gso_type = SKB_GSO_UDP; drivers/net/tun.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; drivers/net/virtio_net.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; Our implementation of UFO for IPv6 does: fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; fptr->identification = skb_shinfo(skb)->ip6_frag_id; which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero. This seems to be a re...
2014 Oct 21
2
IPv6 UFO for VMs
...macvtap.c: gso_type = SKB_GSO_UDP; drivers/net/tun.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; drivers/net/virtio_net.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; Our implementation of UFO for IPv6 does: fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; fptr->identification = skb_shinfo(skb)->ip6_frag_id; which assumes ip6_frag_id has been set. That's only true if the local stack constructed the skb; otherwise it appears we get zero. This seems to be a re...
2014 Oct 22
0
IPv6 UFO for VMs
...o_type = SKB_GSO_UDP; > drivers/net/tun.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; > drivers/net/virtio_net.c: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; > > Our implementation of UFO for IPv6 does: > > fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); > fptr->nexthdr = nexthdr; > fptr->reserved = 0; > fptr->identification = skb_shinfo(skb)->ip6_frag_id; > > which assumes ip6_frag_id has been set. That's only true if the local > stack constructed the skb; otherwise it appears we ge...
2016 Feb 19
0
[Bug 1048] xt_bpf completely broken with kernel 4.3
..._OFF or SKF_NET_OFF offset to you load offsets in the K constant. It would require to use something like bpf_asm to write your filters by hand. F.e. if you look at bpf_internal_load_pointer_neg_helper() helper function in the kernel, they check for SKF_NET_OFF/SKF_LL_OFF and then use K relative to skb_network_header(skb) or skb_mac_header(skb), respectively. This should resolve your use-case. The problem is that with libpcap, the filters are generated for tcpdump specifically, and tcpdump doesn't need to care about SKF_NET_OFF/SKF_LL_OFF as it sees raw packet starting with Ethernet header. So, reusing lib...
2014 Oct 11
0
[PATCH net-next RFC 3/3] virtio-net: conditionally enable tx interrupt
...t; + ... > + > +static bool virtnet_skb_needs_intr(struct sk_buff *skb) > +{ > + union { > + unsigned char *network; > + struct iphdr *ipv4; > + struct ipv6hdr *ipv6; > + } hdr; > + struct tcphdr *th = tcp_hdr(skb); > + u16 payload_len; > + > + hdr.network = skb_network_header(skb); > + > + /* Only IPv4/IPv6 with TCP is supported */ Oh well, yet another packet flow dissector :) If most packets were caught by your implementation, you could use it for fast patj and fallback to skb_flow_dissect() for encapsulated traffic. struct flow_keys keys; if (!skb_flo...
2014 Oct 11
2
[PATCH net-next RFC 3/3] virtio-net: conditionally enable tx interrupt
...dd_outbuf(sq->vq, sq->sg, num_sg, skb, + GFP_ATOMIC); +} + +static bool virtnet_skb_needs_intr(struct sk_buff *skb) +{ + union { + unsigned char *network; + struct iphdr *ipv4; + struct ipv6hdr *ipv6; + } hdr; + struct tcphdr *th = tcp_hdr(skb); + u16 payload_len; + + hdr.network = skb_network_header(skb); + + /* Only IPv4/IPv6 with TCP is supported */ + if ((skb->protocol == htons(ETH_P_IP)) && + hdr.ipv4->protocol == IPPROTO_TCP) { + payload_len = ntohs(hdr.ipv4->tot_len) - hdr.ipv4->ihl * 4 - + th->doff * 4; + } else if ((skb->protocol == htons(ETH_P_IP...
2014 Oct 11
2
[PATCH net-next RFC 3/3] virtio-net: conditionally enable tx interrupt
...dd_outbuf(sq->vq, sq->sg, num_sg, skb, + GFP_ATOMIC); +} + +static bool virtnet_skb_needs_intr(struct sk_buff *skb) +{ + union { + unsigned char *network; + struct iphdr *ipv4; + struct ipv6hdr *ipv6; + } hdr; + struct tcphdr *th = tcp_hdr(skb); + u16 payload_len; + + hdr.network = skb_network_header(skb); + + /* Only IPv4/IPv6 with TCP is supported */ + if ((skb->protocol == htons(ETH_P_IP)) && + hdr.ipv4->protocol == IPPROTO_TCP) { + payload_len = ntohs(hdr.ipv4->tot_len) - hdr.ipv4->ihl * 4 - + th->doff * 4; + } else if ((skb->protocol == htons(ETH_P_IP...
2015 Jan 26
0
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
...= DIV_ROUND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb->ufo_fragid_set) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (!skb->ufo_fragid_set) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct rt6_info...
2015 Jan 26
0
[PATCH 1/3] ipv6: Select fragment id during UFO/GSO segmentation if not set.
...= DIV_ROUND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb->ufo_fragid_set) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (!skb->ufo_fragid_set) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct rt6_info...
2015 Jan 30
0
[PATCH v2 1/3] ipv6: Select fragment id during UFO segmentation if not set.
...UND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb_shinfo(skb)->ip6_frag_id) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (skb_shinfo(skb)->ip6_frag_id) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct r...
2015 Jan 30
0
[PATCH v2 1/3] ipv6: Select fragment id during UFO segmentation if not set.
...UND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb_shinfo(skb)->ip6_frag_id) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (skb_shinfo(skb)->ip6_frag_id) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct r...
2015 Feb 03
0
[PATCH v3 net 1/3] ipv6: Select fragment id during UFO segmentation if not set.
...UND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb_shinfo(skb)->ip6_frag_id) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (skb_shinfo(skb)->ip6_frag_id) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct r...
2015 Feb 03
0
[PATCH v3 net 1/3] ipv6: Select fragment id during UFO segmentation if not set.
...UND_UP(skb->len, mss); + /* Set the IPv6 fragment id if not set yet */ + if (!skb_shinfo(skb)->ip6_frag_id) + ipv6_proxy_select_ident(skb); + segs = NULL; goto out; } @@ -108,7 +112,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); fptr->nexthdr = nexthdr; fptr->reserved = 0; - fptr->identification = skb_shinfo(skb)->ip6_frag_id; + if (skb_shinfo(skb)->ip6_frag_id) + fptr->identification = skb_shinfo(skb)->ip6_frag_id; + else + ipv6_select_ident(fptr, + (struct r...
2007 Jul 24
0
[PATCH] virtio_net.c gso & feature support
...um_offset; + } else { + hdr->flags = 0; + hdr->csum_offset = hdr->csum_start = 0; + } + + if (skb_is_gso(skb)) { + printk("xmit: gso size %u len %u (%u/%u/%u)\n", + skb_shinfo(skb)->gso_size, skb->len, + skb_transport_header(skb) - skb->head, + skb_network_header(skb) - skb->head, + skb->data - skb->head); + hdr->gso_size = skb_shinfo(skb)->gso_size; + if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) + hdr->gso_type = VIRTIO_NET_GSO_TCP_ECN; + else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) + hdr->gso_ty...
2007 Jul 24
0
[PATCH] virtio_net.c gso & feature support
...um_offset; + } else { + hdr->flags = 0; + hdr->csum_offset = hdr->csum_start = 0; + } + + if (skb_is_gso(skb)) { + printk("xmit: gso size %u len %u (%u/%u/%u)\n", + skb_shinfo(skb)->gso_size, skb->len, + skb_transport_header(skb) - skb->head, + skb_network_header(skb) - skb->head, + skb->data - skb->head); + hdr->gso_size = skb_shinfo(skb)->gso_size; + if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) + hdr->gso_type = VIRTIO_NET_GSO_TCP_ECN; + else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) + hdr->gso_ty...
2014 Oct 14
0
[PATCH net-next RFC 3/3] virtio-net: conditionally enable tx interrupt
...); > +} > + > +static bool virtnet_skb_needs_intr(struct sk_buff *skb) > +{ > + union { > + unsigned char *network; > + struct iphdr *ipv4; > + struct ipv6hdr *ipv6; > + } hdr; > + struct tcphdr *th = tcp_hdr(skb); > + u16 payload_len; > + > + hdr.network = skb_network_header(skb); > + > + /* Only IPv4/IPv6 with TCP is supported */ > + if ((skb->protocol == htons(ETH_P_IP)) && > + hdr.ipv4->protocol == IPPROTO_TCP) { > + payload_len = ntohs(hdr.ipv4->tot_len) - hdr.ipv4->ihl * 4 - > + th->doff * 4; > + } else if (...
2015 Jan 30
9
[PATCH v2 0/3] Restore UFO support to virtio_net devices
commit 3d0ad09412ffe00c9afa201d01effdb6023d09b4 Author: Ben Hutchings <ben at decadent.org.uk> Date: Thu Oct 30 18:27:12 2014 +0000 drivers/net: Disable UFO through virtio Turned off UFO support to virtio-net based devices due to issues with IPv6 fragment id generation for UFO packets. The issue was that IPv6 UFO/GSO implementation expects the fragment id to be supplied in
2015 Jan 30
9
[PATCH v2 0/3] Restore UFO support to virtio_net devices
commit 3d0ad09412ffe00c9afa201d01effdb6023d09b4 Author: Ben Hutchings <ben at decadent.org.uk> Date: Thu Oct 30 18:27:12 2014 +0000 drivers/net: Disable UFO through virtio Turned off UFO support to virtio-net based devices due to issues with IPv6 fragment id generation for UFO packets. The issue was that IPv6 UFO/GSO implementation expects the fragment id to be supplied in
2015 Feb 03
4
[PATCH v4 net 0/3] Restore UFO support to virtio_net devices
commit 3d0ad09412ffe00c9afa201d01effdb6023d09b4 Author: Ben Hutchings <ben at decadent.org.uk> Date: Thu Oct 30 18:27:12 2014 +0000 drivers/net: Disable UFO through virtio Turned off UFO support to virtio-net based devices due to issues with IPv6 fragment id generation for UFO packets. The issue was that IPv6 UFO/GSO implementation expects the fragment id to be supplied in
2015 Feb 03
4
[PATCH v4 net 0/3] Restore UFO support to virtio_net devices
commit 3d0ad09412ffe00c9afa201d01effdb6023d09b4 Author: Ben Hutchings <ben at decadent.org.uk> Date: Thu Oct 30 18:27:12 2014 +0000 drivers/net: Disable UFO through virtio Turned off UFO support to virtio-net based devices due to issues with IPv6 fragment id generation for UFO packets. The issue was that IPv6 UFO/GSO implementation expects the fragment id to be supplied in