diff mbox series

[mptcp-iproute2] mptcp: show all endpoints when no ID is specified

Message ID 20200713114609.251267-1-matthieu.baerts@tessares.net
State Deferred, archived
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-iproute2] mptcp: show all endpoints when no ID is specified | expand

Commit Message

Matthieu Baerts July 13, 2020, 11:46 a.m. UTC
According to 'ip mptcp help', 'endpoint show' can accept no argument:

  ip mptcp endpoint show [ id ID ]

It makes sense to print all endpoints when no filter is used.

So here if the following command is used, all endpoints are printed:

  ip mptcp endpoint show

Same as:

  ip mptcp endpoint

Fixes: 7e0767cd ("add support for mptcp netlink interface")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 ip/ipmptcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mat Martineau July 23, 2020, 3:13 p.m. UTC | #1
On Mon, 13 Jul 2020, Matthieu Baerts wrote:

> According to 'ip mptcp help', 'endpoint show' can accept no argument:
>
>  ip mptcp endpoint show [ id ID ]
>
> It makes sense to print all endpoints when no filter is used.
>
> So here if the following command is used, all endpoints are printed:
>
>  ip mptcp endpoint show
>
> Same as:
>
>  ip mptcp endpoint
>
> Fixes: 7e0767cd ("add support for mptcp netlink interface")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
> ip/ipmptcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
> index bc12418b..e1ffafb3 100644
> --- a/ip/ipmptcp.c
> +++ b/ip/ipmptcp.c
> @@ -273,7 +273,7 @@ static int mptcp_addr_show(int argc, char **argv)
> 	struct nlmsghdr *answer;
> 	int ret;
>
> -	if (!argv)
> +	if (argc <= 0)
> 		return mptcp_addr_dump();
>
> 	ret = mptcp_parse_opt(argc, argv, &req.n, false);
> -- 
> 2.27.0

Looks good to send upstream, thanks Matthieu!

--
Mat Martineau
Intel
diff mbox series

Patch

diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index bc12418b..e1ffafb3 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -273,7 +273,7 @@  static int mptcp_addr_show(int argc, char **argv)
 	struct nlmsghdr *answer;
 	int ret;
 
-	if (!argv)
+	if (argc <= 0)
 		return mptcp_addr_dump();
 
 	ret = mptcp_parse_opt(argc, argv, &req.n, false);