diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-05-24 09:33:38 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-05-24 09:33:38 +0200 |
commit | eb77f0db6a95691bc62ce9669c27f7cfa173bee5 (patch) | |
tree | f682b6f75397d3fca25da6331c9a64db5c656b75 /lib/session.c | |
parent | bacee4529c3fdd43a02ee96e636a04c2e81d4565 (diff) |
Protocol-level debugging support added
Diffstat (limited to 'lib/session.c')
-rw-r--r-- | lib/session.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/session.c b/lib/session.c index a9c7c33..bab1846 100644 --- a/lib/session.c +++ b/lib/session.c @@ -485,6 +485,10 @@ static const struct ipset_attr_policy ipaddr_attrs[] = { }, }; +#ifdef IPSET_DEBUG +static int debug = 1; +#endif + static int generic_data_attr_cb(const struct nlattr *attr, void *data, int attr_max, const struct ipset_attr_policy *policy) @@ -492,14 +496,14 @@ generic_data_attr_cb(const struct nlattr *attr, void *data, const struct nlattr **tb = data; int type = mnl_attr_get_type(attr); - D("attr type: %u, len %u", type, attr->nla_len); + IF_D(debug, "attr type: %u, len %u", type, attr->nla_len); if (mnl_attr_type_valid(attr, attr_max) < 0) { - D("attr type: %u INVALID", type); + IF_D(debug, "attr type: %u INVALID", type); return MNL_CB_ERROR; } if (mnl_attr_validate(attr, policy[type].type) < 0) { - D("attr type: %u POLICY, attrlen %u", type, - mnl_attr_get_payload_len(attr)); + IF_D(debug, "attr type: %u POLICY, attrlen %u", type, + mnl_attr_get_payload_len(attr)); return MNL_CB_ERROR; } if (policy[type].type == MNL_TYPE_NUL_STRING @@ -1969,3 +1973,7 @@ ipset_session_fini(struct ipset_session *session) free(session); return 0; } + +#ifdef IPSET_DEBUG +#include "debug.c" +#endif |