Skip to content

Commit

Permalink
[X25]: Fix for broken x25 module.
Browse files Browse the repository at this point in the history
When a user-space server application calls bind on a socket, then in kernel
space this bound socket is considered 'x25-linked' and the SOCK_ZAPPED flag
is unset.(As in x25_bind()/af_x25.c).

Now when a user-space client application attempts to connect to the server
on the listening socket, if the kernel accepts this in-coming call, then it
returns a new socket to userland and attempts to reply to the caller.

The reply/x25_sendmsg() will fail, because the new socket created on
call-accept has its SOCK_ZAPPED flag set by x25_make_new().
(sock_init_data() called by x25_alloc_socket() called by x25_make_new()
sets the flag to SOCK_ZAPPED)).

Fix: Using the sock_copy_flag() routine available in sock.h fixes this.

Tested on 32 and 64 bit kernels with x25 over tcp.

Signed-off-by: Shaun Pereira <pereira.shaun@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shaun Pereira authored and David S. Miller committed Jan 6, 2006
1 parent 4bad4dc commit a20a855
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/x25/af_x25.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,7 @@ static struct sock *x25_make_new(struct sock *osk)
sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep;
sk->sk_backlog_rcv = osk->sk_backlog_rcv;

if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);

if (sock_flag(osk, SOCK_DBG))
sock_set_flag(sk, SOCK_DBG);
sock_copy_flags(sk, osk);

ox25 = x25_sk(osk);
x25->t21 = ox25->t21;
Expand Down

0 comments on commit a20a855

Please sign in to comment.