diff mbox series

[iproute2] bridge: fdb: add an error print for unknown command

Message ID 20231010095750.2975206-1-amcohen@nvidia.com (mailing list archive)
State Accepted
Commit f1160a0f6bb3bbd012447e955c13bc7591f4f3a8
Delegated to: Stephen Hemminger
Headers show
Series [iproute2] bridge: fdb: add an error print for unknown command | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Amit Cohen Oct. 10, 2023, 9:57 a.m. UTC
Commit 6e1ca489c5a2 ("bridge: fdb: add new flush command") added support
for "bridge fdb flush" command. This commit did not handle unsupported
keywords, they are just ignored.

Add an error print to notify the user when a keyword which is not supported
is used. The kernel will be extended to support flush with VXLAN device,
so new attributes will be supported (e.g., vni, port). When iproute-2 does
not warn for unsupported keyword, user might think that the flush command
works, although the iproute-2 version is too old and it does not send VXLAN
attributes to the kernel.

Fixes: 6e1ca489c5a2 ("bridge: fdb: add new flush command")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
---
 bridge/fdb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Nikolay Aleksandrov Oct. 10, 2023, 6:52 p.m. UTC | #1
On 10/10/23 12:57, Amit Cohen wrote:
> Commit 6e1ca489c5a2 ("bridge: fdb: add new flush command") added support
> for "bridge fdb flush" command. This commit did not handle unsupported
> keywords, they are just ignored.
> 
> Add an error print to notify the user when a keyword which is not supported
> is used. The kernel will be extended to support flush with VXLAN device,
> so new attributes will be supported (e.g., vni, port). When iproute-2 does
> not warn for unsupported keyword, user might think that the flush command
> works, although the iproute-2 version is too old and it does not send VXLAN
> attributes to the kernel.
> 
> Fixes: 6e1ca489c5a2 ("bridge: fdb: add new flush command")
> Signed-off-by: Amit Cohen <amcohen@nvidia.com>
> ---
>   bridge/fdb.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/bridge/fdb.c b/bridge/fdb.c
> index ae8f7b46..d7ef26fd 100644
> --- a/bridge/fdb.c
> +++ b/bridge/fdb.c
> @@ -761,9 +761,13 @@ static int fdb_flush(int argc, char **argv)
>   				duparg2("vlan", *argv);
>   			NEXT_ARG();
>   			vid = atoi(*argv);
> +		} else if (strcmp(*argv, "help") == 0) {
> +			NEXT_ARG();
>   		} else {
> -			if (strcmp(*argv, "help") == 0)
> -				NEXT_ARG();
> +			fprintf(stderr, "bridge fdb: unknown command \"%s\"?\n",
> +				*argv);
> +			usage();
> +			return -1;
>   		}
>   		argc--; argv++;
>   	}

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
patchwork-bot+netdevbpf@kernel.org Oct. 13, 2023, 2:40 a.m. UTC | #2
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Tue, 10 Oct 2023 12:57:50 +0300 you wrote:
> Commit 6e1ca489c5a2 ("bridge: fdb: add new flush command") added support
> for "bridge fdb flush" command. This commit did not handle unsupported
> keywords, they are just ignored.
> 
> Add an error print to notify the user when a keyword which is not supported
> is used. The kernel will be extended to support flush with VXLAN device,
> so new attributes will be supported (e.g., vni, port). When iproute-2 does
> not warn for unsupported keyword, user might think that the flush command
> works, although the iproute-2 version is too old and it does not send VXLAN
> attributes to the kernel.
> 
> [...]

Here is the summary with links:
  - [iproute2] bridge: fdb: add an error print for unknown command
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f1160a0f6bb3

You are awesome, thank you!
Amit Cohen Oct. 16, 2023, 6:36 a.m. UTC | #3
> -----Original Message-----
> From: patchwork-bot+netdevbpf@kernel.org <patchwork-
> bot+netdevbpf@kernel.org>
> Sent: Friday, 13 October 2023 5:40
> To: Amit Cohen <amcohen@nvidia.com>
> Cc: netdev@vger.kernel.org; mlxsw <mlxsw@nvidia.com>;
> dsahern@gmail.com; stephen@networkplumber.org; razor@blackwall.org;
> Roopa Prabhu <roopa@nvidia.com>
> Subject: Re: [PATCH iproute2] bridge: fdb: add an error print for unknown
> command
> 
> Hello:
> 
> This patch was applied to iproute2/iproute2.git (main)
> by Stephen Hemminger <stephen@networkplumber.org>:
> 
> On Tue, 10 Oct 2023 12:57:50 +0300 you wrote:
> > Commit 6e1ca489c5a2 ("bridge: fdb: add new flush command") added
> support
> > for "bridge fdb flush" command. This commit did not handle unsupported
> > keywords, they are just ignored.
> >
> > Add an error print to notify the user when a keyword which is not supported
> > is used. The kernel will be extended to support flush with VXLAN device,
> > so new attributes will be supported (e.g., vni, port). When iproute-2 does
> > not warn for unsupported keyword, user might think that the flush
> command
> > works, although the iproute-2 version is too old and it does not send VXLAN
> > attributes to the kernel.
> >
> > [...]
> 
> Here is the summary with links:
>   - [iproute2] bridge: fdb: add an error print for unknown command
> 
> https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f
> 1160a0f6bb3
> 
> You are awesome, thank you!
> --
> Deet-doot-dot, I am a bot.
> https://korg.docs.kernel.org/patchwork/pwbot.html
> 

Hi David,
Can you please merge it to iproute2-next?
I want to send patch-set to extend "flush" command.

Thanks,
Amit
David Ahern Oct. 16, 2023, 4:19 p.m. UTC | #4
On 10/16/23 12:36 AM, Amit Cohen wrote:
> Hi David,
> Can you please merge it to iproute2-next?
> I want to send patch-set to extend "flush" command.
> 

done - merged main into next
Amit Cohen Oct. 17, 2023, 7:01 a.m. UTC | #5
> -----Original Message-----
> From: David Ahern <dsahern@gmail.com>
> Sent: Monday, 16 October 2023 19:19
> To: Amit Cohen <amcohen@nvidia.com>
> Cc: netdev@vger.kernel.org; mlxsw <mlxsw@nvidia.com>;
> stephen@networkplumber.org; razor@blackwall.org; Roopa Prabhu
> <roopa@nvidia.com>
> Subject: Re: [PATCH iproute2] bridge: fdb: add an error print for unknown
> command
> 
> On 10/16/23 12:36 AM, Amit Cohen wrote:
> > Hi David,
> > Can you please merge it to iproute2-next?
> > I want to send patch-set to extend "flush" command.
> >
> 
> done - merged main into next

Thanks!
diff mbox series

Patch

diff --git a/bridge/fdb.c b/bridge/fdb.c
index ae8f7b46..d7ef26fd 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -761,9 +761,13 @@  static int fdb_flush(int argc, char **argv)
 				duparg2("vlan", *argv);
 			NEXT_ARG();
 			vid = atoi(*argv);
+		} else if (strcmp(*argv, "help") == 0) {
+			NEXT_ARG();
 		} else {
-			if (strcmp(*argv, "help") == 0)
-				NEXT_ARG();
+			fprintf(stderr, "bridge fdb: unknown command \"%s\"?\n",
+				*argv);
+			usage();
+			return -1;
 		}
 		argc--; argv++;
 	}