netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question related rules editor iptc based
@ 2009-11-24 11:17 basteon
  0 siblings, 0 replies; only message in thread
From: basteon @ 2009-11-24 11:17 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-24 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-24 11:17 question related rules editor iptc based basteon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).