]> git.saurik.com Git - apple/network_cmds.git/blobdiff - netstat.tproj/mptcp.c
network_cmds-596.100.2.tar.gz
[apple/network_cmds.git] / netstat.tproj / mptcp.c
index 5aca9b6ebcc2b7b8196a10a91bd03110e18bf8b2..70be9284f6c8f1e7ec19605df789cf7c5a2ce1c7 100644 (file)
 #include <TargetConditionals.h>
 #endif
 
-#if TARGET_OS_EMBEDDED
 #include <stdio.h>
 #include <err.h>
 #include <stdlib.h>
 #include <strings.h>
+#include <inttypes.h>
 
 #include <sys/errno.h>
 #include <sys/types.h>
@@ -57,7 +57,7 @@ static const char *tcpstates[] = {
 
 static const char *mptcpstates[] = {
        "CLOSED", "LISTEN", "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1",
-       "CLOSING", "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", "FASTCLOSE_WAIT"
+       "CLOSING", "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", "TERMINATE"
 };
 
 int mptcp_done = 0;
@@ -73,10 +73,17 @@ printmptcp(int id, conninfo_mptcp_t *mptcp)
        mptcp_flow_t *flow;
        int af;
 
-       printf("mptcp/%-2.2d %69s\n", id,
-           mptcpstates[mptcp->mptcpci_state]);
+       printf("mptcp/%-2.2d  %-8.8x/%-8.8x %50s \n"
+           "      [tok(%#"PRIx32") snd(%#"PRIx64") rcv(%#"PRIx64") "
+           "aid(%d)]\n", id,
+           mptcp->mptcpci_mpte_flags, mptcp->mptcpci_flags,
+           mptcpstates[mptcp->mptcpci_state], mptcp->mptcpci_rtoken,
+           mptcp->mptcpci_sndnxt, mptcp->mptcpci_rcvnxt,
+           mptcp->mptcpci_mpte_addrid);
+
+       flow = (mptcp_flow_t*)((caddr_t)mptcp + mptcp->mptcpci_flow_offset);
+
        for (i = 0; i < mptcp->mptcpci_nflows; i++) {
-               flow = &mptcp->mptcpci_flows[i];
                src = &flow->flow_src;
                dst = &flow->flow_dst;
                af = src->ss_family;
@@ -103,8 +110,15 @@ printmptcp(int id, conninfo_mptcp_t *mptcp)
 #endif
 #undef SIN
 #undef SIN6
-               tcpci = &flow->flow_ci;
-               printf("%s\n", tcpstates[tcpci->tcpci_tcp_info.tcpi_state]);    
+               tcpci = (conninfo_tcp_t*)((caddr_t)flow +
+                   flow->flow_tcpci_offset);
+               printf("%s \n"
+                   "      [relseq(%-4.4d), err(%d)]\n",
+                   tcpstates[tcpci->tcpci_tcp_info.tcpi_state],
+                   flow->flow_relseq,
+                   flow->flow_soerror);
+
+               flow = (mptcp_flow_t*)((caddr_t)flow + flow->flow_len);
        }
 }
 
@@ -154,4 +168,3 @@ mptcppr(uint32_t off, char *name, int af)
        }
        free(buf);
 }
-#endif /* TARGET_OS_EMBEDDED */