Harald Welte has submitted this change and it was merged.

Change subject: CTRL: Ensure peer/connection info is always printed the same way
......................................................................


CTRL: Ensure peer/connection info is always printed the same way

Now that we use osmo_sock_get_name() to print connection information
at disconnect, let's use the same also at accept() time.

Furthermore, let's call it CTRL connection everywhere for consistency.

Change-Id: I33ee7d0ed853c5b2a4ae4e8ef945f8f27753cdea
---
M src/ctrl/control_if.c
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index a4382fa..07de0d4 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -429,7 +429,7 @@
        if (rc == 0)
                control_close_conn(ccon);
        else if (rc != msg->len)
-               LOGP(DLCTRL, LOGL_ERROR, "Failed to write message to the 
control connection.\n");
+               LOGP(DLCTRL, LOGL_ERROR, "Failed to write message to the CTRL 
connection.\n");
 
        return rc;
 }
@@ -464,20 +464,17 @@
        int ret, fd, on;
        struct ctrl_handle *ctrl;
        struct ctrl_connection *ccon;
-       struct sockaddr_in sa;
-       socklen_t sa_len = sizeof(sa);
+       char *name;
 
 
        if (!(what & BSC_FD_READ))
                return 0;
 
-       fd = accept(listen_bfd->fd, (struct sockaddr *) &sa, &sa_len);
+       fd = accept(listen_bfd->fd, NULL, NULL);
        if (fd < 0) {
                perror("accept");
                return fd;
        }
-       LOGP(DLCTRL, LOGL_INFO, "accept()ed new control connection from %s\n",
-               inet_ntoa(sa.sin_addr));
 
 #ifdef TCP_NODELAY
        on = 1;
@@ -496,6 +493,9 @@
                return -1;
        }
 
+       name = osmo_sock_get_name(ccon, fd);
+       LOGP(DLCTRL, LOGL_INFO, "accept()ed new CTRL connection from %s\n", 
name);
+
        ccon->write_queue.bfd.fd = fd;
        ccon->write_queue.bfd.when = BSC_FD_READ;
 

-- 
To view, visit https://gerrit.osmocom.org/5552
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I33ee7d0ed853c5b2a4ae4e8ef945f8f27753cdea
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to