mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-12-07 16:43:54 +01:00
xt_LOGMARK: put ct dumping into its own function
This commit is contained in:
@@ -29,33 +29,10 @@ static const char *const dir_names[] = {
|
|||||||
"ORIGINAL", "REPLY",
|
"ORIGINAL", "REPLY",
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int
|
static void logmark_ct(const struct nf_conn *ct, enum ip_conntrack_info ctinfo)
|
||||||
logmark_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
|
||||||
{
|
{
|
||||||
const struct sk_buff *skb = *pskb;
|
|
||||||
const struct xt_logmark_tginfo *info = par->targinfo;
|
|
||||||
const struct nf_conn *ct;
|
|
||||||
enum ip_conntrack_info ctinfo;
|
|
||||||
bool prev = false;
|
bool prev = false;
|
||||||
|
|
||||||
printk("<%u>%.*s""iif=%d hook=%s nfmark=0x%x "
|
|
||||||
"secmark=0x%x classify=0x%x",
|
|
||||||
info->level, (unsigned int)sizeof(info->prefix), info->prefix,
|
|
||||||
skb_ifindex(skb), hook_names[par->hooknum],
|
|
||||||
skb_nfmark(skb), skb_secmark(skb), skb->priority);
|
|
||||||
|
|
||||||
ct = nf_ct_get(skb, &ctinfo);
|
|
||||||
printk(" ctdir=%s", dir_names[ctinfo >= IP_CT_IS_REPLY]);
|
|
||||||
if (ct == NULL) {
|
|
||||||
printk(" ct=NULL ctmark=NULL ctstate=INVALID ctstatus=NONE");
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
|
|
||||||
} else if (nf_ct_is_untracked(ct)) {
|
|
||||||
printk(" ct=UNTRACKED ctmark=NULL ctstate=UNTRACKED ctstatus=NONE");
|
|
||||||
#else
|
|
||||||
} else if (ct == &nf_conntrack_untracked) {
|
|
||||||
printk(" ct=UNTRACKED ctmark=NULL ctstate=UNTRACKED ctstatus=NONE");
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
printk(" ct=0x%p ctmark=0x%x ctstate=", ct, ct->mark);
|
printk(" ct=0x%p ctmark=0x%x ctstate=", ct, ct->mark);
|
||||||
ctinfo %= IP_CT_IS_REPLY;
|
ctinfo %= IP_CT_IS_REPLY;
|
||||||
if (ctinfo == IP_CT_NEW)
|
if (ctinfo == IP_CT_NEW)
|
||||||
@@ -84,6 +61,34 @@ logmark_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
|||||||
(jiffies - ct->timeout.expires) / HZ);
|
(jiffies - ct->timeout.expires) / HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
logmark_tg(struct sk_buff **pskb, const struct xt_action_param *par)
|
||||||
|
{
|
||||||
|
const struct sk_buff *skb = *pskb;
|
||||||
|
const struct xt_logmark_tginfo *info = par->targinfo;
|
||||||
|
const struct nf_conn *ct;
|
||||||
|
enum ip_conntrack_info ctinfo;
|
||||||
|
|
||||||
|
printk("<%u>%.*s""iif=%d hook=%s nfmark=0x%x "
|
||||||
|
"secmark=0x%x classify=0x%x",
|
||||||
|
info->level, (unsigned int)sizeof(info->prefix), info->prefix,
|
||||||
|
skb_ifindex(skb), hook_names[par->hooknum],
|
||||||
|
skb_nfmark(skb), skb_secmark(skb), skb->priority);
|
||||||
|
|
||||||
|
ct = nf_ct_get(skb, &ctinfo);
|
||||||
|
printk(" ctdir=%s", dir_names[ctinfo >= IP_CT_IS_REPLY]);
|
||||||
|
if (ct == NULL)
|
||||||
|
printk(" ct=NULL ctmark=NULL ctstate=INVALID ctstatus=NONE");
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
|
||||||
|
else if (nf_ct_is_untracked(ct))
|
||||||
|
printk(" ct=UNTRACKED ctmark=NULL ctstate=UNTRACKED ctstatus=NONE");
|
||||||
|
#else
|
||||||
|
else if (ct == &nf_conntrack_untracked)
|
||||||
|
printk(" ct=UNTRACKED ctmark=NULL ctstate=UNTRACKED ctstatus=NONE");
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
logmark_ct(ct, ctinfo);
|
||||||
|
|
||||||
printk("\n");
|
printk("\n");
|
||||||
return XT_CONTINUE;
|
return XT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user