netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: basteon <basteon@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: question related rules editor iptc based
Date: Tue, 24 Nov 2009 21:17:38 +1000	[thread overview]
Message-ID: <328fe7150911240317i5068de6ew8e5c57639478585@mail.gmail.com> (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

                 reply	other threads:[~2009-11-24 11:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=328fe7150911240317i5068de6ew8e5c57639478585@mail.gmail.com \
    --to=basteon@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).