forked from solene/iblock
make sure table arg is considered
This commit is contained in:
parent
e364ce9780
commit
0265627230
17
main.c
17
main.c
|
@ -67,6 +67,15 @@ main(int argc, char *argv[])
|
||||||
int kq = 0;
|
int kq = 0;
|
||||||
socklen_t sin_size = 0;
|
socklen_t sin_size = 0;
|
||||||
int s[MAXSOCK] = {0};
|
int s[MAXSOCK] = {0};
|
||||||
|
struct kevent ev[MAXSOCK] = {0};
|
||||||
|
struct addrinfo hints, *servinfo, *res;
|
||||||
|
struct sockaddr_storage client_addr;
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
usage();
|
||||||
|
else if (argc == 2)
|
||||||
|
table = argv[1];
|
||||||
|
|
||||||
const char *bancmd[] = { "/usr/bin/doas", "-n",
|
const char *bancmd[] = { "/usr/bin/doas", "-n",
|
||||||
"/sbin/pfctl", "-t", table,
|
"/sbin/pfctl", "-t", table,
|
||||||
"-T", "add", ip,
|
"-T", "add", ip,
|
||||||
|
@ -75,9 +84,6 @@ main(int argc, char *argv[])
|
||||||
"/sbin/pfctl",
|
"/sbin/pfctl",
|
||||||
"-k", ip,
|
"-k", ip,
|
||||||
NULL };
|
NULL };
|
||||||
struct kevent ev[MAXSOCK] = {0};
|
|
||||||
struct addrinfo hints, *servinfo, *res;
|
|
||||||
struct sockaddr_storage client_addr;
|
|
||||||
|
|
||||||
/* safety first */
|
/* safety first */
|
||||||
if (unveil("/usr/bin/doas", "rx") != 0)
|
if (unveil("/usr/bin/doas", "rx") != 0)
|
||||||
|
@ -88,11 +94,6 @@ main(int argc, char *argv[])
|
||||||
if (pledge("stdio inet exec proc rpath", NULL) != 0)
|
if (pledge("stdio inet exec proc rpath", NULL) != 0)
|
||||||
err(1, "pledge");
|
err(1, "pledge");
|
||||||
|
|
||||||
if (argc > 2)
|
|
||||||
usage();
|
|
||||||
else if (argc == 2)
|
|
||||||
table = argv[1];
|
|
||||||
|
|
||||||
/* initialize structures */
|
/* initialize structures */
|
||||||
memset(&client_addr, 0, sizeof(client_addr));
|
memset(&client_addr, 0, sizeof(client_addr));
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
|
Loading…
Reference in New Issue