Skip to content

Commit

Permalink
rose: zero length frame filtering in af_rose.c
Browse files Browse the repository at this point in the history
Since changeset e79ad71 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bernard Pidoux authored and David S. Miller committed Nov 25, 2008
1 parent 631339f commit 244f46a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/rose/af_rose.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,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;

Expand Down Expand Up @@ -1265,6 +1269,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;
Expand Down

0 comments on commit 244f46a

Please sign in to comment.