Lines 236-242
usage(void)
Link Here
|
236 |
|
236 |
|
237 |
fprintf(stderr, "usage: %s [-AdeghmNnOPqRrvz] ", __progname); |
237 |
fprintf(stderr, "usage: %s [-AdeghmNnOPqRrvz] ", __progname); |
238 |
fprintf(stderr, "[-a anchor] [-D macro=value] [-F modifier]\n"); |
238 |
fprintf(stderr, "[-a anchor] [-D macro=value] [-F modifier]\n"); |
239 |
fprintf(stderr, "\t[-f file] [-i interface] [-K host | network]\n"); |
239 |
fprintf(stderr, "\t[-f file] [-i interface] [-K host | network [-c]]\n"); |
240 |
fprintf(stderr, "\t[-k host | network | label | id] "); |
240 |
fprintf(stderr, "\t[-k host | network | label | id] "); |
241 |
fprintf(stderr, "[-o level] [-p device]\n"); |
241 |
fprintf(stderr, "[-o level] [-p device]\n"); |
242 |
fprintf(stderr, "\t[-s modifier] "); |
242 |
fprintf(stderr, "\t[-s modifier] "); |
Lines 449-458
pfctl_kill_src_nodes(int dev, const char *iface, int opts)
Link Here
|
449 |
struct pfioc_src_node_kill psnk; |
449 |
struct pfioc_src_node_kill psnk; |
450 |
struct addrinfo *res[2], *resp[2]; |
450 |
struct addrinfo *res[2], *resp[2]; |
451 |
struct sockaddr last_src, last_dst; |
451 |
struct sockaddr last_src, last_dst; |
452 |
int killed, sources, dests; |
452 |
int killed, killed_states, sources, dests; |
453 |
int ret_ga; |
453 |
int ret_ga; |
454 |
|
454 |
|
455 |
killed = sources = dests = 0; |
455 |
killed = killed_states = sources = dests = 0; |
456 |
|
456 |
|
457 |
memset(&psnk, 0, sizeof(psnk)); |
457 |
memset(&psnk, 0, sizeof(psnk)); |
458 |
memset(&psnk.psnk_src.addr.v.a.mask, 0xff, |
458 |
memset(&psnk.psnk_src.addr.v.a.mask, 0xff, |
Lines 462-467
pfctl_kill_src_nodes(int dev, const char *iface, int opts)
Link Here
|
462 |
|
462 |
|
463 |
pfctl_addrprefix(src_node_kill[0], &psnk.psnk_src.addr.v.a.mask); |
463 |
pfctl_addrprefix(src_node_kill[0], &psnk.psnk_src.addr.v.a.mask); |
464 |
|
464 |
|
|
|
465 |
psnk.psnk_kill_linked_states = opts & PF_OPT_KILLLINKEDSTATES; |
466 |
|
465 |
if ((ret_ga = getaddrinfo(src_node_kill[0], NULL, NULL, &res[0]))) { |
467 |
if ((ret_ga = getaddrinfo(src_node_kill[0], NULL, NULL, &res[0]))) { |
466 |
errx(1, "getaddrinfo: %s", gai_strerror(ret_ga)); |
468 |
errx(1, "getaddrinfo: %s", gai_strerror(ret_ga)); |
467 |
/* NOTREACHED */ |
469 |
/* NOTREACHED */ |
Lines 529-548
pfctl_kill_src_nodes(int dev, const char *iface, int opts)
Link Here
|
529 |
if (ioctl(dev, DIOCKILLSRCNODES, &psnk)) |
531 |
if (ioctl(dev, DIOCKILLSRCNODES, &psnk)) |
530 |
err(1, "DIOCKILLSRCNODES"); |
532 |
err(1, "DIOCKILLSRCNODES"); |
531 |
killed += psnk.psnk_killed; |
533 |
killed += psnk.psnk_killed; |
|
|
534 |
killed_states += psnk.psnk_killed_states; |
532 |
} |
535 |
} |
533 |
freeaddrinfo(res[1]); |
536 |
freeaddrinfo(res[1]); |
534 |
} else { |
537 |
} else { |
535 |
if (ioctl(dev, DIOCKILLSRCNODES, &psnk)) |
538 |
if (ioctl(dev, DIOCKILLSRCNODES, &psnk)) |
536 |
err(1, "DIOCKILLSRCNODES"); |
539 |
err(1, "DIOCKILLSRCNODES"); |
537 |
killed += psnk.psnk_killed; |
540 |
killed += psnk.psnk_killed; |
|
|
541 |
killed_states += psnk.psnk_killed_states; |
538 |
} |
542 |
} |
539 |
} |
543 |
} |
540 |
|
544 |
|
541 |
freeaddrinfo(res[0]); |
545 |
freeaddrinfo(res[0]); |
542 |
|
546 |
|
543 |
if ((opts & PF_OPT_QUIET) == 0) |
547 |
if ((opts & PF_OPT_QUIET) == 0) |
544 |
fprintf(stderr, "killed %d src nodes from %d sources and %d " |
548 |
fprintf(stderr, "killed %d src nodes and %d linked states " |
545 |
"destinations\n", killed, sources, dests); |
549 |
"from %d sources and %d destinations\n", |
|
|
550 |
killed, killed_states, sources, dests); |
546 |
return (0); |
551 |
return (0); |
547 |
} |
552 |
} |
548 |
|
553 |
|
Lines 2002-2012
main(int argc, char *argv[])
Link Here
|
2002 |
usage(); |
2007 |
usage(); |
2003 |
|
2008 |
|
2004 |
while ((ch = getopt(argc, argv, |
2009 |
while ((ch = getopt(argc, argv, |
2005 |
"a:AdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { |
2010 |
"a:AcdD:eqf:F:ghi:k:K:mnNOo:Pp:rRs:t:T:vx:z")) != -1) { |
2006 |
switch (ch) { |
2011 |
switch (ch) { |
2007 |
case 'a': |
2012 |
case 'a': |
2008 |
anchoropt = optarg; |
2013 |
anchoropt = optarg; |
2009 |
break; |
2014 |
break; |
|
|
2015 |
case 'c': |
2016 |
opts |= PF_OPT_KILLLINKEDSTATES; |
2017 |
break; |
2010 |
case 'd': |
2018 |
case 'd': |
2011 |
opts |= PF_OPT_DISABLE; |
2019 |
opts |= PF_OPT_DISABLE; |
2012 |
mode = O_RDWR; |
2020 |
mode = O_RDWR; |