This is a note to let you know that I've just added the patch titled packet: set transport header before doing xmit to the 3.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: packet-set-transport-header-before-doing-xmit.patch and it can be found in the queue-3.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ef3b314c6abfcfa731b42d5b4e0cff9fb57ae53f Mon Sep 17 00:00:00 2001 From: Jason Wang <jasowang@xxxxxxxxxx> Date: Mon, 25 Mar 2013 20:19:57 +0000 Subject: packet: set transport header before doing xmit From: Jason Wang <jasowang@xxxxxxxxxx> [ Upstream commit c1aad275b0293d2b1905ec95a945422262470684 ] Set the transport header for 1) some drivers (e.g ixgbe needs l4 header to do atr) 2) precise packet length estimation (introduced in 1def9238) needs l4 header to compute header length. So this patch first tries to get l4 header for packet socket through skb_flow_dissect(), and pretend no l4 header if skb_flow_dissect() fails. Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx> Cc: Eric Dumazet <edumazet@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/packet/af_packet.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -88,6 +88,7 @@ #include <linux/virtio_net.h> #include <linux/errqueue.h> #include <linux/net_tstamp.h> +#include <net/flow_keys.h> #ifdef CONFIG_INET #include <net/inet_common.h> @@ -1343,6 +1344,7 @@ static int packet_sendmsg_spkt(struct ki __be16 proto = 0; int err; int extra_len = 0; + struct flow_keys keys; /* * Get and verify the address. @@ -1443,6 +1445,11 @@ retry: if (unlikely(extra_len == 4)) skb->no_fcs = 1; + if (skb_flow_dissect(skb, &keys)) + skb_set_transport_header(skb, keys.thoff); + else + skb_reset_transport_header(skb); + dev_queue_xmit(skb); rcu_read_unlock(); return len; @@ -1849,6 +1856,7 @@ static int tpacket_fill_skb(struct packe struct page *page; void *data; int err; + struct flow_keys keys; ph.raw = frame; @@ -1874,6 +1882,11 @@ static int tpacket_fill_skb(struct packe skb_reserve(skb, hlen); skb_reset_network_header(skb); + if (skb_flow_dissect(skb, &keys)) + skb_set_transport_header(skb, keys.thoff); + else + skb_reset_transport_header(skb); + if (po->tp_tx_has_off) { int off_min, off_max, off; off_min = po->tp_hdrlen - sizeof(struct sockaddr_ll); @@ -2130,6 +2143,7 @@ static int packet_snd(struct socket *soc unsigned short gso_type = 0; int hlen, tlen; int extra_len = 0; + struct flow_keys keys; /* * Get and verify the address. @@ -2282,6 +2296,13 @@ static int packet_snd(struct socket *soc len += vnet_hdr_len; } + if (skb->ip_summed == CHECKSUM_PARTIAL) + skb_set_transport_header(skb, skb_checksum_start_offset(skb)); + else if (skb_flow_dissect(skb, &keys)) + skb_set_transport_header(skb, keys.thoff); + else + skb_set_transport_header(skb, reserve); + if (unlikely(extra_len == 4)) skb->no_fcs = 1; Patches currently in stable-queue which might be from jasowang@xxxxxxxxxx are queue-3.9/tuntap-forbid-changing-mq-flag-for-persistent-device.patch queue-3.9/packet-set-transport-header-before-doing-xmit.patch queue-3.9/netback-set-transport-header-before-passing-it-to-kernel.patch queue-3.9/net_sched-better-precise-estimation-on-packet-length-for-untrusted-packets.patch queue-3.9/tuntap-set-sock_zerocopy-flag-during-open.patch queue-3.9/tuntap-set-transport-header-before-passing-it-to-kernel.patch queue-3.9/tuntap-correct-the-return-value-in-tun_set_iff.patch queue-3.9/macvtap-set-transport-header-before-passing-skb-to-lower-device.patch queue-3.9/vhost_net-clear-msg.control-for-non-zerocopy-case-during-tx.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html