unsigned int __nocast gfp) 
gfp_t gfp) 
static struct sctp_association *sctp_association_init(struct sctp_association *asoc,					  const struct sctp_endpoint *ep,					  const struct sock *sk,					  sctp_scope_t scope,					  unsigned int __nocast gfp){	struct sctp_sock *sp;	int i;	/* Retrieve the SCTP per socket area.  */	sp = sctp_sk((struct sock *)sk);	/* Init all variables to a known value.  */	memset(asoc, 0, sizeof(struct sctp_association));	/* Discarding const is appropriate here.  */	asoc->ep = (struct sctp_endpoint *)ep;	sctp_endpoint_hold(asoc->ep);	/* Hold the sock.  */	asoc->base.sk = (struct sock *)sk;	sock_hold(asoc->base.sk);	/* Initialize the common base substructure.  */	asoc->base.type = SCTP_EP_TYPE_ASSOCIATION;	/* Initialize the object handling fields.  */	atomic_set(&asoc->base.refcnt, 1);	asoc->base.dead = 0;	asoc->base.malloced = 0;	/* Initialize the bind addr area.  */	sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port);	rwlock_init(&asoc->base.addr_lock);	asoc->state = SCTP_STATE_CLOSED;	/* Set these values from the socket values, a conversion between	 * millsecons to seconds/microseconds must also be done.	 */	asoc->cookie_life.tv_sec = sp->assocparams.sasoc_cookie_life / 1000;	asoc->cookie_life.tv_usec = (sp->assocparams.sasoc_cookie_life % 1000)					* 1000;	asoc->pmtu = 0;	asoc->frag_point = 0;	/* Set the association max_retrans and RTO values from the	 * socket values.	 */	asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;	asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);	asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max);	asoc->rto_min = msecs_to_jiffies(sp->rtoinfo.srto_min);	asoc->overall_error_count = 0;	/* Initialize the maximum mumber of new data packets that can be sent	 * in a burst.	 */	asoc->max_burst = sctp_max_burst;	/* Copy things from the endpoint.  */	for (i = SCTP_EVENT_TIMEOUT_NONE; i < SCTP_NUM_TIMEOUT_TYPES; ++i) {		asoc->timeouts[i] = ep->timeouts[i];		init_timer(&asoc->timers[i]);		asoc->timers[i].function = sctp_timer_events[i];		asoc->timers[i].data = (unsigned long) asoc;	}	/* Pull default initialization values from the sock options.	 * Note: This assumes that the values have already been	 * validated in the sock.	 */	asoc->c.sinit_max_instreams = sp->initmsg.sinit_max_instreams;	asoc->c.sinit_num_ostreams  = sp->initmsg.sinit_num_ostreams;	asoc->max_init_attempts	= sp->initmsg.sinit_max_attempts;	asoc->max_init_timeo =		 msecs_to_jiffies(sp->initmsg.sinit_max_init_timeo);	/* Allocate storage for the ssnmap after the inbound and outbound	 * streams have been negotiated during Init.	 */	asoc->ssnmap = NULL;	/* Set the local window size for receive.	 * This is also the rcvbuf space per association.	 * RFC 6 - A SCTP receiver MUST be able to receive a minimum of	 * 1500 bytes in one SCTP packet.	 */	if (sk->sk_rcvbuf < SCTP_DEFAULT_MINWINDOW)		asoc->rwnd = SCTP_DEFAULT_MINWINDOW;	else		asoc->rwnd = sk->sk_rcvbuf;	asoc->a_rwnd = asoc->rwnd;	asoc->rwnd_over = 0;	/* Use my own max window until I learn something better.  */	asoc->peer.rwnd = SCTP_DEFAULT_MAXWINDOW;	/* Set the sndbuf size for transmit.  */	asoc->sndbuf_used = 0;	init_waitqueue_head(&asoc->wait);	asoc->c.my_vtag = sctp_generate_tag(ep);	asoc->peer.i.init_tag = 0;     /* INIT needs a vtag of 0. */	asoc->c.peer_vtag = 0;	asoc->c.my_ttag   = 0;	asoc->c.peer_ttag = 0;	asoc->c.my_port = ep->base.bind_addr.port;	asoc->c.initial_tsn = sctp_generate_tsn(ep);	asoc->next_tsn = asoc->c.initial_tsn;	asoc->ctsn_ack_point = asoc->next_tsn - 1;	asoc->adv_peer_ack_point = asoc->ctsn_ack_point;	asoc->highest_sacked = asoc->ctsn_ack_point;	asoc->last_cwr_tsn = asoc->ctsn_ack_point;	asoc->unack_data = 0;	/* ADDIP Section 4.1 Asconf Chunk Procedures	 *	 * When an endpoint has an ASCONF signaled change to be sent to the	 * remote endpoint it should do the following:	 * ...	 * A2) a serial number should be assigned to the chunk. The serial	 * number SHOULD be a monotonically increasing number. The serial	 * numbers SHOULD be initialized at the start of the	 * association to the same value as the initial TSN.	 */	asoc->addip_serial = asoc->c.initial_tsn;	INIT_LIST_HEAD(&asoc->addip_chunk_list);	/* Make an empty list of remote transport addresses.  */	INIT_LIST_HEAD(&asoc->peer.transport_addr_list);	asoc->peer.transport_count = 0;	/* RFC 2960 5.1 Normal Establishment of an Association	 *	 * After the reception of the first data chunk in an	 * association the endpoint must immediately respond with a	 * sack to acknowledge the data chunk.  Subsequent	 * acknowledgements should be done as described in Section	 * 6.2.	 *	 * [We implement this by telling a new association that it	 * already received one packet.]	 */	asoc->peer.sack_needed = 1;	/* Assume that the peer recongizes ASCONF until reported otherwise	 * via an ERROR chunk.	 */	asoc->peer.asconf_capable = 1;	/* Create an input queue.  */	sctp_inq_init(&asoc->base.inqueue);	sctp_inq_set_th_handler(&asoc->base.inqueue,				    (void (*)(void *))sctp_assoc_bh_rcv,				    asoc);	/* Create an output queue.  */	sctp_outq_init(asoc, &asoc->outqueue);	if (!sctp_ulpq_init(&asoc->ulpq, asoc))		goto fail_init;	/* Set up the tsn tracking. */	sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_SIZE, 0);	asoc->need_ecne = 0;	asoc->assoc_id = 0;	/* Assume that peer would support both address types unless we are	 * told otherwise.	 */	asoc->peer.ipv4_address = 1;	asoc->peer.ipv6_address = 1;	INIT_LIST_HEAD(&asoc->asocs);	asoc->autoclose = sp->autoclose;	asoc->default_stream = sp->default_stream;	asoc->default_ppid = sp->default_ppid;	asoc->default_flags = sp->default_flags;	asoc->default_context = sp->default_context;	asoc->default_timetolive = sp->default_timetolive;	return asoc;fail_init:	sctp_endpoint_put(asoc->ep);	sock_put(asoc->base.sk);	return NULL;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/dd0fc66fb33cd610bc1a5db8a5e232d34879b4d7/associola.c/buggy/net/sctp/associola.c