| 683 | } |
| 684 | |
| 685 | static void |
| 686 | parse_opts(int argc, char **argv) |
| 687 | { |
| 688 | int opt; |
| 689 | char *endptr; |
| 690 | |
| 691 | while ((opt = getopt(argc, argv, "f:t:n:d:l:r:c6ab:e:g:w:u:sv:")) != |
| 692 | -1) { |
| 693 | switch (opt) { |
| 694 | case 'f': |
| 695 | config.routes_file = optarg; |
| 696 | break; |
| 697 | case 't': |
| 698 | config.lookup_ips_file = optarg; |
| 699 | break; |
| 700 | case 'w': |
| 701 | config.routes_file_s = optarg; |
| 702 | config.flags |= DRY_RUN_FLAG; |
| 703 | break; |
| 704 | case 'u': |
| 705 | config.lookup_ips_file_s = optarg; |
| 706 | config.flags |= DRY_RUN_FLAG; |
| 707 | break; |
| 708 | case 'n': |
| 709 | errno = 0; |
| 710 | config.nb_routes = strtoul(optarg, &endptr, 10); |
| 711 | if ((errno != 0) || (config.nb_routes == 0)) { |
| 712 | print_usage(); |
| 713 | rte_exit(-EINVAL, "Invalid option -n\n"); |
| 714 | } |
| 715 | |
| 716 | if (config.nb_routes < config.print_fract) |
| 717 | config.print_fract = config.nb_routes; |
| 718 | |
| 719 | break; |
| 720 | case 'd': |
| 721 | distrib_string = optarg; |
| 722 | break; |
| 723 | case 'l': |
| 724 | errno = 0; |
| 725 | config.nb_lookup_ips = strtoul(optarg, &endptr, 10); |
| 726 | if ((errno != 0) || (config.nb_lookup_ips == 0)) { |
| 727 | print_usage(); |
| 728 | rte_exit(-EINVAL, "Invalid option -l\n"); |
| 729 | } |
| 730 | break; |
| 731 | case 'r': |
| 732 | errno = 0; |
| 733 | config.rnd_lookup_ips_ratio = |
| 734 | strtoul(optarg, &endptr, 10); |
| 735 | if ((errno != 0) || |
| 736 | (config.rnd_lookup_ips_ratio == 0) || |
| 737 | (config.rnd_lookup_ips_ratio >= 100)) { |
| 738 | print_usage(); |
| 739 | rte_exit(-EINVAL, "Invalid option -r\n"); |
| 740 | } |
| 741 | break; |
| 742 | case 's': |