diff options
author | Atzm Watanabe <atzm@stratosphere.co.jp> | 2013-12-17 08:53:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-18 00:36:16 -0500 |
commit | 51846355bc239b7d229ed7a1ea7b0333cbd23f01 (patch) | |
tree | 60a09f457a37d941159663fcaf26996a44e13d03 | |
parent | 9f605acf50ae31ce3ca5c061c3ce75d255ca1e6d (diff) |
packet: make aligned size of struct tpacket{2,3}_hdr clear
struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT.
We may add members to them until current aligned size without forcing
userspace to call getsockopt(..., PACKET_HDRLEN, ...).
Signed-off-by: Atzm Watanabe <atzm@stratosphere.co.jp>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/packet/af_packet.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 24675f06f4fd..4fd52181b6ce 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1812,6 +1812,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1812 | struct timespec ts; | 1812 | struct timespec ts; |
1813 | __u32 ts_status; | 1813 | __u32 ts_status; |
1814 | 1814 | ||
1815 | /* struct tpacket{2,3}_hdr is aligned to a multiple of TPACKET_ALIGNMENT. | ||
1816 | * We may add members to them until current aligned size without forcing | ||
1817 | * userspace to call getsockopt(..., PACKET_HDRLEN, ...). | ||
1818 | */ | ||
1819 | BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32); | ||
1820 | BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48); | ||
1821 | |||
1815 | if (skb->pkt_type == PACKET_LOOPBACK) | 1822 | if (skb->pkt_type == PACKET_LOOPBACK) |
1816 | goto drop; | 1823 | goto drop; |
1817 | 1824 | ||