This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Neels Hofmeyr nhofmeyr at sysmocom.deIt would print the memory location of the address buffer. Instead, print the human readable host address and port. The current code base supports only IPv4, and thread safety is apparently not required, hence just use inet_ntoa(). (The IPv6 and thread capable version is 4 times longer and harder to read.) --- gtp/gtp.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/gtp/gtp.c b/gtp/gtp.c index cfce244..08a9d61 100644 --- a/gtp/gtp.c +++ b/gtp/gtp.c @@ -71,6 +71,11 @@ len, osmo_hexdump((const uint8_t *) pack, len), \ ##args); +#define LOGP_WITH_ADDR(ss, level, addr, fmt, args...) \ + LOGP(ss, level, "addr(%s:%d) " fmt, \ + inet_ntoa((addr).sin_addr), htons((addr).sin_port), \ + ##args); + /* API Functions */ const char *gtp_version() @@ -739,10 +744,9 @@ int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen, if (bind((*gsn)->fd0, (struct sockaddr *)&addr, sizeof(addr)) < 0) { (*gsn)->err_socket++; - LOGP(DLGTP, LOGL_ERROR, - "bind(fd0=%d, addr=%lx, len=%d) failed: Error = %s\n", - (*gsn)->fd0, (unsigned long)&addr, sizeof(addr), - strerror(errno)); + LOGP_WITH_ADDR(DLGTP, LOGL_ERROR, addr, + "bind(fd0=%d) failed: Error = %s\n", + (*gsn)->fd0, strerror(errno)); return -1; } @@ -765,10 +769,9 @@ int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen, if (bind((*gsn)->fd1c, (struct sockaddr *)&addr, sizeof(addr)) < 0) { (*gsn)->err_socket++; - LOGP(DLGTP, LOGL_ERROR, - "bind(fd1c=%d, addr=%lx, len=%d) failed: Error = %s\n", - (*gsn)->fd1c, (unsigned long)&addr, sizeof(addr), - strerror(errno)); + LOGP_WITH_ADDR(DLGTP, LOGL_ERROR, addr, + "bind(fd1c=%d) failed: Error = %s\n", + (*gsn)->fd1c, strerror(errno)); return -1; } @@ -791,10 +794,9 @@ int gtp_new(struct gsn_t **gsn, char *statedir, struct in_addr *listen, if (bind((*gsn)->fd1u, (struct sockaddr *)&addr, sizeof(addr)) < 0) { (*gsn)->err_socket++; - LOGP(DLGTP, LOGL_ERROR, - "bind(fd1c=%d, addr=%lx, len=%d) failed: Error = %s\n", - (*gsn)->fd1c, (unsigned long)&addr, sizeof(addr), - strerror(errno)); + LOGP_WITH_ADDR(DLGTP, LOGL_ERROR, addr, + "bind(fd1c=%d) failed: Error = %s\n", + (*gsn)->fd1c, strerror(errno)); return -1; } -- 2.1.4