Re: C code rule modifying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 !



--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux