]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
mptcp: monitor: add 'deny join id0' info
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Mon, 24 Nov 2025 11:19:25 +0000 (12:19 +0100)
committerDavid Ahern <dsahern@kernel.org>
Tue, 2 Dec 2025 02:28:15 +0000 (19:28 -0700)
Until recently, the 'flags' attribute was not used. This has recently
been changed with the introduction of the 'deny_join_id0' flag [1].

This flag is set when a connection is created and the other peer set the
'C' flag in the MP_CAPABLE packets [2]. This flag can be set to tell the
other side that the peer will not accept extra subflows requests sent to
its initial IP address and port: typically set by a server behind a
legacy Layer 4 load balancer.

Now, when this flag is set, "deny_join_id0" will be printed instead of
"flags=1". Unknown remaining flags will be printed in hexadecimal at the
end, e.g. "flags=0x2".

Link: https://git.kernel.org/torvalds/c/2293c57484ae
Link: https://datatracker.ietf.org/doc/html/rfc8684#section-3.1-20.6
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipmptcp.c

index aaacc0a5b778886ed09863e7a329d342df4f4188..01f6906fb6d9bf7800e4ca5475c6fe213ebce49e 100644 (file)
@@ -477,6 +477,7 @@ static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl,
        const struct genlmsghdr *ghdr = NLMSG_DATA(n);
        struct rtattr *tb[MPTCP_ATTR_MAX + 1];
        int len = n->nlmsg_len;
+       __u16 flags = 0;
 
        len -= NLMSG_LENGTH(GENL_HDRLEN);
        if (len < 0)
@@ -526,8 +527,6 @@ static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl,
                printf(" backup=%u", rta_getattr_u8(tb[MPTCP_ATTR_BACKUP]));
        if (tb[MPTCP_ATTR_ERROR])
                printf(" error=%u", rta_getattr_u8(tb[MPTCP_ATTR_ERROR]));
-       if (tb[MPTCP_ATTR_FLAGS])
-               printf(" flags=%x", rta_getattr_u16(tb[MPTCP_ATTR_FLAGS]));
        if (tb[MPTCP_ATTR_TIMEOUT])
                printf(" timeout=%u", rta_getattr_u32(tb[MPTCP_ATTR_TIMEOUT]));
        if (tb[MPTCP_ATTR_IF_IDX])
@@ -539,6 +538,15 @@ static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl,
        if (tb[MPTCP_ATTR_SERVER_SIDE] && rta_getattr_u8(tb[MPTCP_ATTR_SERVER_SIDE]))
                printf(" server_side");
 
+       if (tb[MPTCP_ATTR_FLAGS])
+               flags = rta_getattr_u16(tb[MPTCP_ATTR_FLAGS]);
+       if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0) {
+               flags &= ~MPTCP_PM_EV_FLAG_DENY_JOIN_ID0;
+               printf(" deny_join_id0");
+       }
+       if (flags) /* remaining bits */
+               printf(" flags=0x%x", flags);
+
        puts("");
 out:
        fflush(stdout);