[NETFILTER]: nf_conntrack: Introduces nf_ct_get_tuplepr and uses it
nf_ct_get_tuple() requires the offset to transport header and that bothers callers such as icmp[v6] l4proto modules. This introduces new function to simplify them. Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ffc3069048
commit
e2a3123fbe
@@ -113,6 +113,36 @@ nf_ct_get_tuple(const struct sk_buff *skb,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_ct_get_tuple);
|
||||
|
||||
int nf_ct_get_tuplepr(const struct sk_buff *skb,
|
||||
unsigned int nhoff,
|
||||
u_int16_t l3num,
|
||||
struct nf_conntrack_tuple *tuple)
|
||||
{
|
||||
struct nf_conntrack_l3proto *l3proto;
|
||||
struct nf_conntrack_l4proto *l4proto;
|
||||
unsigned int protoff;
|
||||
u_int8_t protonum;
|
||||
int ret;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
l3proto = __nf_ct_l3proto_find(l3num);
|
||||
ret = l3proto->get_l4proto(skb, nhoff, &protoff, &protonum);
|
||||
if (ret != NF_ACCEPT) {
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
l4proto = __nf_ct_l4proto_find(l3num, protonum);
|
||||
|
||||
ret = nf_ct_get_tuple(skb, nhoff, protoff, l3num, protonum, tuple,
|
||||
l3proto, l4proto);
|
||||
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_ct_get_tuplepr);
|
||||
|
||||
int
|
||||
nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
|
||||
const struct nf_conntrack_tuple *orig,
|
||||
|
Reference in New Issue
Block a user