From: "Ming-Ching Tiew" <mingching.tiew@redtone.com>
To: netfilter@vger.kernel.org
Subject: Re: C code rule modifying
Date: Tue, 22 Apr 2008 09:16:19 +0800 [thread overview]
Message-ID: <002501c8a416$78a11ec0$8119fea9@MingChing> (raw)
In-Reply-To: 5078d3df0804211613o3213bdeege5054ff95e558d51@mail.gmail.com
Charles Romestant wrote:
> Ok im trying to add the rule to a table named charz, here is the code
> :
>
> char *command;
> FILE *fp = popen("/sbin/iptables",'w');
> if (fp==NULL){
> printf("\nerror opening pipe\n");
> return -1;
> }else{
> sprintf(command,"-A charz -p tcp --dport %s --source %s -j
> %s\0",port,currentIp,action2);
> printf("\n\n\n%s\n\n\n",command);
> fwrite(command,strlen(command),1,fp);
> pclose(fp);
>
>
Oh my, this is not netfilter at all ! Please post it to C programming
for beginners please ! There are quite a few bugs in these few lines,
the compiler would already have warned you !
next prev parent reply other threads:[~2008-04-22 1:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 22:05 C code rule modifying Charles Romestant
2008-04-21 22:42 ` Jan Engelhardt
2008-04-21 23:13 ` Charles Romestant
2008-04-22 1:05 ` Philip Craig
2008-04-22 1:16 ` Ming-Ching Tiew [this message]
2008-04-22 1:33 ` Charles M. Romestant F.
2008-04-22 8:48 ` Bernd Petrovitsch
2008-04-22 12:26 ` Charles Romestant
2008-04-22 7:59 ` Покотиленко Костик
2008-04-22 12:34 ` Jan Engelhardt
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='002501c8a416$78a11ec0$8119fea9@MingChing' \
--to=mingching.tiew@redtone.com \
--cc=netfilter@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.