Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 368695
b: refs/heads/master
c: c1aad27
h: refs/heads/master
i:
  368693: fcfc42e
  368691: 1103e0b
  368687: f85d236
v: v3
  • Loading branch information
Jason Wang authored and David S. Miller committed Mar 26, 2013
1 parent b3369b1 commit 28de9a0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38502af77e07b5d6650b9ff99a0b482d86366592
refs/heads/master: c1aad275b0293d2b1905ec95a945422262470684
21 changes: 21 additions & 0 deletions trunk/net/packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -1412,6 +1413,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
__be16 proto = 0;
int err;
int extra_len = 0;
struct flow_keys keys;

/*
* Get and verify the address.
Expand Down Expand Up @@ -1512,6 +1514,11 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
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;
Expand Down Expand Up @@ -1918,6 +1925,7 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
struct page *page;
void *data;
int err;
struct flow_keys keys;

ph.raw = frame;

Expand All @@ -1943,6 +1951,11 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
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);
Expand Down Expand Up @@ -2199,6 +2212,7 @@ static int packet_snd(struct socket *sock,
unsigned short gso_type = 0;
int hlen, tlen;
int extra_len = 0;
struct flow_keys keys;

/*
* Get and verify the address.
Expand Down Expand Up @@ -2351,6 +2365,13 @@ static int packet_snd(struct socket *sock,
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;

Expand Down

0 comments on commit 28de9a0

Please sign in to comment.