Thursday, 22 March 2018

how to display the tuples in kernel


how to display the tuples in kernel:

Use %pI4 to print the ip address from kernel.

static inline void vel_nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t, char *name)
{
    printk("Vel %s %s  %p: dst proto = %u src = %pI4:%hu -> dst = %pI4:%hu src l3num = %d \n", __FUNCTION__, name,
            t, t->dst.protonum,
            &t->src.u3.ip, ntohs(t->src.u.all),
            &t->dst.u3.ip, ntohs(t->dst.u.all), t->src.l3num);
}

Output:


No comments:

Post a Comment