[NETFILTER]: ctnetlink: Remove debugging messages
Remove (compilation-breaking) debugging messages introduced at early development stage. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> 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
82b985434c
commit
9ea8cfd6aa
@@ -44,13 +44,6 @@ MODULE_LICENSE("GPL");
|
|||||||
|
|
||||||
static char __initdata version[] = "0.90";
|
static char __initdata version[] = "0.90";
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define DEBUGP printk
|
|
||||||
#else
|
|
||||||
#define DEBUGP(format, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
ctnetlink_dump_tuples_proto(struct sk_buff *skb,
|
ctnetlink_dump_tuples_proto(struct sk_buff *skb,
|
||||||
const struct ip_conntrack_tuple *tuple,
|
const struct ip_conntrack_tuple *tuple,
|
||||||
@@ -398,7 +391,6 @@ nfattr_failure:
|
|||||||
|
|
||||||
static int ctnetlink_done(struct netlink_callback *cb)
|
static int ctnetlink_done(struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
if (cb->args[1])
|
if (cb->args[1])
|
||||||
ip_conntrack_put((struct ip_conntrack *)cb->args[1]);
|
ip_conntrack_put((struct ip_conntrack *)cb->args[1]);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -411,9 +403,6 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
struct ip_conntrack_tuple_hash *h;
|
struct ip_conntrack_tuple_hash *h;
|
||||||
struct list_head *i;
|
struct list_head *i;
|
||||||
|
|
||||||
DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__,
|
|
||||||
cb->args[0], *id);
|
|
||||||
|
|
||||||
read_lock_bh(&ip_conntrack_lock);
|
read_lock_bh(&ip_conntrack_lock);
|
||||||
last = (struct ip_conntrack *)cb->args[1];
|
last = (struct ip_conntrack *)cb->args[1];
|
||||||
for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) {
|
for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) {
|
||||||
@@ -452,7 +441,6 @@ out:
|
|||||||
if (last)
|
if (last)
|
||||||
ip_conntrack_put(last);
|
ip_conntrack_put(last);
|
||||||
|
|
||||||
DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,8 +454,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
|
|||||||
{
|
{
|
||||||
struct nfattr *tb[CTA_IP_MAX];
|
struct nfattr *tb[CTA_IP_MAX];
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_IP_MAX, attr);
|
nfattr_parse_nested(tb, CTA_IP_MAX, attr);
|
||||||
|
|
||||||
if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
|
if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip))
|
||||||
@@ -481,8 +467,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
|
tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,8 +487,6 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
|
|||||||
struct ip_conntrack_protocol *proto;
|
struct ip_conntrack_protocol *proto;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
|
nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
|
||||||
|
|
||||||
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||||
@@ -531,8 +513,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,
|
|||||||
struct nfattr *tb[CTA_TUPLE_MAX];
|
struct nfattr *tb[CTA_TUPLE_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
memset(tuple, 0, sizeof(*tuple));
|
memset(tuple, 0, sizeof(*tuple));
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
|
nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
|
||||||
@@ -557,10 +537,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple,
|
|||||||
else
|
else
|
||||||
tuple->dst.dir = IP_CT_DIR_ORIGINAL;
|
tuple->dst.dir = IP_CT_DIR_ORIGINAL;
|
||||||
|
|
||||||
DUMP_TUPLE(tuple);
|
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,8 +553,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
|
|||||||
struct nfattr *tb[CTA_PROTONAT_MAX];
|
struct nfattr *tb[CTA_PROTONAT_MAX];
|
||||||
struct ip_nat_protocol *npt;
|
struct ip_nat_protocol *npt;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
|
nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
|
||||||
|
|
||||||
if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
||||||
@@ -597,7 +571,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
|
|||||||
|
|
||||||
ip_nat_proto_put(npt);
|
ip_nat_proto_put(npt);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,8 +586,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
|
|||||||
struct nfattr *tb[CTA_NAT_MAX];
|
struct nfattr *tb[CTA_NAT_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
memset(range, 0, sizeof(*range));
|
memset(range, 0, sizeof(*range));
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
|
nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
|
||||||
@@ -640,7 +611,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -650,8 +620,6 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
|
|||||||
{
|
{
|
||||||
struct nfattr *tb[CTA_HELP_MAX];
|
struct nfattr *tb[CTA_HELP_MAX];
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
|
nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
|
||||||
|
|
||||||
if (!tb[CTA_HELP_NAME-1])
|
if (!tb[CTA_HELP_NAME-1])
|
||||||
@@ -679,8 +647,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
struct ip_conntrack *ct;
|
struct ip_conntrack *ct;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -698,10 +664,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
h = ip_conntrack_find_get(&tuple, NULL);
|
h = ip_conntrack_find_get(&tuple, NULL);
|
||||||
if (!h) {
|
if (!h)
|
||||||
DEBUGP("tuple not found in conntrack hash\n");
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
|
|
||||||
ct = tuplehash_to_ctrack(h);
|
ct = tuplehash_to_ctrack(h);
|
||||||
|
|
||||||
@@ -716,7 +680,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
ct->timeout.function((unsigned long)ct);
|
ct->timeout.function((unsigned long)ct);
|
||||||
|
|
||||||
ip_conntrack_put(ct);
|
ip_conntrack_put(ct);
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -731,8 +694,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
struct sk_buff *skb2 = NULL;
|
struct sk_buff *skb2 = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nlh->nlmsg_flags & NLM_F_DUMP) {
|
if (nlh->nlmsg_flags & NLM_F_DUMP) {
|
||||||
struct nfgenmsg *msg = NLMSG_DATA(nlh);
|
struct nfgenmsg *msg = NLMSG_DATA(nlh);
|
||||||
u32 rlen;
|
u32 rlen;
|
||||||
@@ -770,11 +731,9 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
h = ip_conntrack_find_get(&tuple, NULL);
|
h = ip_conntrack_find_get(&tuple, NULL);
|
||||||
if (!h) {
|
if (!h)
|
||||||
DEBUGP("tuple not found in conntrack hash");
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
DEBUGP("tuple found\n");
|
|
||||||
ct = tuplehash_to_ctrack(h);
|
ct = tuplehash_to_ctrack(h);
|
||||||
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
@@ -795,7 +754,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
free:
|
free:
|
||||||
@@ -866,8 +824,6 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[])
|
|||||||
char *helpname;
|
char *helpname;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
/* don't change helper of sibling connections */
|
/* don't change helper of sibling connections */
|
||||||
if (ct->master)
|
if (ct->master)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -938,8 +894,6 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (cda[CTA_HELP-1]) {
|
if (cda[CTA_HELP-1]) {
|
||||||
err = ctnetlink_change_helper(ct, cda);
|
err = ctnetlink_change_helper(ct, cda);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -969,7 +923,6 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
|
|||||||
ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
|
ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGP("all done\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,8 +934,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
|
|||||||
struct ip_conntrack *ct;
|
struct ip_conntrack *ct;
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
ct = ip_conntrack_alloc(otuple, rtuple);
|
ct = ip_conntrack_alloc(otuple, rtuple);
|
||||||
if (ct == NULL || IS_ERR(ct))
|
if (ct == NULL || IS_ERR(ct))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -1017,7 +968,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
|
|||||||
if (ct->helper)
|
if (ct->helper)
|
||||||
ip_conntrack_helper_put(ct->helper);
|
ip_conntrack_helper_put(ct->helper);
|
||||||
|
|
||||||
DEBUGP("conntrack with id %u inserted\n", ct->id);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@@ -1033,8 +983,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
struct ip_conntrack_tuple_hash *h = NULL;
|
struct ip_conntrack_tuple_hash *h = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1058,7 +1006,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
|
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
write_unlock_bh(&ip_conntrack_lock);
|
write_unlock_bh(&ip_conntrack_lock);
|
||||||
DEBUGP("no such conntrack, create new\n");
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
if (nlh->nlmsg_flags & NLM_F_CREATE)
|
if (nlh->nlmsg_flags & NLM_F_CREATE)
|
||||||
err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
|
err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
|
||||||
@@ -1074,7 +1021,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
|
|
||||||
/* We manipulate the conntrack inside the global conntrack table lock,
|
/* We manipulate the conntrack inside the global conntrack table lock,
|
||||||
* so there's no need to increase the refcount */
|
* so there's no need to increase the refcount */
|
||||||
DEBUGP("conntrack found\n");
|
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
if (!(nlh->nlmsg_flags & NLM_F_EXCL))
|
if (!(nlh->nlmsg_flags & NLM_F_EXCL))
|
||||||
err = ctnetlink_change_conntrack(tuplehash_to_ctrack(h), cda);
|
err = ctnetlink_change_conntrack(tuplehash_to_ctrack(h), cda);
|
||||||
@@ -1249,8 +1195,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
struct list_head *i;
|
struct list_head *i;
|
||||||
u_int32_t *id = (u_int32_t *) &cb->args[0];
|
u_int32_t *id = (u_int32_t *) &cb->args[0];
|
||||||
|
|
||||||
DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id);
|
|
||||||
|
|
||||||
read_lock_bh(&ip_conntrack_lock);
|
read_lock_bh(&ip_conntrack_lock);
|
||||||
list_for_each_prev(i, &ip_conntrack_expect_list) {
|
list_for_each_prev(i, &ip_conntrack_expect_list) {
|
||||||
exp = (struct ip_conntrack_expect *) i;
|
exp = (struct ip_conntrack_expect *) i;
|
||||||
@@ -1266,8 +1210,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
out:
|
out:
|
||||||
read_unlock_bh(&ip_conntrack_lock);
|
read_unlock_bh(&ip_conntrack_lock);
|
||||||
|
|
||||||
DEBUGP("leaving, last id=%llu\n", *id);
|
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1285,8 +1227,6 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
struct sk_buff *skb2;
|
struct sk_buff *skb2;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1437,8 +1377,6 @@ ctnetlink_create_expect(struct nfattr *cda[])
|
|||||||
struct ip_conntrack *ct;
|
struct ip_conntrack *ct;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
/* caller guarantees that those three CTA_EXPECT_* exist */
|
/* caller guarantees that those three CTA_EXPECT_* exist */
|
||||||
err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE);
|
err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -1490,8 +1428,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
struct ip_conntrack_expect *exp;
|
struct ip_conntrack_expect *exp;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1520,8 +1456,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
err = ctnetlink_change_expect(exp, cda);
|
err = ctnetlink_change_expect(exp, cda);
|
||||||
write_unlock_bh(&ip_conntrack_lock);
|
write_unlock_bh(&ip_conntrack_lock);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,13 +47,6 @@ MODULE_LICENSE("GPL");
|
|||||||
|
|
||||||
static char __initdata version[] = "0.93";
|
static char __initdata version[] = "0.93";
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define DEBUGP printk
|
|
||||||
#else
|
|
||||||
#define DEBUGP(format, args...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
ctnetlink_dump_tuples_proto(struct sk_buff *skb,
|
ctnetlink_dump_tuples_proto(struct sk_buff *skb,
|
||||||
const struct nf_conntrack_tuple *tuple,
|
const struct nf_conntrack_tuple *tuple,
|
||||||
@@ -410,7 +403,6 @@ static int ctnetlink_done(struct netlink_callback *cb)
|
|||||||
{
|
{
|
||||||
if (cb->args[1])
|
if (cb->args[1])
|
||||||
nf_ct_put((struct nf_conn *)cb->args[1]);
|
nf_ct_put((struct nf_conn *)cb->args[1]);
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,9 +417,6 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
|
struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
|
||||||
u_int8_t l3proto = nfmsg->nfgen_family;
|
u_int8_t l3proto = nfmsg->nfgen_family;
|
||||||
|
|
||||||
DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__,
|
|
||||||
cb->args[0], *id);
|
|
||||||
|
|
||||||
read_lock_bh(&nf_conntrack_lock);
|
read_lock_bh(&nf_conntrack_lock);
|
||||||
last = (struct nf_conn *)cb->args[1];
|
last = (struct nf_conn *)cb->args[1];
|
||||||
for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
|
for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
|
||||||
@@ -471,7 +460,6 @@ out:
|
|||||||
if (last)
|
if (last)
|
||||||
nf_ct_put(last);
|
nf_ct_put(last);
|
||||||
|
|
||||||
DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id);
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,8 +470,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple)
|
|||||||
struct nf_conntrack_l3proto *l3proto;
|
struct nf_conntrack_l3proto *l3proto;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_IP_MAX, attr);
|
nfattr_parse_nested(tb, CTA_IP_MAX, attr);
|
||||||
|
|
||||||
l3proto = nf_ct_l3proto_find_get(tuple->src.l3num);
|
l3proto = nf_ct_l3proto_find_get(tuple->src.l3num);
|
||||||
@@ -493,8 +479,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple)
|
|||||||
|
|
||||||
nf_ct_l3proto_put(l3proto);
|
nf_ct_l3proto_put(l3proto);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,8 +494,6 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
|
|||||||
struct nf_conntrack_protocol *proto;
|
struct nf_conntrack_protocol *proto;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
|
nfattr_parse_nested(tb, CTA_PROTO_MAX, attr);
|
||||||
|
|
||||||
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto))
|
||||||
@@ -538,8 +520,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple,
|
|||||||
struct nfattr *tb[CTA_TUPLE_MAX];
|
struct nfattr *tb[CTA_TUPLE_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
memset(tuple, 0, sizeof(*tuple));
|
memset(tuple, 0, sizeof(*tuple));
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
|
nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]);
|
||||||
@@ -566,10 +546,6 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple,
|
|||||||
else
|
else
|
||||||
tuple->dst.dir = IP_CT_DIR_ORIGINAL;
|
tuple->dst.dir = IP_CT_DIR_ORIGINAL;
|
||||||
|
|
||||||
NF_CT_DUMP_TUPLE(tuple);
|
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,8 +562,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
|
|||||||
struct nfattr *tb[CTA_PROTONAT_MAX];
|
struct nfattr *tb[CTA_PROTONAT_MAX];
|
||||||
struct ip_nat_protocol *npt;
|
struct ip_nat_protocol *npt;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
|
nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr);
|
||||||
|
|
||||||
if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat))
|
||||||
@@ -606,7 +580,6 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr,
|
|||||||
|
|
||||||
ip_nat_proto_put(npt);
|
ip_nat_proto_put(npt);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,8 +595,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
|
|||||||
struct nfattr *tb[CTA_NAT_MAX];
|
struct nfattr *tb[CTA_NAT_MAX];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
memset(range, 0, sizeof(*range));
|
memset(range, 0, sizeof(*range));
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
|
nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
|
||||||
@@ -649,7 +620,6 @@ ctnetlink_parse_nat(struct nfattr *nat,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -659,8 +629,6 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name)
|
|||||||
{
|
{
|
||||||
struct nfattr *tb[CTA_HELP_MAX];
|
struct nfattr *tb[CTA_HELP_MAX];
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
|
nfattr_parse_nested(tb, CTA_HELP_MAX, attr);
|
||||||
|
|
||||||
if (!tb[CTA_HELP_NAME-1])
|
if (!tb[CTA_HELP_NAME-1])
|
||||||
@@ -690,8 +658,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
u_int8_t u3 = nfmsg->nfgen_family;
|
u_int8_t u3 = nfmsg->nfgen_family;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -709,10 +675,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
h = nf_conntrack_find_get(&tuple, NULL);
|
h = nf_conntrack_find_get(&tuple, NULL);
|
||||||
if (!h) {
|
if (!h)
|
||||||
DEBUGP("tuple not found in conntrack hash\n");
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
|
|
||||||
ct = nf_ct_tuplehash_to_ctrack(h);
|
ct = nf_ct_tuplehash_to_ctrack(h);
|
||||||
|
|
||||||
@@ -727,7 +691,6 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
ct->timeout.function((unsigned long)ct);
|
ct->timeout.function((unsigned long)ct);
|
||||||
|
|
||||||
nf_ct_put(ct);
|
nf_ct_put(ct);
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -744,8 +707,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
u_int8_t u3 = nfmsg->nfgen_family;
|
u_int8_t u3 = nfmsg->nfgen_family;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nlh->nlmsg_flags & NLM_F_DUMP) {
|
if (nlh->nlmsg_flags & NLM_F_DUMP) {
|
||||||
u32 rlen;
|
u32 rlen;
|
||||||
|
|
||||||
@@ -779,11 +740,9 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
h = nf_conntrack_find_get(&tuple, NULL);
|
h = nf_conntrack_find_get(&tuple, NULL);
|
||||||
if (!h) {
|
if (!h)
|
||||||
DEBUGP("tuple not found in conntrack hash");
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
DEBUGP("tuple found\n");
|
|
||||||
ct = nf_ct_tuplehash_to_ctrack(h);
|
ct = nf_ct_tuplehash_to_ctrack(h);
|
||||||
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
@@ -804,7 +763,6 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
free:
|
free:
|
||||||
@@ -876,8 +834,6 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
|
|||||||
char *helpname;
|
char *helpname;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (!help) {
|
if (!help) {
|
||||||
/* FIXME: we need to reallocate and rehash */
|
/* FIXME: we need to reallocate and rehash */
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
@@ -954,8 +910,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[])
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (cda[CTA_HELP-1]) {
|
if (cda[CTA_HELP-1]) {
|
||||||
err = ctnetlink_change_helper(ct, cda);
|
err = ctnetlink_change_helper(ct, cda);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -985,7 +939,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[])
|
|||||||
ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
|
ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGP("all done\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -997,8 +950,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
|
|||||||
struct nf_conn *ct;
|
struct nf_conn *ct;
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
ct = nf_conntrack_alloc(otuple, rtuple);
|
ct = nf_conntrack_alloc(otuple, rtuple);
|
||||||
if (ct == NULL || IS_ERR(ct))
|
if (ct == NULL || IS_ERR(ct))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -1028,7 +979,6 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
|
|||||||
add_timer(&ct->timeout);
|
add_timer(&ct->timeout);
|
||||||
nf_conntrack_hash_insert(ct);
|
nf_conntrack_hash_insert(ct);
|
||||||
|
|
||||||
DEBUGP("conntrack with id %u inserted\n", ct->id);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@@ -1046,8 +996,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
u_int8_t u3 = nfmsg->nfgen_family;
|
u_int8_t u3 = nfmsg->nfgen_family;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
if (nfattr_bad_size(cda, CTA_MAX, cta_min))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1071,7 +1019,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
|
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
write_unlock_bh(&nf_conntrack_lock);
|
write_unlock_bh(&nf_conntrack_lock);
|
||||||
DEBUGP("no such conntrack, create new\n");
|
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
if (nlh->nlmsg_flags & NLM_F_CREATE)
|
if (nlh->nlmsg_flags & NLM_F_CREATE)
|
||||||
err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
|
err = ctnetlink_create_conntrack(cda, &otuple, &rtuple);
|
||||||
@@ -1087,7 +1034,6 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
|
|
||||||
/* We manipulate the conntrack inside the global conntrack table lock,
|
/* We manipulate the conntrack inside the global conntrack table lock,
|
||||||
* so there's no need to increase the refcount */
|
* so there's no need to increase the refcount */
|
||||||
DEBUGP("conntrack found\n");
|
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
if (!(nlh->nlmsg_flags & NLM_F_EXCL))
|
if (!(nlh->nlmsg_flags & NLM_F_EXCL))
|
||||||
err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda);
|
err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda);
|
||||||
@@ -1268,8 +1214,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
|
struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
|
||||||
u_int8_t l3proto = nfmsg->nfgen_family;
|
u_int8_t l3proto = nfmsg->nfgen_family;
|
||||||
|
|
||||||
DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id);
|
|
||||||
|
|
||||||
read_lock_bh(&nf_conntrack_lock);
|
read_lock_bh(&nf_conntrack_lock);
|
||||||
list_for_each_prev(i, &nf_conntrack_expect_list) {
|
list_for_each_prev(i, &nf_conntrack_expect_list) {
|
||||||
exp = (struct nf_conntrack_expect *) i;
|
exp = (struct nf_conntrack_expect *) i;
|
||||||
@@ -1287,8 +1231,6 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
out:
|
out:
|
||||||
read_unlock_bh(&nf_conntrack_lock);
|
read_unlock_bh(&nf_conntrack_lock);
|
||||||
|
|
||||||
DEBUGP("leaving, last id=%llu\n", *id);
|
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,8 +1250,6 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
u_int8_t u3 = nfmsg->nfgen_family;
|
u_int8_t u3 = nfmsg->nfgen_family;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1460,8 +1400,6 @@ ctnetlink_create_expect(struct nfattr *cda[], u_int8_t u3)
|
|||||||
struct nf_conn_help *help;
|
struct nf_conn_help *help;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
/* caller guarantees that those three CTA_EXPECT_* exist */
|
/* caller guarantees that those three CTA_EXPECT_* exist */
|
||||||
err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE, u3);
|
err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE, u3);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -1516,8 +1454,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
u_int8_t u3 = nfmsg->nfgen_family;
|
u_int8_t u3 = nfmsg->nfgen_family;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
DEBUGP("entered %s\n", __FUNCTION__);
|
|
||||||
|
|
||||||
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -1546,8 +1482,6 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
err = ctnetlink_change_expect(exp, cda);
|
err = ctnetlink_change_expect(exp, cda);
|
||||||
write_unlock_bh(&nf_conntrack_lock);
|
write_unlock_bh(&nf_conntrack_lock);
|
||||||
|
|
||||||
DEBUGP("leaving\n");
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user