Results 1 to 2 of 2
i'm newbie for linux programing and i program test.c in this below.
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
...
- 12-01-2008 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 84
system call include parameter!!
i'm newbie for linux programing and i program test.c in this below.
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char **argv )
{
if(strcmp(argv[1],"add_rule")==0)
{
system("iptables -I INPUT -p tcp -m mac --mac-source $1 -m tcp --dport $2 -j DROP");
system("iptables -I FORWARD -p tcp -m mac --mac-source $1 -m tcp --dport $2 -j DROP");
}
test 00:00:00:00:00:00 172.168.1.100
after use that command iptables it's add INPUT,FORWARD
how to !!! help me it's code not working..!!
thank you for help me.
- 12-01-2008 #2
Hello,
the system function does not do variable substitution. You want to use sprintf.Debian GNU/Linux -- You know you want it.


Reply With Quote