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

That should be "w" (a string, not a char).

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

If that still doesn't fix it then use valgrind to find the
exact line number.

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