[PATCH iproute-mptcp 6/6] mptcp: monitor: support 'server side' as a flag

Matthieu Baerts (NGI0) posted 6 patches 2 weeks ago
There is a newer version of this series
[PATCH iproute-mptcp 6/6] mptcp: monitor: support 'server side' as a flag
Posted by Matthieu Baerts (NGI0) 2 weeks ago
In the v6.18 kernel, the 'server side' attribute has been deprecated [1]
in favour of the 'server side' flag [2].

Support both: first checking the new flag, then the old attribute to
continue supporting older kernels.

Link: https://git.kernel.org/torvalds/c/c8bc168f5f3d [1]
Link: https://git.kernel.org/torvalds/c/3d7ae91107b8 [2]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 ip/ipmptcp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index 01f6906f..acd008f3 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -535,11 +535,14 @@ static int mptcp_monitor_msg(struct rtnl_ctrl_data *ctrl,
 		printf(" reset_reason=%u", rta_getattr_u32(tb[MPTCP_ATTR_RESET_REASON]));
 	if (tb[MPTCP_ATTR_RESET_FLAGS])
 		printf(" reset_flags=0x%x", rta_getattr_u32(tb[MPTCP_ATTR_RESET_FLAGS]));
-	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_SERVER_SIDE) ||
+	    (tb[MPTCP_ATTR_SERVER_SIDE] && rta_getattr_u8(tb[MPTCP_ATTR_SERVER_SIDE]))) {
+		flags &= ~MPTCP_PM_EV_FLAG_SERVER_SIDE;
+		printf(" server_side");
+	}
 	if (flags & MPTCP_PM_EV_FLAG_DENY_JOIN_ID0) {
 		flags &= ~MPTCP_PM_EV_FLAG_DENY_JOIN_ID0;
 		printf(" deny_join_id0");

-- 
2.51.0