• Home
  • Raw
  • Download

Lines Matching refs:ep

64 static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,  in sctp_endpoint_init()  argument
73 memset(ep, 0, sizeof(struct sctp_endpoint)); in sctp_endpoint_init()
75 ep->digest = kzalloc(SCTP_SIGNATURE_SIZE, gfp); in sctp_endpoint_init()
76 if (!ep->digest) in sctp_endpoint_init()
121 ep->base.type = SCTP_EP_TYPE_SOCKET; in sctp_endpoint_init()
124 atomic_set(&ep->base.refcnt, 1); in sctp_endpoint_init()
125 ep->base.dead = 0; in sctp_endpoint_init()
126 ep->base.malloced = 1; in sctp_endpoint_init()
129 sctp_inq_init(&ep->base.inqueue); in sctp_endpoint_init()
132 sctp_inq_set_th_handler(&ep->base.inqueue, sctp_endpoint_bh_rcv); in sctp_endpoint_init()
135 sctp_bind_addr_init(&ep->base.bind_addr, 0); in sctp_endpoint_init()
138 ep->base.sk = sk; in sctp_endpoint_init()
139 sock_hold(ep->base.sk); in sctp_endpoint_init()
142 INIT_LIST_HEAD(&ep->asocs); in sctp_endpoint_init()
145 ep->sndbuf_policy = sctp_sndbuf_policy; in sctp_endpoint_init()
151 ep->rcvbuf_policy = sctp_rcvbuf_policy; in sctp_endpoint_init()
154 get_random_bytes(&ep->secret_key[0], SCTP_SECRET_SIZE); in sctp_endpoint_init()
155 ep->last_key = ep->current_key = 0; in sctp_endpoint_init()
156 ep->key_changed_at = jiffies; in sctp_endpoint_init()
159 INIT_LIST_HEAD(&ep->endpoint_shared_keys); in sctp_endpoint_init()
164 list_add(&null_key->key_list, &ep->endpoint_shared_keys); in sctp_endpoint_init()
167 err = sctp_auth_init_hmacs(ep, gfp); in sctp_endpoint_init()
174 ep->auth_hmacs_list = auth_hmacs; in sctp_endpoint_init()
175 ep->auth_chunk_list = auth_chunks; in sctp_endpoint_init()
177 return ep; in sctp_endpoint_init()
180 sctp_auth_destroy_keys(&ep->endpoint_shared_keys); in sctp_endpoint_init()
185 kfree(ep->digest); in sctp_endpoint_init()
195 struct sctp_endpoint *ep; in sctp_endpoint_new() local
198 ep = t_new(struct sctp_endpoint, gfp); in sctp_endpoint_new()
199 if (!ep) in sctp_endpoint_new()
201 if (!sctp_endpoint_init(ep, sk, gfp)) in sctp_endpoint_new()
203 ep->base.malloced = 1; in sctp_endpoint_new()
204 SCTP_DBG_OBJCNT_INC(ep); in sctp_endpoint_new()
205 return ep; in sctp_endpoint_new()
208 kfree(ep); in sctp_endpoint_new()
214 void sctp_endpoint_add_asoc(struct sctp_endpoint *ep, in sctp_endpoint_add_asoc() argument
217 struct sock *sk = ep->base.sk; in sctp_endpoint_add_asoc()
227 list_add_tail(&asoc->asocs, &ep->asocs); in sctp_endpoint_add_asoc()
237 void sctp_endpoint_free(struct sctp_endpoint *ep) in sctp_endpoint_free() argument
239 ep->base.dead = 1; in sctp_endpoint_free()
241 ep->base.sk->sk_state = SCTP_SS_CLOSED; in sctp_endpoint_free()
244 sctp_unhash_endpoint(ep); in sctp_endpoint_free()
246 sctp_endpoint_put(ep); in sctp_endpoint_free()
250 static void sctp_endpoint_destroy(struct sctp_endpoint *ep) in sctp_endpoint_destroy() argument
252 SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return); in sctp_endpoint_destroy()
255 crypto_free_hash(sctp_sk(ep->base.sk)->hmac); in sctp_endpoint_destroy()
258 kfree(ep->digest); in sctp_endpoint_destroy()
263 sctp_auth_destroy_keys(&ep->endpoint_shared_keys); in sctp_endpoint_destroy()
264 kfree(ep->auth_hmacs_list); in sctp_endpoint_destroy()
265 kfree(ep->auth_chunk_list); in sctp_endpoint_destroy()
268 sctp_auth_destroy_hmacs(ep->auth_hmacs); in sctp_endpoint_destroy()
271 sctp_inq_free(&ep->base.inqueue); in sctp_endpoint_destroy()
272 sctp_bind_addr_free(&ep->base.bind_addr); in sctp_endpoint_destroy()
275 if (sctp_sk(ep->base.sk)->bind_hash) in sctp_endpoint_destroy()
276 sctp_put_port(ep->base.sk); in sctp_endpoint_destroy()
279 if (ep->base.sk) in sctp_endpoint_destroy()
280 sock_put(ep->base.sk); in sctp_endpoint_destroy()
283 if (ep->base.malloced) { in sctp_endpoint_destroy()
284 kfree(ep); in sctp_endpoint_destroy()
285 SCTP_DBG_OBJCNT_DEC(ep); in sctp_endpoint_destroy()
290 void sctp_endpoint_hold(struct sctp_endpoint *ep) in sctp_endpoint_hold() argument
292 atomic_inc(&ep->base.refcnt); in sctp_endpoint_hold()
298 void sctp_endpoint_put(struct sctp_endpoint *ep) in sctp_endpoint_put() argument
300 if (atomic_dec_and_test(&ep->base.refcnt)) in sctp_endpoint_put()
301 sctp_endpoint_destroy(ep); in sctp_endpoint_put()
305 struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *ep, in sctp_endpoint_is_match() argument
310 if (htons(ep->base.bind_addr.port) == laddr->v4.sin_port) { in sctp_endpoint_is_match()
311 if (sctp_bind_addr_match(&ep->base.bind_addr, laddr, in sctp_endpoint_is_match()
312 sctp_sk(ep->base.sk))) in sctp_endpoint_is_match()
313 retval = ep; in sctp_endpoint_is_match()
324 const struct sctp_endpoint *ep, in __sctp_endpoint_lookup_assoc() argument
339 hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); in __sctp_endpoint_lookup_assoc()
344 if (asoc->ep != ep || rport != asoc->peer.port) in __sctp_endpoint_lookup_assoc()
361 const struct sctp_endpoint *ep, in sctp_endpoint_lookup_assoc() argument
368 asoc = __sctp_endpoint_lookup_assoc(ep, paddr, transport); in sctp_endpoint_lookup_assoc()
377 int sctp_endpoint_is_peeled_off(struct sctp_endpoint *ep, in sctp_endpoint_is_peeled_off() argument
383 bp = &ep->base.bind_addr; in sctp_endpoint_is_peeled_off()
400 struct sctp_endpoint *ep = in sctp_endpoint_bh_rcv() local
413 if (ep->base.dead) in sctp_endpoint_bh_rcv()
417 inqueue = &ep->base.inqueue; in sctp_endpoint_bh_rcv()
418 sk = ep->base.sk; in sctp_endpoint_bh_rcv()
453 asoc = sctp_endpoint_lookup_assoc(ep, in sctp_endpoint_bh_rcv()
476 ep, asoc, chunk, GFP_ATOMIC); in sctp_endpoint_bh_rcv()
484 if (!sctp_sk(sk)->ep) in sctp_endpoint_bh_rcv()