From 9e2e2e04d1dcb999fe60a0135e99f5e8bf24a59d Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 8 Apr 2010 10:35:20 +0200 Subject: nat: Print the IP address of the connected BSCs --- openbsc/src/nat/bsc_nat_vty.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c index 4c60a19f7..7e404672c 100644 --- a/openbsc/src/nat/bsc_nat_vty.c +++ b/openbsc/src/nat/bsc_nat_vty.c @@ -92,11 +92,16 @@ DEFUN(show_bsc, show_bsc_cmd, "show connections bsc", SHOW_STR "Display information about current BSCs") { struct bsc_connection *con; + struct sockaddr_in sock; + socklen_t len = sizeof(sock); + llist_for_each_entry(con, &_nat->bsc_connections, list_entry) { - vty_out(vty, "BSC lac: %d, %d auth: %d fd: %d%s", + getpeername(con->write_queue.bfd.fd, (struct sockaddr *) &sock, &len); + vty_out(vty, "BSC lac: %d, %d auth: %d fd: %d peername: %s%s", con->cfg ? con->cfg->nr : -1, con->cfg ? con->cfg->lac : -1, - con->authenticated, con->write_queue.bfd.fd, VTY_NEWLINE); + con->authenticated, con->write_queue.bfd.fd, + inet_ntoa(sock.sin_addr), VTY_NEWLINE); } return CMD_SUCCESS; -- cgit v1.2.3