Exemplo n.º 1
0
int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb)
{
	int rc = -ENOBUFS;
	struct llc_sock *llc = llc_sk(sk);
	struct sk_buff *nskb = llc_alloc_frame(sk, llc->dev, LLC_PDU_TYPE_U, 0);

	if (nskb) {
		struct llc_sap *sap = llc->sap;
		u8 *dmac = llc->daddr.mac;

		if (llc->dev->flags & IFF_LOOPBACK)
			dmac = llc->dev->dev_addr;
		llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap,
				    llc->daddr.lsap, LLC_PDU_CMD);
		llc_pdu_init_as_sabme_cmd(nskb, 1);
		rc = llc_mac_hdr_init(nskb, llc->dev->dev_addr, dmac);
		if (unlikely(rc))
			goto free;
		llc_conn_send_pdu(sk, nskb);
		llc_conn_set_p_flag(sk, 1);
	}
out:
	return rc;
free:
	kfree_skb(nskb);
	goto out;
}
Exemplo n.º 2
0
int llc_conn_ac_stop_p_timer(struct sock *sk, struct sk_buff *skb)
{
	struct llc_sock *llc = llc_sk(sk);

	del_timer(&llc->pf_cycle_timer.timer);
	llc_conn_set_p_flag(sk, 0);
	return 0;
}
Exemplo n.º 3
0
int llc_conn_ac_start_p_timer(struct sock *sk, struct sk_buff *skb)
{
	struct llc_sock *llc = llc_sk(sk);

	llc_conn_set_p_flag(sk, 1);
	mod_timer(&llc->pf_cycle_timer.timer,
		  jiffies + llc->pf_cycle_timer.expire);
	return 0;
}
Exemplo n.º 4
0
int llc_conn_ac_upd_p_flag(struct sock *sk, struct sk_buff *skb)
{
	struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);

	if (LLC_PDU_IS_RSP(pdu)) {
		u8 f_bit;

		llc_pdu_decode_pf_bit(skb, &f_bit);
		if (f_bit) {
			llc_conn_set_p_flag(sk, 0);
			llc_conn_ac_stop_p_timer(sk, skb);
		}
	}
	return 0;
}
Exemplo n.º 5
0
/**
 *	llc_sk_reset - resets a connection
 *	@sk: LLC socket to reset
 *
 *	Resets a connection to the out of service state. Stops its timers
 *	and frees any frames in the queues of the connection.
 */
void llc_sk_reset(struct sock *sk)
{
	struct llc_sock *llc = llc_sk(sk);

	llc_conn_ac_stop_all_timers(sk, NULL);
	skb_queue_purge(&sk->sk_write_queue);
	skb_queue_purge(&llc->pdu_unack_q);
	llc->remote_busy_flag	= 0;
	llc->cause_flag		= 0;
	llc->retry_count	= 0;
	llc_conn_set_p_flag(sk, 0);
	llc->f_flag		= 0;
	llc->s_flag		= 0;
	llc->ack_pf		= 0;
	llc->first_pdu_Ns	= 0;
	llc->ack_must_be_send	= 0;
	llc->dec_step		= 1;
	llc->inc_cntr		= 2;
	llc->dec_cntr		= 2;
	llc->X			= 0;
	llc->failed_data_req	= 0 ;
	llc->last_nr		= 0;
}
Exemplo n.º 6
0
static int llc_conn_ac_set_p_flag_1(struct sock *sk, struct sk_buff *skb)
{
	llc_conn_set_p_flag(sk, 1);
	return 0;
}
Exemplo n.º 7
0
int llc_conn_ac_set_p_flag_0(struct sock *sk, struct sk_buff *skb)
{
	llc_conn_set_p_flag(sk, 0);
	return 0;
}