• Home
  • Raw
  • Download

Lines Matching refs:ep

41 static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,  in sctp_endpoint_init()  argument
48 ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp); in sctp_endpoint_init()
49 if (!ep->digest) in sctp_endpoint_init()
52 ep->asconf_enable = net->sctp.addip_enable; in sctp_endpoint_init()
53 ep->auth_enable = net->sctp.auth_enable; in sctp_endpoint_init()
54 if (ep->auth_enable) { in sctp_endpoint_init()
55 if (sctp_auth_init(ep, gfp)) in sctp_endpoint_init()
57 if (ep->asconf_enable) { in sctp_endpoint_init()
58 sctp_auth_ep_add_chunkid(ep, SCTP_CID_ASCONF); in sctp_endpoint_init()
59 sctp_auth_ep_add_chunkid(ep, SCTP_CID_ASCONF_ACK); in sctp_endpoint_init()
65 ep->base.type = SCTP_EP_TYPE_SOCKET; in sctp_endpoint_init()
68 refcount_set(&ep->base.refcnt, 1); in sctp_endpoint_init()
69 ep->base.dead = false; in sctp_endpoint_init()
72 sctp_inq_init(&ep->base.inqueue); in sctp_endpoint_init()
75 sctp_inq_set_th_handler(&ep->base.inqueue, sctp_endpoint_bh_rcv); in sctp_endpoint_init()
78 sctp_bind_addr_init(&ep->base.bind_addr, 0); in sctp_endpoint_init()
81 INIT_LIST_HEAD(&ep->asocs); in sctp_endpoint_init()
84 ep->sndbuf_policy = net->sctp.sndbuf_policy; in sctp_endpoint_init()
91 ep->rcvbuf_policy = net->sctp.rcvbuf_policy; in sctp_endpoint_init()
94 get_random_bytes(ep->secret_key, sizeof(ep->secret_key)); in sctp_endpoint_init()
97 INIT_LIST_HEAD(&ep->endpoint_shared_keys); in sctp_endpoint_init()
102 list_add(&null_key->key_list, &ep->endpoint_shared_keys); in sctp_endpoint_init()
107 ep->prsctp_enable = net->sctp.prsctp_enable; in sctp_endpoint_init()
108 ep->reconf_enable = net->sctp.reconf_enable; in sctp_endpoint_init()
109 ep->ecn_enable = net->sctp.ecn_enable; in sctp_endpoint_init()
112 ep->base.sk = sk; in sctp_endpoint_init()
113 ep->base.net = sock_net(sk); in sctp_endpoint_init()
114 sock_hold(ep->base.sk); in sctp_endpoint_init()
116 return ep; in sctp_endpoint_init()
119 sctp_auth_free(ep); in sctp_endpoint_init()
121 kfree(ep->digest); in sctp_endpoint_init()
131 struct sctp_endpoint *ep; in sctp_endpoint_new() local
134 ep = kzalloc(sizeof(*ep), gfp); in sctp_endpoint_new()
135 if (!ep) in sctp_endpoint_new()
138 if (!sctp_endpoint_init(ep, sk, gfp)) in sctp_endpoint_new()
141 SCTP_DBG_OBJCNT_INC(ep); in sctp_endpoint_new()
142 return ep; in sctp_endpoint_new()
145 kfree(ep); in sctp_endpoint_new()
151 void sctp_endpoint_add_asoc(struct sctp_endpoint *ep, in sctp_endpoint_add_asoc() argument
154 struct sock *sk = ep->base.sk; in sctp_endpoint_add_asoc()
164 list_add_tail(&asoc->asocs, &ep->asocs); in sctp_endpoint_add_asoc()
174 void sctp_endpoint_free(struct sctp_endpoint *ep) in sctp_endpoint_free() argument
176 ep->base.dead = true; in sctp_endpoint_free()
178 inet_sk_set_state(ep->base.sk, SCTP_SS_CLOSED); in sctp_endpoint_free()
181 sctp_unhash_endpoint(ep); in sctp_endpoint_free()
183 sctp_endpoint_put(ep); in sctp_endpoint_free()
189 struct sctp_endpoint *ep = container_of(head, struct sctp_endpoint, rcu); in sctp_endpoint_destroy_rcu() local
190 struct sock *sk = ep->base.sk; in sctp_endpoint_destroy_rcu()
192 sctp_sk(sk)->ep = NULL; in sctp_endpoint_destroy_rcu()
195 kfree(ep); in sctp_endpoint_destroy_rcu()
196 SCTP_DBG_OBJCNT_DEC(ep); in sctp_endpoint_destroy_rcu()
199 static void sctp_endpoint_destroy(struct sctp_endpoint *ep) in sctp_endpoint_destroy() argument
203 if (unlikely(!ep->base.dead)) { in sctp_endpoint_destroy()
204 WARN(1, "Attempt to destroy undead endpoint %p!\n", ep); in sctp_endpoint_destroy()
209 kfree(ep->digest); in sctp_endpoint_destroy()
214 sctp_auth_destroy_keys(&ep->endpoint_shared_keys); in sctp_endpoint_destroy()
215 sctp_auth_free(ep); in sctp_endpoint_destroy()
218 sctp_inq_free(&ep->base.inqueue); in sctp_endpoint_destroy()
219 sctp_bind_addr_free(&ep->base.bind_addr); in sctp_endpoint_destroy()
221 memset(ep->secret_key, 0, sizeof(ep->secret_key)); in sctp_endpoint_destroy()
223 sk = ep->base.sk; in sctp_endpoint_destroy()
228 call_rcu(&ep->rcu, sctp_endpoint_destroy_rcu); in sctp_endpoint_destroy()
232 int sctp_endpoint_hold(struct sctp_endpoint *ep) in sctp_endpoint_hold() argument
234 return refcount_inc_not_zero(&ep->base.refcnt); in sctp_endpoint_hold()
240 void sctp_endpoint_put(struct sctp_endpoint *ep) in sctp_endpoint_put() argument
242 if (refcount_dec_and_test(&ep->base.refcnt)) in sctp_endpoint_put()
243 sctp_endpoint_destroy(ep); in sctp_endpoint_put()
247 struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep, in sctp_endpoint_is_match() argument
253 if ((htons(ep->base.bind_addr.port) == laddr->v4.sin_port) && in sctp_endpoint_is_match()
254 net_eq(ep->base.net, net)) { in sctp_endpoint_is_match()
255 if (sctp_bind_addr_match(&ep->base.bind_addr, laddr, in sctp_endpoint_is_match()
256 sctp_sk(ep->base.sk))) in sctp_endpoint_is_match()
257 retval = ep; in sctp_endpoint_is_match()
268 const struct sctp_endpoint *ep, in sctp_endpoint_lookup_assoc() argument
280 if (!ep->base.bind_addr.port) in sctp_endpoint_lookup_assoc()
284 t = sctp_epaddr_lookup_transport(ep, paddr); in sctp_endpoint_lookup_assoc()
298 bool sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep, in sctp_endpoint_is_peeled_off() argument
302 struct net *net = ep->base.net; in sctp_endpoint_is_peeled_off()
305 bp = &ep->base.bind_addr; in sctp_endpoint_is_peeled_off()
322 struct sctp_endpoint *ep = in sctp_endpoint_bh_rcv() local
336 if (ep->base.dead) in sctp_endpoint_bh_rcv()
340 inqueue = &ep->base.inqueue; in sctp_endpoint_bh_rcv()
341 sk = ep->base.sk; in sctp_endpoint_bh_rcv()
377 asoc = sctp_endpoint_lookup_assoc(ep, in sctp_endpoint_bh_rcv()
394 SCTP_INC_STATS(ep->base.net, SCTP_MIB_INCTRLCHUNKS); in sctp_endpoint_bh_rcv()
403 ep, asoc, chunk, GFP_ATOMIC); in sctp_endpoint_bh_rcv()
411 if (!sctp_sk(sk)->ep) in sctp_endpoint_bh_rcv()