From: Matthieu Baerts (NGI0) Date: Sat, 27 Jul 2024 10:10:36 +0000 (+0200) Subject: ip: mptcp: 'id 0' is only for 'del' X-Git-Tag: v6.11.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b176b9f40368735b5bd4e6d49f8ebcbe8b8bef4a;p=thirdparty%2Fiproute2.git ip: mptcp: 'id 0' is only for 'del' Adding an endpoint with 'id 0' is not allowed. In this case, the kernel will ignore this 'id 0' and set another one. Similarly, because there are no endpoints with this 'id 0', changing an attribute for such endpoint will not be possible. To avoid some confusions, it sounds better to clearly report an error that the ID cannot be 0 in these cases. Acked-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Stephen Hemminger --- diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 9847f95b..118bac4a 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -174,6 +174,8 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, int cmd) invarg("invalid for non-zero id address\n", "ADDRESS"); else if (!id && !addr_set) invarg("address is needed for deleting id 0 address\n", "ID"); + } else if (id_set && !deling && !id) { + invarg("cannot be 0\n", "ID"); } if (adding && port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL))