Skip to contentSkip to conversation

Question about using "Expect" from Netfilter hook

DISCUSSION Jackson Alberto 1 participant 2 messages Jul 29, 2010 – Aug 2, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

Hello!,

Is it possible to work with "expect" from a netfilter hook (not from a conntrack helper)?

When I run the code below, I get:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP [] nf_ct_expect_related_report+0x63/0x427
*pde = 3df8d067
Oops: 000 [#1] SMP

------

int np_exp(struct nf_conn *ct){
    struct nf_conntrack_expect *exp;
    struct nf_conntrack_tuple *tuple;

    exp = nf_ct_expect_alloc(ct);
    if(exp == NULL){
        printk("Couldn't allocate exp!\n");
        return -1;
    }

    tuple = &ct->tuplehash[IP_CT_DIR_REPLY].tuple;

    nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),

                          &tuple->src.u3, &tuple->dst.u3, IPPROTO_TCP,
                          NULL, &tuple->dst.u.tcp.port);

        nf_ct_expect_put(exp);

    return 1;
}

hook_func(...){
    if(!(conntrack = nf_ct_get(sock_buff, &ctinfo)) ||

           !(master_conntrack = nf_ct_get(skb, &master_ctinfo))){
                spin_unlock_bh(&np_lock);
                return NF_ACCEPT; /* Couldn't get conntrack */
    }

        np_exp(conntrack);
}

_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Can someone please help me with this?

----------------------------------------

Quoted 57 lines

From: [email protected]
To: [email protected]
Subject: Question about using "Expect" from Netfilter hook
Date: Thu, 29 Jul 2010 13:58:03 -0400

Hello!,

Is it possible to work with "expect" from a netfilter hook (not from a conntrack helper)?

When I run the code below, I get:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP [] nf_ct_expect_related_report+0x63/0x427
*pde = 3df8d067
Oops: 000 [#1] SMP

------

int np_exp(struct nf_conn *ct){
    struct nf_conntrack_expect *exp;
    struct nf_conntrack_tuple *tuple;

    exp = nf_ct_expect_alloc(ct);
    if(exp == NULL){
        printk("Couldn't allocate exp!\n");
        return -1;
    }

    tuple = &ct->tuplehash[IP_CT_DIR_REPLY].tuple;

    nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT, nf_ct_l3num(ct),

&tuple->src.u3, &tuple->dst.u3, IPPROTO_TCP,
NULL, &tuple->dst.u.tcp.port);

nf_ct_expect_put(exp);

    return 1;
}
hook_func(...){
    if(!(conntrack = nf_ct_get(sock_buff, &ctinfo)) ||

!(master_conntrack = nf_ct_get(skb, &master_ctinfo))){
spin_unlock_bh(&np_lock);
return NF_ACCEPT; /* Couldn't get conntrack */
}

    np_exp(conntrack);
}

_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html