Commit 3ad701b9 authored by Thomas Graf's avatar Thomas Graf

[NET] Convert sk_zapped into SOCK_ZAPPED flag

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 553f516c
...@@ -115,7 +115,6 @@ struct sock_common { ...@@ -115,7 +115,6 @@ struct sock_common {
/** /**
* struct sock - network layer representation of sockets * struct sock - network layer representation of sockets
* @__sk_common - shared layout with tcp_tw_bucket * @__sk_common - shared layout with tcp_tw_bucket
* @sk_zapped - ax25 & ipx means !linked
* @sk_shutdown - mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN * @sk_shutdown - mask of %SEND_SHUTDOWN and/or %RCV_SHUTDOWN
* @sk_use_write_queue - wheter to call sk->sk_write_space in sock_wfree * @sk_use_write_queue - wheter to call sk->sk_write_space in sock_wfree
* @sk_userlocks - %SO_SNDBUF and %SO_RCVBUF settings * @sk_userlocks - %SO_SNDBUF and %SO_RCVBUF settings
...@@ -191,7 +190,6 @@ struct sock { ...@@ -191,7 +190,6 @@ struct sock {
#define sk_node __sk_common.skc_node #define sk_node __sk_common.skc_node
#define sk_bind_node __sk_common.skc_bind_node #define sk_bind_node __sk_common.skc_bind_node
#define sk_refcnt __sk_common.skc_refcnt #define sk_refcnt __sk_common.skc_refcnt
volatile unsigned char sk_zapped;
unsigned char sk_shutdown; unsigned char sk_shutdown;
unsigned char sk_use_write_queue; unsigned char sk_use_write_queue;
unsigned char sk_userlocks; unsigned char sk_userlocks;
...@@ -391,6 +389,7 @@ enum sock_flags { ...@@ -391,6 +389,7 @@ enum sock_flags {
SOCK_DESTROY, SOCK_DESTROY,
SOCK_BROADCAST, SOCK_BROADCAST,
SOCK_TIMESTAMP, SOCK_TIMESTAMP,
SOCK_ZAPPED,
}; };
static inline void sock_set_flag(struct sock *sk, enum sock_flags flag) static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
......
...@@ -1041,7 +1041,7 @@ static int atalk_create(struct socket *sock, int protocol) ...@@ -1041,7 +1041,7 @@ static int atalk_create(struct socket *sock, int protocol)
sk_set_owner(sk, THIS_MODULE); sk_set_owner(sk, THIS_MODULE);
/* Checksums on by default */ /* Checksums on by default */
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
out: out:
return rc; return rc;
} }
...@@ -1120,7 +1120,7 @@ static int atalk_autobind(struct sock *sk) ...@@ -1120,7 +1120,7 @@ static int atalk_autobind(struct sock *sk)
n = atalk_pick_and_bind_port(sk, &sat); n = atalk_pick_and_bind_port(sk, &sat);
if (!n) if (!n)
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
out: out:
return n; return n;
} }
...@@ -1132,7 +1132,8 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1132,7 +1132,8 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct atalk_sock *at = at_sk(sk); struct atalk_sock *at = at_sk(sk);
if (!sk->sk_zapped || addr_len != sizeof(struct sockaddr_at)) if (!sock_flag(sk, SOCK_ZAPPED) ||
addr_len != sizeof(struct sockaddr_at))
return -EINVAL; return -EINVAL;
if (addr->sat_family != AF_APPLETALK) if (addr->sat_family != AF_APPLETALK)
...@@ -1167,7 +1168,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1167,7 +1168,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
return -EADDRINUSE; return -EADDRINUSE;
} }
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
return 0; return 0;
} }
...@@ -1202,7 +1203,7 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -1202,7 +1203,7 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
#endif #endif
} }
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
if (atalk_autobind(sk) < 0) if (atalk_autobind(sk) < 0)
return -EBUSY; return -EBUSY;
...@@ -1229,7 +1230,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -1229,7 +1230,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct atalk_sock *at = at_sk(sk); struct atalk_sock *at = at_sk(sk);
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
if (atalk_autobind(sk) < 0) if (atalk_autobind(sk) < 0)
return -ENOBUFS; return -ENOBUFS;
...@@ -1551,7 +1552,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr ...@@ -1551,7 +1552,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
return -EMSGSIZE; return -EMSGSIZE;
if (usat) { if (usat) {
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
if (atalk_autobind(sk) < 0) if (atalk_autobind(sk) < 0)
return -EBUSY; return -EBUSY;
......
...@@ -870,7 +870,9 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) ...@@ -870,7 +870,9 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
sk->sk_debug = osk->sk_debug; sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED; sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep; sk->sk_sleep = osk->sk_sleep;
sk->sk_zapped = osk->sk_zapped;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
oax25 = ax25_sk(osk); oax25 = ax25_sk(osk);
...@@ -1024,7 +1026,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1024,7 +1026,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
lock_sock(sk); lock_sock(sk);
ax25 = ax25_sk(sk); ax25 = ax25_sk(sk);
if (!sk->sk_zapped) { if (!sock_flag(sk, SOCK_ZAPPED)) {
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }
...@@ -1058,7 +1060,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1058,7 +1060,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
done: done:
ax25_cb_add(ax25); ax25_cb_add(ax25);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
out: out:
release_sock(sk); release_sock(sk);
...@@ -1171,7 +1173,7 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -1171,7 +1173,7 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr,
* the socket is already bound, check to see if the device has * the socket is already bound, check to see if the device has
* been filled in, error if it hasn't. * been filled in, error if it hasn't.
*/ */
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
/* check if we can remove this feature. It is broken. */ /* check if we can remove this feature. It is broken. */
printk(KERN_WARNING "ax25_connect(): %s uses autobind, please contact jreuter@yaina.de\n", printk(KERN_WARNING "ax25_connect(): %s uses autobind, please contact jreuter@yaina.de\n",
current->comm); current->comm);
...@@ -1419,7 +1421,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1419,7 +1421,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
lock_sock(sk); lock_sock(sk);
ax25 = ax25_sk(sk); ax25 = ax25_sk(sk);
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED))
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
goto out; goto out;
} }
......
...@@ -455,7 +455,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) ...@@ -455,7 +455,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
if (ax25->sk != NULL) { if (ax25->sk != NULL) {
bh_lock_sock(ax25->sk); bh_lock_sock(ax25->sk);
ax25->sk->sk_zapped = 0; sock_reset_flag(ax25->sk, SOCK_ZAPPED);
bh_unlock_sock(ax25->sk); bh_unlock_sock(ax25->sk);
} }
......
...@@ -130,7 +130,7 @@ struct sock *bt_sock_alloc(struct socket *sock, int proto, int pi_size, int prio ...@@ -130,7 +130,7 @@ struct sock *bt_sock_alloc(struct socket *sock, int proto, int pi_size, int prio
sock_init_data(sock, sk); sock_init_data(sock, sk);
INIT_LIST_HEAD(&bt_sk(sk)->accept_q); INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_protocol = proto; sk->sk_protocol = proto;
sk->sk_state = BT_OPEN; sk->sk_state = BT_OPEN;
......
...@@ -280,7 +280,7 @@ static void l2cap_sock_cleanup_listen(struct sock *parent) ...@@ -280,7 +280,7 @@ static void l2cap_sock_cleanup_listen(struct sock *parent)
l2cap_sock_close(sk); l2cap_sock_close(sk);
parent->sk_state = BT_CLOSED; parent->sk_state = BT_CLOSED;
parent->sk_zapped = 1; sock_set_flag(parent, SOCK_ZAPPED);
} }
/* Kill socket (only if zapped and orphan) /* Kill socket (only if zapped and orphan)
...@@ -288,7 +288,7 @@ static void l2cap_sock_cleanup_listen(struct sock *parent) ...@@ -288,7 +288,7 @@ static void l2cap_sock_cleanup_listen(struct sock *parent)
*/ */
static void l2cap_sock_kill(struct sock *sk) static void l2cap_sock_kill(struct sock *sk)
{ {
if (!sk->sk_zapped || sk->sk_socket) if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
return; return;
BT_DBG("sk %p state %d", sk, sk->sk_state); BT_DBG("sk %p state %d", sk, sk->sk_state);
...@@ -333,7 +333,7 @@ static void __l2cap_sock_close(struct sock *sk, int reason) ...@@ -333,7 +333,7 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
break; break;
default: default:
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
break; break;
} }
} }
...@@ -1062,7 +1062,7 @@ static void l2cap_chan_del(struct sock *sk, int err) ...@@ -1062,7 +1062,7 @@ static void l2cap_chan_del(struct sock *sk, int err)
} }
sk->sk_state = BT_CLOSED; sk->sk_state = BT_CLOSED;
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
if (err) if (err)
sk->sk_err = err; sk->sk_err = err;
...@@ -1424,7 +1424,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd ...@@ -1424,7 +1424,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
/* Check if we already have channel with that dcid */ /* Check if we already have channel with that dcid */
if (__l2cap_get_chan_by_dcid(list, scid)) { if (__l2cap_get_chan_by_dcid(list, scid)) {
write_unlock(&list->lock); write_unlock(&list->lock);
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
l2cap_sock_kill(sk); l2cap_sock_kill(sk);
goto response; goto response;
} }
......
...@@ -105,7 +105,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) ...@@ -105,7 +105,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
parent = bt_sk(sk)->parent; parent = bt_sk(sk)->parent;
if (parent) { if (parent) {
if (d->state == BT_CLOSED) { if (d->state == BT_CLOSED) {
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
bt_accept_unlink(sk); bt_accept_unlink(sk);
} }
parent->sk_data_ready(parent, 0); parent->sk_data_ready(parent, 0);
...@@ -117,7 +117,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) ...@@ -117,7 +117,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err)
bh_unlock_sock(sk); bh_unlock_sock(sk);
if (parent && sk->sk_zapped) { if (parent && sock_flag(sk, SOCK_ZAPPED)) {
/* We have to drop DLC lock here, otherwise /* We have to drop DLC lock here, otherwise
* rfcomm_sock_destruct() will dead lock. */ * rfcomm_sock_destruct() will dead lock. */
rfcomm_dlc_unlock(d); rfcomm_dlc_unlock(d);
...@@ -214,7 +214,7 @@ static void rfcomm_sock_cleanup_listen(struct sock *parent) ...@@ -214,7 +214,7 @@ static void rfcomm_sock_cleanup_listen(struct sock *parent)
} }
parent->sk_state = BT_CLOSED; parent->sk_state = BT_CLOSED;
parent->sk_zapped = 1; sock_set_flag(parent, SOCK_ZAPPED);
} }
/* Kill socket (only if zapped and orphan) /* Kill socket (only if zapped and orphan)
...@@ -222,7 +222,7 @@ static void rfcomm_sock_cleanup_listen(struct sock *parent) ...@@ -222,7 +222,7 @@ static void rfcomm_sock_cleanup_listen(struct sock *parent)
*/ */
static void rfcomm_sock_kill(struct sock *sk) static void rfcomm_sock_kill(struct sock *sk)
{ {
if (!sk->sk_zapped || sk->sk_socket) if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
return; return;
BT_DBG("sk %p state %d refcnt %d", sk, sk->sk_state, atomic_read(&sk->sk_refcnt)); BT_DBG("sk %p state %d refcnt %d", sk, sk->sk_state, atomic_read(&sk->sk_refcnt));
...@@ -251,7 +251,7 @@ static void __rfcomm_sock_close(struct sock *sk) ...@@ -251,7 +251,7 @@ static void __rfcomm_sock_close(struct sock *sk)
rfcomm_dlc_close(d, 0); rfcomm_dlc_close(d, 0);
default: default:
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
break; break;
} }
} }
......
...@@ -352,7 +352,7 @@ static void sco_sock_cleanup_listen(struct sock *parent) ...@@ -352,7 +352,7 @@ static void sco_sock_cleanup_listen(struct sock *parent)
} }
parent->sk_state = BT_CLOSED; parent->sk_state = BT_CLOSED;
parent->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
} }
/* Kill socket (only if zapped and orphan) /* Kill socket (only if zapped and orphan)
...@@ -360,7 +360,7 @@ static void sco_sock_cleanup_listen(struct sock *parent) ...@@ -360,7 +360,7 @@ static void sco_sock_cleanup_listen(struct sock *parent)
*/ */
static void sco_sock_kill(struct sock *sk) static void sco_sock_kill(struct sock *sk)
{ {
if (!sk->sk_zapped || sk->sk_socket) if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
return; return;
BT_DBG("sk %p state %d", sk, sk->sk_state); BT_DBG("sk %p state %d", sk, sk->sk_state);
...@@ -399,7 +399,7 @@ static void sco_sock_close(struct sock *sk) ...@@ -399,7 +399,7 @@ static void sco_sock_close(struct sock *sk)
break; break;
default: default:
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
break; break;
}; };
...@@ -778,7 +778,7 @@ static void sco_chan_del(struct sock *sk, int err) ...@@ -778,7 +778,7 @@ static void sco_chan_del(struct sock *sk, int err)
sk->sk_err = err; sk->sk_err = err;
sk->sk_state_change(sk); sk->sk_state_change(sk);
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
} }
static void sco_conn_ready(struct sco_conn *conn) static void sco_conn_ready(struct sco_conn *conn)
......
...@@ -1189,9 +1189,10 @@ void sock_init_data(struct socket *sock, struct sock *sk) ...@@ -1189,9 +1189,10 @@ void sock_init_data(struct socket *sock, struct sock *sk)
sk->sk_rcvbuf = sysctl_rmem_default; sk->sk_rcvbuf = sysctl_rmem_default;
sk->sk_sndbuf = sysctl_wmem_default; sk->sk_sndbuf = sysctl_wmem_default;
sk->sk_state = TCP_CLOSE; sk->sk_state = TCP_CLOSE;
sk->sk_zapped = 1;
sk->sk_socket = sock; sk->sk_socket = sock;
sock_set_flag(sk, SOCK_ZAPPED);
if(sock) if(sock)
{ {
sk->sk_type = sock->type; sk->sk_type = sock->type;
......
...@@ -750,14 +750,13 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -750,14 +750,13 @@ static int dn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
rv = -EINVAL; rv = -EINVAL;
lock_sock(sk); lock_sock(sk);
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
memcpy(&scp->addr, saddr, addr_len); memcpy(&scp->addr, saddr, addr_len);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
rv = dn_hash_sock(sk); rv = dn_hash_sock(sk);
if (rv) { if (rv)
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
}
} }
release_sock(sk); release_sock(sk);
...@@ -771,7 +770,7 @@ static int dn_auto_bind(struct socket *sock) ...@@ -771,7 +770,7 @@ static int dn_auto_bind(struct socket *sock)
struct dn_scp *scp = DN_SK(sk); struct dn_scp *scp = DN_SK(sk);
int rv; int rv;
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
scp->addr.sdn_flags = 0; scp->addr.sdn_flags = 0;
scp->addr.sdn_objnum = 0; scp->addr.sdn_objnum = 0;
...@@ -795,9 +794,8 @@ static int dn_auto_bind(struct socket *sock) ...@@ -795,9 +794,8 @@ static int dn_auto_bind(struct socket *sock)
rv = dn_dev_bind_default((dn_address *)scp->addr.sdn_add.a_addr); rv = dn_dev_bind_default((dn_address *)scp->addr.sdn_add.a_addr);
if (rv == 0) { if (rv == 0) {
rv = dn_hash_sock(sk); rv = dn_hash_sock(sk);
if (rv) { if (rv)
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
}
} }
return rv; return rv;
...@@ -922,7 +920,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen, ...@@ -922,7 +920,7 @@ static int __dn_connect(struct sock *sk, struct sockaddr_dn *addr, int addrlen,
if (addr->sdn_flags & SDF_WILD) if (addr->sdn_flags & SDF_WILD)
goto out; goto out;
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
err = dn_auto_bind(sk->sk_socket); err = dn_auto_bind(sk->sk_socket);
if (err) if (err)
goto out; goto out;
...@@ -1141,7 +1139,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -1141,7 +1139,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
lock_sock(newsk); lock_sock(newsk);
err = dn_hash_sock(newsk); err = dn_hash_sock(newsk);
if (err == 0) { if (err == 0) {
newsk->sk_zapped = 0; sock_reset_flag(newsk, SOCK_ZAPPED);
dn_send_conn_ack(newsk); dn_send_conn_ack(newsk);
/* /*
...@@ -1259,7 +1257,7 @@ static int dn_listen(struct socket *sock, int backlog) ...@@ -1259,7 +1257,7 @@ static int dn_listen(struct socket *sock, int backlog)
lock_sock(sk); lock_sock(sk);
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
if ((DN_SK(sk)->state != DN_O) || (sk->sk_state == TCP_LISTEN)) if ((DN_SK(sk)->state != DN_O) || (sk->sk_state == TCP_LISTEN))
...@@ -1671,7 +1669,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1671,7 +1669,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
lock_sock(sk); lock_sock(sk);
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
rv = -EADDRNOTAVAIL; rv = -EADDRNOTAVAIL;
goto out; goto out;
} }
......
...@@ -583,7 +583,7 @@ static int econet_create(struct socket *sock, int protocol) ...@@ -583,7 +583,7 @@ static int econet_create(struct socket *sock, int protocol)
sk_set_owner(sk, THIS_MODULE); sk_set_owner(sk, THIS_MODULE);
eo = ec_sk(sk); eo = ec_sk(sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_family = PF_ECONET; sk->sk_family = PF_ECONET;
eo->num = protocol; eo->num = protocol;
......
...@@ -310,7 +310,7 @@ static void __ipxitf_down(struct ipx_interface *intrfc) ...@@ -310,7 +310,7 @@ static void __ipxitf_down(struct ipx_interface *intrfc)
s->sk_error_report(s); s->sk_error_report(s);
ipxs->intrfc = NULL; ipxs->intrfc = NULL;
ipxs->port = 0; ipxs->port = 0;
s->sk_zapped = 1; /* Indicates it is no longer bound */ sock_set_flag(s, SOCK_ZAPPED); /* Indicates it is no longer bound */
sk_del_node_init(s); sk_del_node_init(s);
} }
INIT_HLIST_HEAD(&intrfc->if_sklist); INIT_HLIST_HEAD(&intrfc->if_sklist);
...@@ -1427,7 +1427,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1427,7 +1427,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct sockaddr_ipx *addr = (struct sockaddr_ipx *)uaddr; struct sockaddr_ipx *addr = (struct sockaddr_ipx *)uaddr;
int rc = -EINVAL; int rc = -EINVAL;
if (!sk->sk_zapped || addr_len != sizeof(struct sockaddr_ipx)) if (!sock_flag(sk, SOCK_ZAPPED) || addr_len != sizeof(struct sockaddr_ipx))
goto out; goto out;
intrfc = ipxitf_find_using_net(addr->sipx_network); intrfc = ipxitf_find_using_net(addr->sipx_network);
...@@ -1505,7 +1505,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -1505,7 +1505,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
#endif /* CONFIG_IPX_INTERN */ #endif /* CONFIG_IPX_INTERN */
ipxitf_insert_socket(intrfc, sk); ipxitf_insert_socket(intrfc, sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
rc = 0; rc = 0;
out_put: out_put:
...@@ -1774,7 +1774,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1774,7 +1774,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
} }
rc = -ENOTCONN; rc = -ENOTCONN;
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
......
...@@ -180,7 +180,7 @@ static int llc_ui_release(struct socket *sock) ...@@ -180,7 +180,7 @@ static int llc_ui_release(struct socket *sock)
llc->laddr.lsap, llc->daddr.lsap); llc->laddr.lsap, llc->daddr.lsap);
if (!llc_send_disc(sk)) if (!llc_send_disc(sk))
llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo); llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo);
if (!sk->sk_zapped) if (!sock_flag(sk, SOCK_ZAPPED))
llc_sap_remove_socket(llc->sap, sk); llc_sap_remove_socket(llc->sap, sk);
release_sock(sk); release_sock(sk);
if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) { if (llc->sap && hlist_empty(&llc->sap->sk_list.list)) {
...@@ -248,7 +248,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) ...@@ -248,7 +248,7 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
struct llc_sap *sap; struct llc_sap *sap;
int rc = -EINVAL; int rc = -EINVAL;
if (!sk->sk_zapped) if (!sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
rc = -ENODEV; rc = -ENODEV;
llc->dev = dev_getfirstbyhwtype(addr->sllc_arphrd); llc->dev = dev_getfirstbyhwtype(addr->sllc_arphrd);
...@@ -266,7 +266,8 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr) ...@@ -266,7 +266,8 @@ static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
memcpy(&llc->addr, addr, sizeof(llc->addr)); memcpy(&llc->addr, addr, sizeof(llc->addr));
/* assign new connection to its SAP */ /* assign new connection to its SAP */
llc_sap_add_socket(sap, sk); llc_sap_add_socket(sap, sk);
rc = sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
rc = 0;
out: out:
return rc; return rc;
} }
...@@ -298,7 +299,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) ...@@ -298,7 +299,7 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
int rc = -EINVAL; int rc = -EINVAL;
dprintk("%s: binding %02X\n", __FUNCTION__, addr->sllc_sap); dprintk("%s: binding %02X\n", __FUNCTION__, addr->sllc_sap);
if (!sk->sk_zapped || addrlen != sizeof(*addr)) if (!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr))
goto out; goto out;
rc = -EAFNOSUPPORT; rc = -EAFNOSUPPORT;
if (addr->sllc_family != AF_LLC) if (addr->sllc_family != AF_LLC)
...@@ -339,7 +340,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) ...@@ -339,7 +340,8 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
memcpy(&llc->addr, addr, sizeof(llc->addr)); memcpy(&llc->addr, addr, sizeof(llc->addr));
/* assign new connection to its SAP */ /* assign new connection to its SAP */
llc_sap_add_socket(sap, sk); llc_sap_add_socket(sap, sk);
rc = sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
rc = 0;
out: out:
return rc; return rc;
} }
...@@ -406,7 +408,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -406,7 +408,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
if (addr->sllc_family != AF_LLC) if (addr->sllc_family != AF_LLC)
goto out; goto out;
/* bind connection to sap if user hasn't done it. */ /* bind connection to sap if user hasn't done it. */
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
/* bind to sap with null dev, exclusive */ /* bind to sap with null dev, exclusive */
rc = llc_ui_autobind(sock, addr); rc = llc_ui_autobind(sock, addr);
if (rc) if (rc)
...@@ -459,7 +461,7 @@ static int llc_ui_listen(struct socket *sock, int backlog) ...@@ -459,7 +461,7 @@ static int llc_ui_listen(struct socket *sock, int backlog)
if (sk->sk_type != SOCK_STREAM) if (sk->sk_type != SOCK_STREAM)
goto out; goto out;
rc = -EAGAIN; rc = -EAGAIN;
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
rc = 0; rc = 0;
if (!(unsigned)backlog) /* BSDism */ if (!(unsigned)backlog) /* BSDism */
...@@ -638,7 +640,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags) ...@@ -638,7 +640,7 @@ static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
newsk = skb->sk; newsk = skb->sk;
/* attach connection to a new socket. */ /* attach connection to a new socket. */
llc_ui_sk_init(newsock, newsk); llc_ui_sk_init(newsock, newsk);
newsk->sk_zapped = 0; sock_reset_flag(newsk, SOCK_ZAPPED);
newsk->sk_state = TCP_ESTABLISHED; newsk->sk_state = TCP_ESTABLISHED;
newsock->state = SS_CONNECTED; newsock->state = SS_CONNECTED;
llc = llc_sk(sk); llc = llc_sk(sk);
...@@ -749,7 +751,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -749,7 +751,7 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
addr = &llc->addr; addr = &llc->addr;
} }
/* must bind connection to sap if user hasn't done it. */ /* must bind connection to sap if user hasn't done it. */
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
/* bind to sap with null dev, exclusive. */ /* bind to sap with null dev, exclusive. */
rc = llc_ui_autobind(sock, addr); rc = llc_ui_autobind(sock, addr);
if (rc) if (rc)
...@@ -823,7 +825,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -823,7 +825,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
int rc = 0; int rc = 0;
lock_sock(sk); lock_sock(sk);
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
*uaddrlen = sizeof(sllc); *uaddrlen = sizeof(sllc);
memset(uaddr, 0, *uaddrlen); memset(uaddr, 0, *uaddrlen);
......
...@@ -478,7 +478,9 @@ static struct sock *nr_make_new(struct sock *osk) ...@@ -478,7 +478,9 @@ static struct sock *nr_make_new(struct sock *osk)
sk->sk_debug = osk->sk_debug; sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED; sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep; sk->sk_sleep = osk->sk_sleep;
sk->sk_zapped = osk->sk_zapped;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
skb_queue_head_init(&nr->ack_queue); skb_queue_head_init(&nr->ack_queue);
skb_queue_head_init(&nr->reseq_queue); skb_queue_head_init(&nr->reseq_queue);
...@@ -558,7 +560,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -558,7 +560,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
ax25_address *user, *source; ax25_address *user, *source;
lock_sock(sk); lock_sock(sk);
if (!sk->sk_zapped) { if (!sock_flag(sk, SOCK_ZAPPED)) {
release_sock(sk); release_sock(sk);
return -EINVAL; return -EINVAL;
} }
...@@ -610,7 +612,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -610,7 +612,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
nr->device = dev; nr->device = dev;
nr_insert_socket(sk); nr_insert_socket(sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
dev_put(dev); dev_put(dev);
release_sock(sk); release_sock(sk);
SOCK_DEBUG(sk, "NET/ROM: socket is bound\n"); SOCK_DEBUG(sk, "NET/ROM: socket is bound\n");
...@@ -655,8 +657,8 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -655,8 +657,8 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
release_sock(sk); release_sock(sk);
return -EINVAL; return -EINVAL;
} }
if (sk->sk_zapped) { /* Must bind first - autobinding in this may or may not work */ if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in this may or may not work */
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
if ((dev = nr_dev_first()) == NULL) { if ((dev = nr_dev_first()) == NULL) {
release_sock(sk); release_sock(sk);
...@@ -1023,7 +1025,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1023,7 +1025,7 @@ static int nr_sendmsg(struct kiocb *iocb, struct socket *sock,
return -EINVAL; return -EINVAL;
lock_sock(sk); lock_sock(sk);
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
goto out; goto out;
} }
......
...@@ -575,7 +575,9 @@ static struct sock *rose_make_new(struct sock *osk) ...@@ -575,7 +575,9 @@ static struct sock *rose_make_new(struct sock *osk)
sk->sk_debug = osk->sk_debug; sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED; sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep; sk->sk_sleep = osk->sk_sleep;
sk->sk_zapped = osk->sk_zapped;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
init_timer(&rose->timer); init_timer(&rose->timer);
init_timer(&rose->idletimer); init_timer(&rose->idletimer);
...@@ -648,7 +650,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -648,7 +650,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
ax25_address *user, *source; ax25_address *user, *source;
int n; int n;
if (!sk->sk_zapped) if (!sock_flag(sk, SOCK_ZAPPED))
return -EINVAL; return -EINVAL;
if (addr_len != sizeof(struct sockaddr_rose) && addr_len != sizeof(struct full_sockaddr_rose)) if (addr_len != sizeof(struct sockaddr_rose) && addr_len != sizeof(struct full_sockaddr_rose))
...@@ -693,7 +695,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -693,7 +695,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
rose_insert_socket(sk); rose_insert_socket(sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
SOCK_DEBUG(sk, "ROSE: socket is bound\n"); SOCK_DEBUG(sk, "ROSE: socket is bound\n");
return 0; return 0;
} }
...@@ -749,8 +751,8 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le ...@@ -749,8 +751,8 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
if (!rose->lci) if (!rose->lci)
return -ENETUNREACH; return -ENETUNREACH;
if (sk->sk_zapped) { /* Must bind first - autobinding in this may or may not work */ if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in this may or may not work */
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
if ((dev = rose_dev_first()) == NULL) if ((dev = rose_dev_first()) == NULL)
return -ENETUNREACH; return -ENETUNREACH;
...@@ -1023,7 +1025,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1023,7 +1025,7 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
return -EINVAL; return -EINVAL;
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
if (sk->sk_shutdown & SEND_SHUTDOWN) { if (sk->sk_shutdown & SEND_SHUTDOWN) {
......
...@@ -609,11 +609,11 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, ...@@ -609,11 +609,11 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
newsk->sk_reuse = sk->sk_reuse; newsk->sk_reuse = sk->sk_reuse;
newsk->sk_destruct = inet_sock_destruct; newsk->sk_destruct = inet_sock_destruct;
newsk->sk_zapped = 0;
newsk->sk_family = PF_INET6; newsk->sk_family = PF_INET6;
newsk->sk_protocol = IPPROTO_SCTP; newsk->sk_protocol = IPPROTO_SCTP;
newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv; newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
newsk->sk_shutdown = sk->sk_shutdown; newsk->sk_shutdown = sk->sk_shutdown;
sock_reset_flag(sk, SOCK_ZAPPED);
newsctp6sk = (struct sctp6_sock *)newsk; newsctp6sk = (struct sctp6_sock *)newsk;
inet_sk(newsk)->pinet6 = &newsctp6sk->inet6; inet_sk(newsk)->pinet6 = &newsctp6sk->inet6;
......
...@@ -570,10 +570,10 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, ...@@ -570,10 +570,10 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
newsk->sk_shutdown = sk->sk_shutdown; newsk->sk_shutdown = sk->sk_shutdown;
newsk->sk_destruct = inet_sock_destruct; newsk->sk_destruct = inet_sock_destruct;
newsk->sk_zapped = 0;
newsk->sk_family = PF_INET; newsk->sk_family = PF_INET;
newsk->sk_protocol = IPPROTO_SCTP; newsk->sk_protocol = IPPROTO_SCTP;
newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv; newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
sock_reset_flag(newsk, SOCK_ZAPPED);
newinet = inet_sk(newsk); newinet = inet_sk(newsk);
......
...@@ -1044,7 +1044,8 @@ tcp_state_change(struct sock *sk) ...@@ -1044,7 +1044,8 @@ tcp_state_change(struct sock *sk)
dprintk("RPC: tcp_state_change client %p...\n", xprt); dprintk("RPC: tcp_state_change client %p...\n", xprt);
dprintk("RPC: state %x conn %d dead %d zapped %d\n", dprintk("RPC: state %x conn %d dead %d zapped %d\n",
sk->sk_state, xprt_connected(xprt), sk->sk_state, xprt_connected(xprt),
sock_flag(sk, SOCK_DEAD), sk->sk_zapped); sock_flag(sk, SOCK_DEAD),
sock_flag(sk, SOCK_ZAPPED));
switch (sk->sk_state) { switch (sk->sk_state) {
case TCP_ESTABLISHED: case TCP_ESTABLISHED:
......
...@@ -394,7 +394,7 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk) ...@@ -394,7 +394,7 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
chan->lcn = mbox_ptr->cmd.lcn; chan->lcn = mbox_ptr->cmd.lcn;
card->u.x.svc_to_dev_map[(chan->lcn%MAX_X25_LCN)] = dev; card->u.x.svc_to_dev_map[(chan->lcn%MAX_X25_LCN)] = dev;
newsk->sk_zapped = 0; sock_reset_flag(newsk, SOCK_ZAPPED);
newwp->num = htons(X25_PROT); newwp->num = htons(X25_PROT);
if (wanpipe_do_bind(newsk, dev, newwp->num)) { if (wanpipe_do_bind(newsk, dev, newwp->num)) {
...@@ -546,7 +546,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -546,7 +546,7 @@ static int wanpipe_sendmsg(struct kiocb *iocb, struct socket *sock,
int ifindex, err, reserve = 0; int ifindex, err, reserve = 0;
if (!sk->sk_zapped) if (!sock_flag(sk, SOCK_ZAPPED))
return -ENETDOWN; return -ENETDOWN;
if (sk->sk_state != WANSOCK_CONNECTED) if (sk->sk_state != WANSOCK_CONNECTED)
...@@ -672,7 +672,7 @@ static void wanpipe_delayed_transmit (unsigned long data) ...@@ -672,7 +672,7 @@ static void wanpipe_delayed_transmit (unsigned long data)
return; return;
} }
if (sk->sk_state != WANSOCK_CONNECTED || !sk->sk_zapped) { if (sk->sk_state != WANSOCK_CONNECTED || !sock_flag(sk, SOCK_ZAPPED)) {
clear_bit(0, &wp->timer); clear_bit(0, &wp->timer);
DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n"); DBG_PRINTK(KERN_INFO "wansock: Tx Timer, State not CONNECTED\n");
return; return;
...@@ -865,7 +865,7 @@ static void wanpipe_unlink_driver (struct sock *sk) ...@@ -865,7 +865,7 @@ static void wanpipe_unlink_driver (struct sock *sk)
struct net_device *dev; struct net_device *dev;
wanpipe_common_t *chan=NULL; wanpipe_common_t *chan=NULL;
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_state = WANSOCK_DISCONNECTED; sk->sk_state = WANSOCK_DISCONNECTED;
wp_sk(sk)->dev = NULL; wp_sk(sk)->dev = NULL;
...@@ -914,7 +914,7 @@ static void wanpipe_link_driver(struct net_device *dev, struct sock *sk) ...@@ -914,7 +914,7 @@ static void wanpipe_link_driver(struct net_device *dev, struct sock *sk)
chan->mbox = wp->mbox; chan->mbox = wp->mbox;
chan->tx_timer = &wp->tx_timer; chan->tx_timer = &wp->tx_timer;
wp->dev = dev; wp->dev = dev;
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
clear_bit(0,&chan->common_critical); clear_bit(0,&chan->common_critical);
} }
...@@ -964,7 +964,7 @@ static int wanpipe_release(struct socket *sock) ...@@ -964,7 +964,7 @@ static int wanpipe_release(struct socket *sock)
*/ */
if (wp->num == htons(X25_PROT) && if (wp->num == htons(X25_PROT) &&
sk->sk_state != WANSOCK_DISCONNECTED && sk->sk_zapped) { sk->sk_state != WANSOCK_DISCONNECTED && sock_flag(sk, SOCK_ZAPPED)) {
struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if); struct net_device *dev = dev_get_by_index(sk->sk_bound_dev_if);
wanpipe_common_t *chan; wanpipe_common_t *chan;
if (dev){ if (dev){
...@@ -1075,15 +1075,15 @@ static void release_driver(struct sock *sk) ...@@ -1075,15 +1075,15 @@ static void release_driver(struct sock *sk)
} }
kfree_skb(skb); kfree_skb(skb);
} }
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
wanpipe_unlink_card(sk); wanpipe_unlink_card(sk);
}else{ }else{
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
wanpipe_unlink_driver(sk); wanpipe_unlink_driver(sk);
} }
sk->sk_state = WANSOCK_DISCONNECTED; sk->sk_state = WANSOCK_DISCONNECTED;
sk->sk_bound_dev_if = 0; sk->sk_bound_dev_if = 0;
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
wp = wp_sk(sk); wp = wp_sk(sk);
if (wp && wp->mbox) { if (wp && wp->mbox) {
...@@ -1261,7 +1261,7 @@ static int wanpipe_do_bind(struct sock *sk, struct net_device *dev, ...@@ -1261,7 +1261,7 @@ static int wanpipe_do_bind(struct sock *sk, struct net_device *dev,
wanpipe_common_t *chan=NULL; wanpipe_common_t *chan=NULL;
int err=0; int err=0;
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
err = -EALREADY; err = -EALREADY;
goto bind_unlock_exit; goto bind_unlock_exit;
} }
...@@ -1515,7 +1515,7 @@ static int wanpipe_create(struct socket *sock, int protocol) ...@@ -1515,7 +1515,7 @@ static int wanpipe_create(struct socket *sock, int protocol)
sock->ops = &wanpipe_ops; sock->ops = &wanpipe_ops;
sock_init_data(sock,sk); sock_init_data(sock,sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_family = PF_WANPIPE; sk->sk_family = PF_WANPIPE;
wp_sk(sk)->num = protocol; wp_sk(sk)->num = protocol;
sk->sk_state = WANSOCK_DISCONNECTED; sk->sk_state = WANSOCK_DISCONNECTED;
...@@ -1721,7 +1721,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void ...@@ -1721,7 +1721,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
if (dev->ifindex == sk->sk_bound_dev_if) { if (dev->ifindex == sk->sk_bound_dev_if) {
printk(KERN_INFO "wansock: Device down %s\n",dev->name); printk(KERN_INFO "wansock: Device down %s\n",dev->name);
if (sk->sk_zapped) { if (sock_flag(sk, SOCK_ZAPPED)) {
wanpipe_unlink_driver(sk); wanpipe_unlink_driver(sk);
sk->sk_err = ENETDOWN; sk->sk_err = ENETDOWN;
sk->sk_error_report(sk); sk->sk_error_report(sk);
...@@ -1737,7 +1737,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void ...@@ -1737,7 +1737,7 @@ static int wanpipe_notifier(struct notifier_block *this, unsigned long msg, void
break; break;
case NETDEV_UP: case NETDEV_UP:
if (dev->ifindex == sk->sk_bound_dev_if && if (dev->ifindex == sk->sk_bound_dev_if &&
po->num && !sk->sk_zapped) { po->num && !sock_flag(sk, SOCK_ZAPPED)) {
printk(KERN_INFO "wansock: Registering Device: %s\n", printk(KERN_INFO "wansock: Registering Device: %s\n",
dev->name); dev->name);
wanpipe_link_driver(dev,sk); wanpipe_link_driver(dev,sk);
...@@ -2160,7 +2160,7 @@ static int wanpipe_link_card (struct sock *sk) ...@@ -2160,7 +2160,7 @@ static int wanpipe_link_card (struct sock *sk)
card->sk=sk; card->sk=sk;
card->func=wanpipe_listen_rcv; card->func=wanpipe_listen_rcv;
sk->sk_zapped = 1; sock_set_flag(sk, SOCK_ZAPPED);
return 0; return 0;
} }
...@@ -2504,7 +2504,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr ...@@ -2504,7 +2504,7 @@ static int wanpipe_connect(struct socket *sock, struct sockaddr *uaddr, int addr
dev_put(dev); dev_put(dev);
if (!sk->sk_zapped) /* Must bind first - autobinding does not work */ if (!sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
return -EINVAL; return -EINVAL;
sock->state = SS_CONNECTING; sock->state = SS_CONNECTING;
......
...@@ -528,9 +528,11 @@ static struct sock *x25_make_new(struct sock *osk) ...@@ -528,9 +528,11 @@ static struct sock *x25_make_new(struct sock *osk)
sk->sk_debug = osk->sk_debug; sk->sk_debug = osk->sk_debug;
sk->sk_state = TCP_ESTABLISHED; sk->sk_state = TCP_ESTABLISHED;
sk->sk_sleep = osk->sk_sleep; sk->sk_sleep = osk->sk_sleep;
sk->sk_zapped = osk->sk_zapped;
sk->sk_backlog_rcv = osk->sk_backlog_rcv; sk->sk_backlog_rcv = osk->sk_backlog_rcv;
if (sock_flag(osk, SOCK_ZAPPED))
sock_set_flag(sk, SOCK_ZAPPED);
ox25 = x25_sk(osk); ox25 = x25_sk(osk);
x25->t21 = ox25->t21; x25->t21 = ox25->t21;
x25->t22 = ox25->t22; x25->t22 = ox25->t22;
...@@ -588,14 +590,14 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -588,14 +590,14 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sockaddr_x25 *addr = (struct sockaddr_x25 *)uaddr; struct sockaddr_x25 *addr = (struct sockaddr_x25 *)uaddr;
if (!sk->sk_zapped || if (!sock_flag(sk, SOCK_ZAPPED) ||
addr_len != sizeof(struct sockaddr_x25) || addr_len != sizeof(struct sockaddr_x25) ||
addr->sx25_family != AF_X25) addr->sx25_family != AF_X25)
return -EINVAL; return -EINVAL;
x25_sk(sk)->source_addr = addr->sx25_addr; x25_sk(sk)->source_addr = addr->sx25_addr;
x25_insert_socket(sk); x25_insert_socket(sk);
sk->sk_zapped = 0; sock_reset_flag(sk, SOCK_ZAPPED);
SOCK_DEBUG(sk, "x25_bind: socket is bound\n"); SOCK_DEBUG(sk, "x25_bind: socket is bound\n");
return 0; return 0;
...@@ -679,7 +681,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -679,7 +681,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
goto out_put_neigh; goto out_put_neigh;
rc = -EINVAL; rc = -EINVAL;
if (sk->sk_zapped) /* Must bind first - autobinding does not work */ if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
goto out_put_neigh; goto out_put_neigh;
if (!strcmp(x25->source_addr.x25_addr, null_x25_address.x25_addr)) if (!strcmp(x25->source_addr.x25_addr, null_x25_address.x25_addr))
...@@ -942,7 +944,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -942,7 +944,7 @@ static int x25_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out; goto out;
rc = -EADDRNOTAVAIL; rc = -EADDRNOTAVAIL;
if (sk->sk_zapped) if (sock_flag(sk, SOCK_ZAPPED))
goto out; goto out;
rc = -EPIPE; rc = -EPIPE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment