On 4/18/19 6:19 AM, Kristian Evensen wrote:
> @@ -77,6 +84,38 @@ static int fou_parse_opt(int argc, char **argv, struct 
> nlmsghdr *n,
>                       gue_set = true;
>               } else if (!matches(*argv, "-6")) {
>                       family = AF_INET6;
> +             } else if (!matches(*argv, "local")) {
> +                     NEXT_ARG();
> +
> +                     local = *argv;
> +             } else if (!matches(*argv, "peer")) {
> +                     NEXT_ARG();
> +
> +                     peer = *argv;
> +             } else if (!matches(*argv, "peer_port")) {
> +                     NEXT_ARG();
> +
> +                     if (get_be16(&peer_port, *argv, 0) || peer_port == 0)
> +                             invarg("invalid peer port", *argv);
> +             } else if (!matches(*argv, "dev")) {
> +                     const char *ifname;
> +
> +                     NEXT_ARG();
> +
> +                     ifname = *argv;
> +
> +                     if (check_ifname(ifname)) {
> +                             fprintf(stderr, "fou: invalid device name\n");
> +                             exit(EXIT_FAILURE);
> +                     }
> +
> +                     ll_init_map(&rth);

Missed this in v1: you definitely do not want to call ll_init_map here.
It does a full kink dump which can be expensive on large scale setups.
ll_name_to_index alone should be fine.

> +                     index = ll_name_to_index(ifname);
> +
> +                     if (!index) {
> +                             fprintf(stderr, "fou: unknown device name\n");
> +                             exit(EXIT_FAILURE);
> +                     }
>               } else {
>                       fprintf(stderr
>                               , "fou: unknown command \"%s\"?\n", *argv);

Reply via email to