Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
limithit authored Apr 8, 2019
1 parent b696425 commit 3c458f2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions iptablespush.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ int DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
REDISMODULE_READ | REDISMODULE_WRITE);
pid_t pid;
int fd;
char tmp_buf[4096];

static char check_command[256], insert_command[256];
#ifdef WITH_IPSET
static char insert_command[256];
sprintf(insert_command, "ipset add block_ip %s",
RedisModule_StringPtrLen(argv[1], NULL));
#else
static char check_command[256], insert_command[256];
char tmp_buf[4096];
sprintf(check_command, "iptables -C INPUT -s %s -j DROP",
RedisModule_StringPtrLen(argv[1], NULL));
sprintf(insert_command, "iptables -I INPUT -s %s -j DROP",
Expand Down Expand Up @@ -140,13 +141,14 @@ int ACCEPT_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, in
REDISMODULE_READ | REDISMODULE_WRITE);
pid_t pid;
int fd;
char tmp_buf[4096];

static char check_command[256], insert_command[256];
#ifdef WITH_IPSET
static char insert_command[256];
sprintf(insert_command, "ipset add allow_ip %s",
RedisModule_StringPtrLen(argv[1], NULL));
#else
char tmp_buf[4096];
static char check_command[256], insert_command[256];
sprintf(check_command, "iptables -C INPUT -s %s -j ACCEPT",
RedisModule_StringPtrLen(argv[1], NULL));
sprintf(insert_command, "iptables -I INPUT -s %s -j ACCEPT",
Expand Down Expand Up @@ -216,13 +218,14 @@ int TTL_DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
}
pid_t pid;
int fd;
char tmp_buf[4096];

static char check_command[256], insert_command[256];
#ifdef WITH_IPSET
static char insert_command[256];
sprintf(insert_command, "ipset add block_ip %s",
RedisModule_StringPtrLen(argv[1], NULL));
#else
static char check_command[256], insert_command[256];
char tmp_buf[4096];
sprintf(check_command, "iptables -C INPUT -s %s -j DROP",
RedisModule_StringPtrLen(argv[1], NULL));
sprintf(insert_command, "iptables -I INPUT -s %s -j DROP",
Expand Down

0 comments on commit 3c458f2

Please sign in to comment.