Skip to content

Commit

Permalink
Show public ip and port for each path
Browse files Browse the repository at this point in the history
Signed-off-by: Adrien Gallouët <[email protected]>
  • Loading branch information
angt committed Mar 10, 2018
1 parent 6538d30 commit 7c50a9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mud
Submodule mud updated 2 files
+42 −0 mud.c
+1 −1 mud.h
17 changes: 11 additions & 6 deletions src/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ gt_path_status(int fd)
return 0;

char bindstr[INET6_ADDRSTRLEN] = {0};
char publstr[INET6_ADDRSTRLEN] = {0};
char peerstr[INET6_ADDRSTRLEN] = {0};

if (gt_toaddr(bindstr, sizeof(bindstr),
(struct sockaddr *)&res.path_status.local_addr) ||
gt_toaddr(publstr, sizeof(publstr),
(struct sockaddr *)&res.path_status.r_addr) ||
gt_toaddr(peerstr, sizeof(peerstr),
(struct sockaddr *)&res.path_status.addr))
return -2;
Expand All @@ -46,12 +49,14 @@ gt_path_status(int fd)
}

printf("path %s\n"
" bind: %s\n"
" peer: %s port %"PRIu16"\n"
" mtu: %zu bytes\n"
" rtt: %.3f ms\n",
statestr, bindstr, peerstr,
gt_get_port((struct sockaddr *)&res.path_status.addr),
" bind: %s\n"
" public: %s port %"PRIu16"\n"
" peer: %s port %"PRIu16"\n"
" mtu: %zu bytes\n"
" rtt: %.3f ms\n",
statestr, bindstr,
publstr, gt_get_port((struct sockaddr *)&res.path_status.r_addr),
peerstr, gt_get_port((struct sockaddr *)&res.path_status.addr),
res.path_status.mtu.ok + 28U, /* ip+udp hdr */
res.path_status.rtt/(double)1e3);

Expand Down

0 comments on commit 7c50a9d

Please sign in to comment.