[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <94af658b-51d6-4e71-9070-3e6a244fe8b1@kernel.org>
Date: Tue, 10 Dec 2024 20:43:54 -0700
From: David Ahern <dsahern@...nel.org>
To: Robert Marko <robert.marko@...tura.hr>, netdev@...r.kernel.org,
stephen@...workplumber.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, jiri@...nulli.us, andrew@...n.ch
Cc: luka.perkov@...tura.hr
Subject: Re: [iproute2-next v2] ip: link: rmnet: add support for flag handling
On 12/7/24 3:05 PM, Robert Marko wrote:
> @@ -26,18 +32,79 @@ static void explain(void)
> print_explain(stderr);
> }
>
> +static int on_off(const char *msg, const char *arg)
> +{
> + fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", msg, arg);
> + return -1;
> +}
> +
not needed once you use ...
> static int rmnet_parse_opt(struct link_util *lu, int argc, char **argv,
> struct nlmsghdr *n)
> {
> + struct ifla_rmnet_flags flags = { 0 };
> __u16 mux_id;
>
> while (argc > 0) {
> - if (matches(*argv, "mux_id") == 0) {
> + if (strcmp(*argv, "mux_id") == 0) {
> NEXT_ARG();
> if (get_u16(&mux_id, *argv, 0))
> invarg("mux_id is invalid", *argv);
> addattr16(n, 1024, IFLA_RMNET_MUX_ID, mux_id);
> - } else if (matches(*argv, "help") == 0) {
> + } else if (strcmp(*argv, "ingress-deaggregation") == 0) {
> + NEXT_ARG();
> + flags.mask |= RMNET_FLAGS_INGRESS_DEAGGREGATION;
> + if (strcmp(*argv, "on") == 0)
> + flags.flags |= RMNET_FLAGS_INGRESS_DEAGGREGATION;
> + else if (strcmp(*argv, "off") == 0)
> + flags.flags &= ~RMNET_FLAGS_INGRESS_DEAGGREGATION;
> + else
> + return on_off("ingress-deaggregation", *argv);
... parse_on_off for all of the on/off options and then check the return
code. See other users of the function.
--
pw-bot: cr
Powered by blists - more mailing lists