Re: C code rule modifying

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

 



В Вто, 22/04/2008 в 18:43 +0000, Charles Romestant пишет:
> Ok im trying to add the rule to a table named charz, here is the code :
> 
> char *command;

This is first segfault, change to this:

char command[1024];

>         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);

-- 
Покотиленко Костик <casper@xxxxxxxxxxxx>

--
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