Skip to contentSkip to conversation

question related rules editor iptc based

DISCUSSION basteon 1 participant 1 message Nov 24, 2009 netfilter

lore
Share & tools
lore

basteon

author
#0 lore raw

struct ipt_entry *entry = NULL;
struct ipt_entry_target *pt = NULL,*ptl=NULL;
struct ipt_entry_match *pm=NULL,*pml=NULL;
struct ipt_udp *pudp=NULL;
struct ipt_icmp *picmp=NULL;
struct xt_length_info *payload = NULL;

#udp
match_size += sizeof(struct ipt_entry_match) + sizeof(struct ipt_udp); size = sizeof(*entry) + match_size + target_size; entry=calloc(1,size); entry->target_offset=sizeof(*entry)+match_size; entry->ip.proto = proto;
--------------------
and then trying enroll this rule.
pm=(struct ipt_entry_match*) entry->elems; pm->u.user.match_size = match_size; strcpy(pm->u.user.name,"udp");
pudp = (struct ipt_udp*) pm->data;
pudp->spts[0] = pudp->spts[1] = src_port;
pudp->dpts[0] = pudp->dpts[1] = dst_port;
pt = (struct ipt_entry_target*)(entry->elems+match_size); pt->u.user.target_size = target_size;

# length
match_size = sizeof(struct xt_length_info);
--------------------
pml=(struct ipt_entry_match*) entry->elems;
pml->u.user.match_size = match_size;
strcpy(pml->u.user.name,"length");
payload = (struct xt_length_info*) pml->data;
payload->max = 10;
ptl = (struct ipt_entry_target*)(entry->elems+match_size);
ptl->u.user.target_size = target_size;

but, it just not happening, what's wrong? it well works with tcp and icmp except udp and payload length