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 [1]
Link: https://datatracker.ietf.org/doc/html/rfc8684#section-3.1-20.6 [2]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
ip/ipmptcp.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index aaacc0a5..01f6906f 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -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);
--
2.51.0