From: bernard pidoux <f6bvp@free.fr>
To: Linux netdev <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: [PATCH 2/3] [AX25] zero length frame filtering in AX25
Date: Thu, 19 Mar 2009 19:18:15 +0100 [thread overview]
Message-ID: <1237486695.30285.17.camel@f6bvp-11> (raw)
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>
---
net/ax25/af_ax25.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 532a031..ca32f57 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,
size_t size;
int lv, err, addr_len = msg->msg_namelen;
+ /* AX.25 empty data frame has no meaning : don't send */
+ if (len == 0) {
+ return (0);
+ }
+
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL;
@@ -1634,6 +1639,13 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
skb_reset_transport_header(skb);
copied = skb->len;
+ /* AX.25 empty data frame has no meaning : ignore it */
+ if (copied == 0) {
+ err = copied;
+ skb_free_datagram(sk, skb);
+ goto out;
+ }
+
if (copied > size) {
copied = size;
msg->msg_flags |= MSG_TRUNC;
--
1.6.0.6
next reply other threads:[~2009-03-19 18:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-19 18:18 bernard pidoux [this message]
2009-03-21 20:34 ` [PATCH 2/3] [AX25] zero length frame filtering in AX25 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237486695.30285.17.camel@f6bvp-11 \
--to=f6bvp@free.fr \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).