int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
{
int rc;
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
struct llc_conn_state_ev *ev = llc_conn_ev(skb);
/*
struct sk_buff *skb;
struct llc_pdu_sn *pdu;
u16 nbr_unack_pdus;
- struct llc_opt *llc;
+ struct llc_sock *llc;
u8 howmany_resend = 0;
llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus);
{
struct sk_buff *skb;
u16 nbr_unack_pdus;
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
u8 howmany_resend = 0;
llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus);
struct sk_buff *skb;
struct llc_pdu_sn *pdu;
int nbr_acked = 0;
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
int q_len = skb_queue_len(&llc->pdu_unack_q);
if (!q_len)
static int llc_conn_service(struct sock *sk, struct sk_buff *skb)
{
int rc = 1;
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
struct llc_conn_state_trans *trans;
if (llc->state > NBR_CONN_STATES)
struct llc_conn_state_trans **next_trans;
llc_conn_ev_qfyr_t *next_qualifier;
struct llc_conn_state_ev *ev = llc_conn_ev(skb);
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
struct llc_conn_state *curr_state =
&llc_conn_state_table[llc->state - 1];
read_lock_bh(&sap->sk_list.lock);
sk_for_each(rc, node, &sap->sk_list.list) {
- struct llc_opt *llc = llc_sk(rc);
+ struct llc_sock *llc = llc_sk(rc);
if (llc->laddr.lsap == laddr->lsap &&
llc->daddr.lsap == daddr->lsap &&
read_lock_bh(&sap->sk_list.lock);
sk_for_each(rc, node, &sap->sk_list.list) {
- struct llc_opt *llc = llc_sk(rc);
+ struct llc_sock *llc = llc_sk(rc);
if (rc->sk_type == SOCK_STREAM && rc->sk_state == TCP_LISTEN &&
llc->laddr.lsap == laddr->lsap &&
static int llc_conn_rcv(struct sock* sk, struct sk_buff *skb)
{
struct llc_conn_state_ev *ev = llc_conn_ev(skb);
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
if (!llc->dev)
llc->dev = skb->dev;
* Didn't find an active connection; verify if there
* is a listening socket for this llc addr
*/
- struct llc_opt *llc;
+ struct llc_sock *llc;
struct sock *parent = llc_lookup_listener(sap, &daddr);
if (!parent) {
goto drop;
}
- sk = llc_sk_alloc(parent->sk_family, GFP_ATOMIC);
+ sk = llc_sk_alloc(parent->sk_family, GFP_ATOMIC, parent->sk_prot);
if (!sk) {
sock_put(parent);
goto drop;
static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
{
int rc = 0;
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
if (llc_backlog_type(skb) == LLC_PACKET) {
if (llc->state > 1) /* not closed */
*
* Initializes a socket with default llc values.
*/
-static int llc_sk_init(struct sock* sk)
+static void llc_sk_init(struct sock* sk)
{
- struct llc_opt *llc = kmalloc(sizeof(*llc), GFP_ATOMIC);
- int rc = -ENOMEM;
+ struct llc_sock *llc = llc_sk(sk);
- if (!llc)
- goto out;
- memset(llc, 0, sizeof(*llc));
- rc = 0;
-
- llc->sk = sk;
llc->state = LLC_CONN_STATE_ADM;
llc->inc_cntr = llc->dec_cntr = 2;
llc->dec_step = llc->connect_step = 1;
* tx_win of remote LLC) */
skb_queue_head_init(&llc->pdu_unack_q);
sk->sk_backlog_rcv = llc_backlog_rcv;
- sk->sk_protinfo = llc;
-out:
- return rc;
}
/**
* Allocates a LLC sock and initializes it. Returns the new LLC sock
* or %NULL if there's no memory available for one
*/
-struct sock *llc_sk_alloc(int family, int priority)
+struct sock *llc_sk_alloc(int family, int priority, struct proto *prot)
{
- struct sock *sk = sk_alloc(family, priority, 1, NULL);
+ struct sock *sk = sk_alloc(family, priority, prot, 1);
if (!sk)
goto out;
- if (llc_sk_init(sk))
- goto outsk;
+ llc_sk_init(sk);
sock_init_data(NULL, sk);
- sk_set_owner(sk, THIS_MODULE);
#ifdef LLC_REFCNT_DEBUG
atomic_inc(&llc_sock_nr);
printk(KERN_DEBUG "LLC socket %p created in %s, now we have %d alive\n", sk,
#endif
out:
return sk;
-outsk:
- sk_free(sk);
- sk = NULL;
- goto out;
}
/**
*/
void llc_sk_free(struct sock *sk)
{
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
llc->state = LLC_CONN_OUT_OF_SVC;
/* Stop all (possibly) running timers */
*/
void llc_sk_reset(struct sock *sk)
{
- struct llc_opt *llc = llc_sk(sk);
+ struct llc_sock *llc = llc_sk(sk);
llc_conn_ac_stop_all_timers(sk, NULL);
skb_queue_purge(&sk->sk_write_queue);