Lines Matching full:peer
17 #include "peer.h"
35 * @peer: peer whose socket reference counter should be decreased
36 * @sock: the RCU protected peer socket
43 static bool ovpn_socket_put(struct ovpn_peer *peer, struct ovpn_socket *sock) in ovpn_socket_put() argument
50 * @peer: peer whose socket should be released
52 * This function should be invoked when the peer is being removed
59 * the refcounter for the peer it is linked to, thus allowing the peer
62 * This function is expected to be invoked exactly once per peer
66 void ovpn_socket_release(struct ovpn_peer *peer) in ovpn_socket_release() argument
73 sock = rcu_replace_pointer(peer->sock, NULL, true); in ovpn_socket_release()
86 released = ovpn_socket_put(peer, sock); in ovpn_socket_release()
99 ovpn_peer_put(sock->peer); in ovpn_socket_release()
117 struct ovpn_peer *peer) in ovpn_socket_attach() argument
120 return ovpn_udp_socket_attach(ovpn_sock, sock, peer->ovpn); in ovpn_socket_attach()
122 return ovpn_tcp_socket_attach(ovpn_sock, peer); in ovpn_socket_attach()
130 * @peer: the peer reachable via this socket
134 struct ovpn_socket *ovpn_socket_new(struct socket *sock, struct ovpn_peer *peer) in ovpn_socket_new() argument
142 /* a TCP socket can only be owned by a single peer, therefore there in ovpn_socket_new()
166 if (ovpn_sock->ovpn != peer->ovpn) { in ovpn_socket_new()
203 /* TCP sockets are per-peer, therefore they are linked to their unique in ovpn_socket_new()
204 * peer in ovpn_socket_new()
208 ovpn_sock->peer = peer; in ovpn_socket_new()
209 ovpn_peer_hold(peer); in ovpn_socket_new()
214 ovpn_sock->ovpn = peer->ovpn; in ovpn_socket_new()
215 netdev_hold(peer->ovpn->dev, &ovpn_sock->dev_tracker, in ovpn_socket_new()
229 ret = ovpn_socket_attach(ovpn_sock, sock, peer); in ovpn_socket_new()
232 ovpn_peer_put(peer); in ovpn_socket_new()
234 netdev_put(peer->ovpn->dev, &ovpn_sock->dev_tracker); in ovpn_socket_new()