@@ -215,7 +215,8 @@ extern void nf_ct_insert_dying_list(struct nf_conn *ct);
extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report);
-extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
+extern bool nf_ct_get_tuplepr(const struct net *net,
+ const struct sk_buff *skb,
unsigned int nhoff, u_int16_t l3num,
struct nf_conntrack_tuple *tuple);
extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
@@ -46,8 +46,9 @@ struct nf_conntrack_l3proto {
* *dataoff: offset of protocol header (TCP, UDP,...) in skb
* *protonum: protocol number
*/
- int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
- unsigned int *dataoff, u_int8_t *protonum);
+ int (*get_l4proto)(const struct net *net, const struct sk_buff *skb,
+ unsigned int nhoff, unsigned int *dataoff,
+ u_int8_t *protonum);
int (*tuple_to_nlattr)(struct sk_buff *skb,
const struct nf_conntrack_tuple *t);
@@ -66,7 +66,8 @@ static int ipv4_print_tuple(struct seq_file *s,
&tuple->src.u3.ip, &tuple->dst.u3.ip);
}
-static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+static int ipv4_get_l4proto(const struct net *net,
+ const struct sk_buff *skb, unsigned int nhoff,
unsigned int *dataoff, u_int8_t *protonum)
{
const struct iphdr *iph;
@@ -127,7 +127,7 @@ icmp_error_message(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
NF_CT_ASSERT(skb->nfct == NULL);
/* Are they talking about one of our connections? */
- if (!nf_ct_get_tuplepr(skb,
+ if (!nf_ct_get_tuplepr(net, skb,
skb_network_offset(skb) + ip_hdrlen(skb)
+ sizeof(struct icmphdr),
PF_INET, &origtuple)) {
@@ -116,7 +116,8 @@ static int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
return start;
}
-static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+static int ipv6_get_l4proto(const struct net *net,
+ const struct sk_buff *skb, unsigned int nhoff,
unsigned int *dataoff, u_int8_t *protonum)
{
unsigned int extoff = nhoff + sizeof(struct ipv6hdr);
@@ -143,7 +143,7 @@ icmpv6_error_message(struct net *net, struct nf_conn *tmpl,
NF_CT_ASSERT(skb->nfct == NULL);
/* Are they talking about one of our connections? */
- if (!nf_ct_get_tuplepr(skb,
+ if (!nf_ct_get_tuplepr(net, skb,
skb_network_offset(skb)
+ sizeof(struct ipv6hdr)
+ sizeof(struct icmp6hdr),
@@ -128,8 +128,9 @@ nf_ct_get_tuple(const struct sk_buff *skb,
}
EXPORT_SYMBOL_GPL(nf_ct_get_tuple);
-bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
- u_int16_t l3num, struct nf_conntrack_tuple *tuple)
+bool nf_ct_get_tuplepr(const struct net *net, 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;
@@ -140,7 +141,7 @@ bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
rcu_read_lock();
l3proto = __nf_ct_l3proto_find(l3num);
- ret = l3proto->get_l4proto(skb, nhoff, &protoff, &protonum);
+ ret = l3proto->get_l4proto(net, skb, nhoff, &protoff, &protonum);
if (ret != NF_ACCEPT) {
rcu_read_unlock();
return false;
@@ -926,7 +927,7 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
/* rcu_read_lock()ed by nf_hook_slow */
l3proto = __nf_ct_l3proto_find(pf);
- ret = l3proto->get_l4proto(skb, skb_network_offset(skb),
+ ret = l3proto->get_l4proto(net, skb, skb_network_offset(skb),
&dataoff, &protonum);
if (ret <= 0) {
pr_debug("not prepared to track yet or error occurred\n");
@@ -55,7 +55,8 @@ static int generic_print_tuple(struct seq_file *s,
return 0;
}
-static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+static int generic_get_l4proto(const struct net *net,
+ const struct sk_buff *skb, unsigned int nhoff,
unsigned int *dataoff, u_int8_t *protonum)
{
/* Never track !!! */
@@ -188,7 +188,7 @@ connlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
ct = nf_ct_get(skb, &ctinfo);
if (ct != NULL)
tuple_ptr = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
- else if (!nf_ct_get_tuplepr(skb, skb_network_offset(skb),
+ else if (!nf_ct_get_tuplepr(net, skb, skb_network_offset(skb),
par->family, &tuple))
goto hotdrop;
Add the net struct as argument to nf_ct_get_tuplepr and get_l4proto in order to be able to check the setting of nf_conntrack_log_invalid. Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> --- include/net/netfilter/nf_conntrack.h | 3 ++- include/net/netfilter/nf_conntrack_l3proto.h | 5 +++-- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 3 ++- net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 2 +- net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 3 ++- net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 2 +- net/netfilter/nf_conntrack_core.c | 9 +++++---- net/netfilter/nf_conntrack_l3proto_generic.c | 3 ++- net/netfilter/xt_connlimit.c | 2 +- 9 files changed, 19 insertions(+), 13 deletions(-)