skb->sk = sk; skb_queue_tail(&parent->sk_receive_queue, skb); sk->sk_state_change(parent); } 
skb_queue_tail(&sk->sk_receive_queue, skb); sk->sk_state_change(sk); 
int llc_conn_state_process(struct sock *sk, struct sk_buff *skb){	int rc;	struct llc_sock *llc = llc_sk(sk);	struct llc_conn_state_ev *ev = llc_conn_ev(skb);	/*	 * We have to hold the skb, because llc_conn_service will kfree it in	 * the sending path and we need to look at the skb->cb, where we encode	 * llc_conn_state_ev.	 */	skb_get(skb);	ev->ind_prim = ev->cfm_prim = 0;	rc = llc_conn_service(sk, skb); /* sending event to state machine */	if (unlikely(rc != 0)) {		printk(KERN_ERR "%s: llc_conn_service failed\n", __FUNCTION__);		goto out_kfree_skb;	}	if (unlikely(!ev->ind_prim && !ev->cfm_prim)) {		/* indicate or confirm not required */		/* XXX this is not very pretty, perhaps we should store		 * XXX indicate/confirm-needed state in the llc_conn_state_ev		 * XXX control block of the SKB instead? -DaveM		 */		if (!skb->next)			goto out_kfree_skb;		goto out_skb_put;	}	if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */		skb_get(skb);	switch (ev->ind_prim) {	case LLC_DATA_PRIM:		llc_save_primitive(sk, skb, LLC_DATA_PRIM);		if (unlikely(sock_queue_rcv_skb(sk, skb))) {			/*			 * shouldn't happen			 */			printk(KERN_ERR "%s: sock_queue_rcv_skb failed!\n",			       __FUNCTION__);			kfree_skb(skb);		}		break;	case LLC_CONN_PRIM: {		struct sock *parent = skb->sk;		skb_orphan(skb);		/*		 * Set the skb->sk to the new struct sock, so that at accept		 * type the upper layer can get the newly created struct sock.		 */		skb->sk = sk;		skb_queue_tail(&parent->sk_receive_queue, skb);		sk->sk_state_change(parent);	}		break;	case LLC_DISC_PRIM:		sock_hold(sk);		if (sk->sk_type == SOCK_STREAM &&		    sk->sk_state == TCP_ESTABLISHED) {			sk->sk_shutdown       = SHUTDOWN_MASK;			sk->sk_socket->state  = SS_UNCONNECTED;			sk->sk_state          = TCP_CLOSE;			if (!sock_flag(sk, SOCK_DEAD)) {				sk->sk_state_change(sk);				sock_set_flag(sk, SOCK_DEAD);			}		}		kfree_skb(skb);		sock_put(sk);		break;	case LLC_RESET_PRIM:		/*		 * FIXME:		 * RESET is not being notified to upper layers for now		 */		printk(KERN_INFO "%s: received a reset ind!\n", __FUNCTION__);		kfree_skb(skb);		break;	default:		if (ev->ind_prim) {			printk(KERN_INFO "%s: received unknown %d prim!\n",				__FUNCTION__, ev->ind_prim);			kfree_skb(skb);		}		/* No indication */		break;	}	switch (ev->cfm_prim) {	case LLC_DATA_PRIM:		if (!llc_data_accept_state(llc->state))			sk->sk_write_space(sk);		else			rc = llc->failed_data_req = 1;		break;	case LLC_CONN_PRIM:		if (sk->sk_type == SOCK_STREAM &&		    sk->sk_state == TCP_SYN_SENT) {			if (ev->status) {				sk->sk_socket->state = SS_UNCONNECTED;				sk->sk_state         = TCP_CLOSE;			} else {				sk->sk_socket->state = SS_CONNECTED;				sk->sk_state         = TCP_ESTABLISHED;			}			sk->sk_state_change(sk);		}		break;	case LLC_DISC_PRIM:		sock_hold(sk);		if (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSING) {			sk->sk_socket->state = SS_UNCONNECTED;			sk->sk_state         = TCP_CLOSE;			sk->sk_state_change(sk);		}		sock_put(sk);		break;	case LLC_RESET_PRIM:		/*		 * FIXME:		 * RESET is not being notified to upper layers for now		 */		printk(KERN_INFO "%s: received a reset conf!\n", __FUNCTION__);		break;	default:		if (ev->cfm_prim) {			printk(KERN_INFO "%s: received unknown %d prim!\n",					__FUNCTION__, ev->cfm_prim);			break;		}		goto out_skb_put; /* No confirmation */	}out_kfree_skb:	kfree_skb(skb);out_skb_put:	kfree_skb(skb);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/d389424e00f9097cd24b3df4ca0ab7221f140eeb/llc_conn.c/clean/net/llc/llc_conn.c