]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
mptcp: uniform stream closure
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Mon, 23 Feb 2026 15:28:38 +0000 (16:28 +0100)
committerDavid Ahern <dsahern@kernel.org>
Wed, 25 Feb 2026 15:49:16 +0000 (08:49 -0700)
Use print_nl() instead of print_string(), close the json object, then flush
the stream to flush the end of the JSON object ASAP.

Note that in print_mptcp_limit(), the flush should have been done before
closing the JSON object, but because there is only one object and the
closure was done just before exiting, there was no visual impact.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/ipmptcp.c

index ec9ef62a242495c586eb103ebab8c16f174488e3..18ec05a885f7768dd14c1f7ab0fb1fbd123b2154 100644 (file)
@@ -273,8 +273,8 @@ static int print_mptcp_addrinfo(struct rtattr *addrinfo)
                }
        }
 
+       print_nl();
        close_json_object();
-       print_string(PRINT_FP, NULL, "\n", NULL);
        fflush(stdout);
 
        return 0;
@@ -426,9 +426,11 @@ static int print_mptcp_limit(struct nlmsghdr *n, void *arg)
 
                print_uint(PRINT_ANY, "subflows", "subflows %d ", val);
        }
-       print_string(PRINT_FP, NULL, "%s", "\n");
-       fflush(stdout);
+
+       print_nl();
        close_json_object();
+       fflush(stdout);
+
        return 0;
 }