@@ -68,13 +68,14 @@ int DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
68
68
REDISMODULE_READ | REDISMODULE_WRITE );
69
69
pid_t pid ;
70
70
int fd ;
71
- char tmp_buf [4096 ];
72
71
73
- static char check_command [256 ], insert_command [256 ];
74
72
#ifdef WITH_IPSET
73
+ static char insert_command [256 ];
75
74
sprintf (insert_command , "ipset add block_ip %s" ,
76
75
RedisModule_StringPtrLen (argv [1 ], NULL ));
77
76
#else
77
+ static char check_command [256 ], insert_command [256 ];
78
+ char tmp_buf [4096 ];
78
79
sprintf (check_command , "iptables -C INPUT -s %s -j DROP" ,
79
80
RedisModule_StringPtrLen (argv [1 ], NULL ));
80
81
sprintf (insert_command , "iptables -I INPUT -s %s -j DROP" ,
@@ -140,13 +141,14 @@ int ACCEPT_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, in
140
141
REDISMODULE_READ | REDISMODULE_WRITE );
141
142
pid_t pid ;
142
143
int fd ;
143
- char tmp_buf [4096 ];
144
144
145
- static char check_command [256 ], insert_command [256 ];
146
145
#ifdef WITH_IPSET
146
+ static char insert_command [256 ];
147
147
sprintf (insert_command , "ipset add allow_ip %s" ,
148
148
RedisModule_StringPtrLen (argv [1 ], NULL ));
149
149
#else
150
+ char tmp_buf [4096 ];
151
+ static char check_command [256 ], insert_command [256 ];
150
152
sprintf (check_command , "iptables -C INPUT -s %s -j ACCEPT" ,
151
153
RedisModule_StringPtrLen (argv [1 ], NULL ));
152
154
sprintf (insert_command , "iptables -I INPUT -s %s -j ACCEPT" ,
@@ -216,13 +218,14 @@ int TTL_DROP_Insert_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv,
216
218
}
217
219
pid_t pid ;
218
220
int fd ;
219
- char tmp_buf [4096 ];
220
221
221
- static char check_command [256 ], insert_command [256 ];
222
222
#ifdef WITH_IPSET
223
+ static char insert_command [256 ];
223
224
sprintf (insert_command , "ipset add block_ip %s" ,
224
225
RedisModule_StringPtrLen (argv [1 ], NULL ));
225
226
#else
227
+ static char check_command [256 ], insert_command [256 ];
228
+ char tmp_buf [4096 ];
226
229
sprintf (check_command , "iptables -C INPUT -s %s -j DROP" ,
227
230
RedisModule_StringPtrLen (argv [1 ], NULL ));
228
231
sprintf (insert_command , "iptables -I INPUT -s %s -j DROP" ,
0 commit comments