summaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2015-11-22 17:46:09 +0100
committerDavid S. Miller <davem@davemloft.net>2015-11-29 22:17:17 -0500
commit880621c2605b82eb5af91a2c94223df6f5a3fb64 (patch)
treeb1a1799ef943f2aa04d35530e47dae15282cb2ab /net/packet
parentc9da161c6517ba12154059d3b965c2cbaf16f90f (diff)
downloadop-kernel-dev-880621c2605b82eb5af91a2c94223df6f5a3fb64.zip
op-kernel-dev-880621c2605b82eb5af91a2c94223df6f5a3fb64.tar.gz
packet: Allow packets with only a header (but no payload)
Commit 9c7077622dd91 ("packet: make packet_snd fail on len smaller than l2 header") added validation for the packet size in packet_snd. This change enforces that every packet needs a header (with at least hard_header_len bytes) plus a payload with at least one byte. Before this change the payload was optional. This fixes PPPoE connections which do not have a "Service" or "Host-Uniq" configured (which is violating the spec, but is still widely used in real-world setups). Those are currently failing with the following message: "pppd: packet size is too short (24 <= 24)" Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1cf928f..992396a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2329,8 +2329,8 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
static bool ll_header_truncated(const struct net_device *dev, int len)
{
/* net device doesn't like empty head */
- if (unlikely(len <= dev->hard_header_len)) {
- net_warn_ratelimited("%s: packet size is too short (%d <= %d)\n",
+ if (unlikely(len < dev->hard_header_len)) {
+ net_warn_ratelimited("%s: packet size is too short (%d < %d)\n",
current->comm, len, dev->hard_header_len);
return true;
}
OpenPOWER on IntegriCloud