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:
Jeremy Sowden
2020-10-25 14:15:49 +01:00
committed by Jan Engelhardt
parent b05ea5644c
commit b4faa4de65

View File

@@ -12,22 +12,13 @@
#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 status;
int group = GROUP;
int buf_size;
const char *ip;
char ipbuf[48];
struct sockaddr_nl local_addr;
int sock_fd, buf_size;
unsigned char *buf;
sock_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
@@ -56,6 +47,9 @@ int main(void)
}
while(1) {
struct xt_pknock_nl_msg *nlmsg;
const char *ip;
char ipbuf[48];
memset(buf, 0, buf_size);
status = recv(sock_fd, buf, buf_size, 0);