netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [ROSE] zero length frame filtering in af_rose.c
@ 2008-11-22 10:08 Bernard Pidoux
  2008-11-23 23:56 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Bernard Pidoux @ 2008-11-22 10:08 UTC (permalink / raw)
  To: Linux Netdev, Linux Hams; +Cc: Ralf DL5RB, David Miller

Since changeset e79ad711a0108475c1b3a03815527e7237020b08 from  mainline.
From: David S. Miller <davem@davemloft.net>
empty packet can be transmitted on connected socket for datagram protocols.

However, this patch broke a high level application using ROSE network 
protocole with connected datagram.

Bulletin Board Stations perform bulletins forwarding between BBS stations by  
radio and ROSE network using a forward protocole.
Now, if for some reason, a sending buffer in the application software happens 
to be empty at a specific moment, ROSE relays an empty packet via unfiltred 
packet socket.
When received, this ROSE packet introduces perturbations of BBS data 
forwarding protocole, for the application protocole is waiting for something 
else than an empty packet.
We agree that a more carefull programming of the application protocole would 
avoid this situation and we are willing to debug it.
But, as an empty frame is no use, and does not have any meaning for ROSE 
protocole, we may consider filtering zero length data both when sending and 
receiving socket data.

The proposed patch repairs BBS data exchange through ROSE network that were 
broken since 2.6.22.11 kernel.

Signed-off-by: Bernard Pidoux <f6bvp@amsat.org>
---
 net/rose/af_rose.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 8a54cff..92af3a6 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1075,6 +1075,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct 
socket *sock,
        unsigned char *asmptr;
        int n, size, qbit = 0;
 
+       /* ROSE empty 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;
 
@@ -1268,6 +1272,12 @@ static int rose_recvmsg(struct kiocb *iocb, struct 
socket *sock,
        skb_reset_transport_header(skb);
        copied     = skb->len;
 
+       /* ROSE empty frame has no meaning : ignore it */
+       if (copied == 0) {
+               skb_free_datagram(sk, skb);
+               return copied;
+       }
+
        if (copied > size) {
                copied = size;
                msg->msg_flags |= MSG_TRUNC;
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [ROSE] zero length frame filtering in af_rose.c
  2008-11-22 10:08 Bernard Pidoux
@ 2008-11-23 23:56 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-11-23 23:56 UTC (permalink / raw)
  To: f6bvp, bpidoux; +Cc: netdev, linux-hams, ralf

From: Bernard Pidoux <bpidoux@free.fr>
Date: Sat, 22 Nov 2008 11:08:52 +0100

> +       }
> +
>         if (copied > size) {
>                 copied = size;
>                 msg->msg_flags |= MSG_TRUNC;
> -- 

This patch, as well as your changelog message, have space
and tab characters severely corrupted by your email client.

Please fix this and resubmit.

In fact, this corruption is so severe I want you to email
this patch to yourself and try to apply it.  Do not resubmit
this until you can email the patch to yourself and apply it
cleanly.

Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] [ROSE] zero length frame filtering in af_rose.c
@ 2008-11-24 21:49 Bernard Pidoux
  2008-11-25  8:57 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Bernard Pidoux @ 2008-11-24 21:49 UTC (permalink / raw)
  To: Linux Netdev List, linux-hams; +Cc: Ralf Baechle DL5RB, David Miller

Since changeset e79ad711a0108475c1b3a03815527e7237020b08 from  mainline,
>From David S. Miller, 
empty packet can be transmitted on connected socket for datagram protocols.

However, this patch broke a high level application using ROSE network protocol with connected datagram.

Bulletin Board Stations perform bulletins forwarding between BBS stations via ROSE network using a forward protocol.
Now, if for some reason, a buffer in the application software happens to be empty at a specific moment,
ROSE sends an empty packet via unfiltered packet socket.
When received, this ROSE packet introduces perturbations of data exchange of BBS forwarding,
for the application message forwarding protocol is waiting for something else.
We agree that a more careful programming of the application protocol would avoid this situation and we are
willing to debug it.
But, as an empty frame is no use and does not have any meaning for ROSE protocol,
we may consider filtering zero length data both when sending and receiving socket data.

The proposed patch repaired BBS data exchange through ROSE network that were broken since 2.6.22.11 kernel.

Signed-off-by: Bernard Pidoux <f6bvp@amsat.org>
---
 net/rose/af_rose.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 8a54cff..92af3a6 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1075,6 +1075,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
 	unsigned char *asmptr;
 	int n, size, qbit = 0;
 
+	/* ROSE empty 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;
 
@@ -1268,6 +1272,12 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,
 	skb_reset_transport_header(skb);
 	copied     = skb->len;
 
+	/* ROSE empty frame has no meaning : ignore it */
+	if (copied == 0) {
+		skb_free_datagram(sk, skb);
+		return copied;
+	}
+
 	if (copied > size) {
 		copied = size;
 		msg->msg_flags |= MSG_TRUNC;
-- 
1.5.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [ROSE] zero length frame filtering in af_rose.c
  2008-11-24 21:49 [PATCH] [ROSE] zero length frame filtering in af_rose.c Bernard Pidoux
@ 2008-11-25  8:57 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-11-25  8:57 UTC (permalink / raw)
  To: bernard.pidoux; +Cc: netdev, linux-hams, ralf


Patch applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-25  8:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 21:49 [PATCH] [ROSE] zero length frame filtering in af_rose.c Bernard Pidoux
2008-11-25  8:57 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2008-11-22 10:08 Bernard Pidoux
2008-11-23 23:56 ` David Miller

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).