From: Stephen Hemminger <stephen@networkplumber.org>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: dsahern@kernel.org, liuhangbin@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH v2 iproute2 3/3] bridge: mst: Add get/set support for MST states
Date: Thu, 27 Jun 2024 09:56:43 -0700 [thread overview]
Message-ID: <20240627095643.77dc2177@hermes.local> (raw)
In-Reply-To: <20240624130035.3689606-4-tobias@waldekranz.com>
Please resolve the following issue.
> +static int mst_set(int argc, char **argv)
> +{
> + struct {
> + struct nlmsghdr n;
> + struct ifinfomsg ifi;
> + char buf[512];
> + } req = {
> + .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
> + .n.nlmsg_flags = NLM_F_REQUEST,
> + .n.nlmsg_type = RTM_SETLINK,
> + .ifi.ifi_family = PF_BRIDGE,
> + };
> + char *d = NULL, *m = NULL, *s = NULL, *endptr;
> + struct rtattr *af_spec, *mst, *entry;
> + __u16 msti;
> + __u8 state;
> +
> + while (argc > 0) {
> + if (strcmp(*argv, "dev") == 0) {
> + NEXT_ARG();
> + d = *argv;
> + } else if (strcmp(*argv, "msti") == 0) {
> + NEXT_ARG();
> + m = *argv;
> + } else if (strcmp(*argv, "state") == 0) {
> + NEXT_ARG();
> + s = *argv;
> + } else {
> + if (matches(*argv, "help") == 0)
> + usage();
> + }
> + argc--; argv++;
> + }
> +
> + if (d == NULL || m == NULL || s == NULL) {
> + fprintf(stderr, "Device, MSTI and state are required arguments.\n");
> + return -1;
> + }
> +
> + req.ifi.ifi_index = ll_name_to_index(d);
> + if (!req.ifi.ifi_index)
> + return nodev(d);
> +
> + msti = strtol(m, &endptr, 10);
> + if (!(*s != '\0' && *endptr == '\0')) {
> + fprintf(stderr,
> + "Error: invalid MSTI\n");
> + return -1;
> + }
> +
> + state = strtol(s, &endptr, 10);
> + if (!(*s != '\0' && *endptr == '\0')) {
> + state = parse_stp_state(s);
> + if (state == -1) {
> + fprintf(stderr,
> + "Error: invalid STP port state\n");
> + return -1;
>
Building with clang shows this problem.
CC mst.o
mst.c:215:13: warning: result of comparison of constant -1 with expression of type '__u8' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
if (state == -1) {
~~~~~ ^ ~~
1 warning generated.
next prev parent reply other threads:[~2024-06-27 16:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-24 13:00 [PATCH v2 iproute2 0/3] Multiple Spanning Tree (MST) Support Tobias Waldekranz
2024-06-24 13:00 ` [PATCH v2 iproute2 1/3] ip: bridge: add support for mst_enabled Tobias Waldekranz
2024-06-26 2:04 ` Hangbin Liu
2024-06-26 6:12 ` Nikolay Aleksandrov
2024-06-24 13:00 ` [PATCH v2 iproute2 2/3] bridge: vlan: Add support for setting a VLANs MSTI Tobias Waldekranz
2024-06-26 2:08 ` Hangbin Liu
2024-06-26 6:12 ` Nikolay Aleksandrov
2024-06-24 13:00 ` [PATCH v2 iproute2 3/3] bridge: mst: Add get/set support for MST states Tobias Waldekranz
2024-06-26 6:21 ` Nikolay Aleksandrov
2024-06-27 16:56 ` Stephen Hemminger [this message]
2024-06-26 6:11 ` [PATCH v2 iproute2 0/3] Multiple Spanning Tree (MST) Support Nikolay Aleksandrov
2024-06-26 6:33 ` Tobias Waldekranz
2024-06-26 6:47 ` Hangbin Liu
2024-06-26 6:50 ` Nikolay Aleksandrov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240627095643.77dc2177@hermes.local \
--to=stephen@networkplumber.org \
--cc=dsahern@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tobias@waldekranz.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.