diff options
Diffstat (limited to 'src/fnettrace/main.c')
-rw-r--r-- | src/fnettrace/main.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/fnettrace/main.c b/src/fnettrace/main.c index 3eb7a13f5..2d5072379 100644 --- a/src/fnettrace/main.c +++ b/src/fnettrace/main.c | |||
@@ -677,7 +677,9 @@ static const char *const usage_str = | |||
677 | "Options:\n" | 677 | "Options:\n" |
678 | " --help, -? - this help screen\n" | 678 | " --help, -? - this help screen\n" |
679 | " --log=filename - netlocker logfile\n" | 679 | " --log=filename - netlocker logfile\n" |
680 | " --netfilter - build the firewall rules and commit them.\n" | 680 | " --netfilter - build the firewall rules and commit them\n" |
681 | " --print-map - print IP map\n" | ||
682 | " --squash-map - compress IP map\n" | ||
681 | " --tail - \"tail -f\" functionality\n" | 683 | " --tail - \"tail -f\" functionality\n" |
682 | "Examples:\n" | 684 | "Examples:\n" |
683 | " # fnettrace - traffic trace\n" | 685 | " # fnettrace - traffic trace\n" |
@@ -710,6 +712,36 @@ int main(int argc, char **argv) { | |||
710 | usage(); | 712 | usage(); |
711 | return 0; | 713 | return 0; |
712 | } | 714 | } |
715 | else if (strcmp(argv[i], "--print-map") == 0) { | ||
716 | char *fname = "static-ip-map.txt"; | ||
717 | load_hostnames(fname); | ||
718 | radix_print(); | ||
719 | return 0; | ||
720 | } | ||
721 | else if (strncmp(argv[i], "--squash-map=", 13) == 0) { | ||
722 | if (i !=(argc - 1)) { | ||
723 | fprintf(stderr, "Error: please provide a map file\n"); | ||
724 | return 1; | ||
725 | } | ||
726 | load_hostnames(argv[i] + 13); | ||
727 | int in = radix_nodes; | ||
728 | radix_squash(); | ||
729 | radix_squash(); | ||
730 | radix_squash(); | ||
731 | radix_squash(); | ||
732 | radix_squash(); | ||
733 | |||
734 | printf("#\n"); | ||
735 | printf("# This file is part of firejail project\n"); | ||
736 | printf("# The following list of addresses was compiled from various public sources.\n"); | ||
737 | printf("# License GPLv2\n"); | ||
738 | printf("#\n"); | ||
739 | |||
740 | radix_print(); | ||
741 | printf("\n#\n#\n# input %d, output %d\n#\n#\n", in, radix_nodes); | ||
742 | fprintf(stderr, "static ip map: input %d, output %d\n", in, radix_nodes); | ||
743 | return 0; | ||
744 | } | ||
713 | else if (strcmp(argv[i], "--netfilter") == 0) | 745 | else if (strcmp(argv[i], "--netfilter") == 0) |
714 | arg_netfilter = 1; | 746 | arg_netfilter = 1; |
715 | else if (strcmp(argv[i], "--tail") == 0) | 747 | else if (strcmp(argv[i], "--tail") == 0) |