Skip to content

Commit 3c458f2

Browse files
authored
Add files via upload
1 parent b696425 commit 3c458f2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

iptablespush.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ int DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
6868
REDISMODULE_READ | REDISMODULE_WRITE);
6969
pid_t pid;
7070
int fd;
71-
char tmp_buf[4096];
7271

73-
static char check_command[256], insert_command[256];
7472
#ifdef WITH_IPSET
73+
static char insert_command[256];
7574
sprintf(insert_command, "ipset add block_ip %s",
7675
RedisModule_StringPtrLen(argv[1], NULL));
7776
#else
77+
static char check_command[256], insert_command[256];
78+
char tmp_buf[4096];
7879
sprintf(check_command, "iptables -C INPUT -s %s -j DROP",
7980
RedisModule_StringPtrLen(argv[1], NULL));
8081
sprintf(insert_command, "iptables -I INPUT -s %s -j DROP",
@@ -140,13 +141,14 @@ int ACCEPT_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, in
140141
REDISMODULE_READ | REDISMODULE_WRITE);
141142
pid_t pid;
142143
int fd;
143-
char tmp_buf[4096];
144144

145-
static char check_command[256], insert_command[256];
146145
#ifdef WITH_IPSET
146+
static char insert_command[256];
147147
sprintf(insert_command, "ipset add allow_ip %s",
148148
RedisModule_StringPtrLen(argv[1], NULL));
149149
#else
150+
char tmp_buf[4096];
151+
static char check_command[256], insert_command[256];
150152
sprintf(check_command, "iptables -C INPUT -s %s -j ACCEPT",
151153
RedisModule_StringPtrLen(argv[1], NULL));
152154
sprintf(insert_command, "iptables -I INPUT -s %s -j ACCEPT",
@@ -216,13 +218,14 @@ int TTL_DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
216218
}
217219
pid_t pid;
218220
int fd;
219-
char tmp_buf[4096];
220221

221-
static char check_command[256], insert_command[256];
222222
#ifdef WITH_IPSET
223+
static char insert_command[256];
223224
sprintf(insert_command, "ipset add block_ip %s",
224225
RedisModule_StringPtrLen(argv[1], NULL));
225226
#else
227+
static char check_command[256], insert_command[256];
228+
char tmp_buf[4096];
226229
sprintf(check_command, "iptables -C INPUT -s %s -j DROP",
227230
RedisModule_StringPtrLen(argv[1], NULL));
228231
sprintf(insert_command, "iptables -I INPUT -s %s -j DROP",

0 commit comments

Comments
 (0)