mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 13:15:12 +02:00
pknock: pknlusr: tighten up variable scopes
Make global variables local, and move variables local to while-loop into the loop. Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
This commit is contained in:

committed by
Jan Engelhardt

parent
b05ea5644c
commit
b4faa4de65
@@ -12,22 +12,13 @@
|
|||||||
|
|
||||||
#define GROUP 1
|
#define GROUP 1
|
||||||
|
|
||||||
static struct sockaddr_nl local_addr;
|
|
||||||
static int sock_fd;
|
|
||||||
|
|
||||||
static unsigned char *buf;
|
|
||||||
|
|
||||||
static struct xt_pknock_nl_msg *nlmsg;
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int group = GROUP;
|
int group = GROUP;
|
||||||
|
struct sockaddr_nl local_addr;
|
||||||
int buf_size;
|
int sock_fd, buf_size;
|
||||||
|
unsigned char *buf;
|
||||||
const char *ip;
|
|
||||||
char ipbuf[48];
|
|
||||||
|
|
||||||
sock_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
|
sock_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
|
||||||
|
|
||||||
@@ -56,6 +47,9 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
struct xt_pknock_nl_msg *nlmsg;
|
||||||
|
const char *ip;
|
||||||
|
char ipbuf[48];
|
||||||
|
|
||||||
memset(buf, 0, buf_size);
|
memset(buf, 0, buf_size);
|
||||||
status = recv(sock_fd, buf, buf_size, 0);
|
status = recv(sock_fd, buf, buf_size, 0);
|
||||||
|
Reference in New Issue
Block a user