aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25
diff options
context:
space:
mode:
authorBernard Pidoux <f6bvp@amsat.org>2009-03-21 16:33:55 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-21 16:33:55 -0400
commitf99bcff7a290768e035f3d4726e103c6ebe858bf (patch)
tree1e172c814ccdf2839b8cc6b736a2db309ec0318b /net/ax25
parent60784427ab331dc13c070ac4b0cc9a735bdfa9c0 (diff)
ax25: zero length frame filtering in AX25
In previous commit 244f46ae6e9e18f6fc0be7d1f49febde4762c34b was introduced a zero length frame filter for ROSE protocole. This patch has the same purpose at AX25 frame level for the same reason. Empty frames have no meaning in AX25 protocole. Signed-off-by: Bernard Pidoux <f6bvp@amsat.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25')
-rw-r--r--net/ax25/af_ax25.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index fd9d06f291dc..7da5ebb84e97 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1435,6 +1435,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1435 size_t size; 1435 size_t size;
1436 int lv, err, addr_len = msg->msg_namelen; 1436 int lv, err, addr_len = msg->msg_namelen;
1437 1437
1438 /* AX.25 empty data frame has no meaning : don't send */
1439 if (len == 0) {
1440 return (0);
1441 }
1442
1438 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) 1443 if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
1439 return -EINVAL; 1444 return -EINVAL;
1440 1445
@@ -1634,6 +1639,13 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
1634 skb_reset_transport_header(skb); 1639 skb_reset_transport_header(skb);
1635 copied = skb->len; 1640 copied = skb->len;
1636 1641
1642 /* AX.25 empty data frame has no meaning : ignore it */
1643 if (copied == 0) {
1644 err = copied;
1645 skb_free_datagram(sk, skb);
1646 goto out;
1647 }
1648
1637 if (copied > size) { 1649 if (copied > size) {
1638 copied = size; 1650 copied = size;
1639 msg->msg_flags |= MSG_TRUNC; 1651 msg->msg_flags |= MSG_TRUNC;