diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-01-21 23:56:48 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-01-21 23:56:48 +0000 |
commit | b4ccc4c8dec3b4421f5f644424103eb0274d446a (patch) | |
tree | de1ca2e78620fd45f790d3980a85801887b7f743 /test/rctest.c | |
parent | 137a41351e834e4ca98edbfdb40c4726dc3d2f04 (diff) |
Check socket address to get the dynamic PSM and channel values
Diffstat (limited to 'test/rctest.c')
-rw-r--r-- | test/rctest.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/rctest.c b/test/rctest.c index ff3b50e8..80117d23 100644 --- a/test/rctest.c +++ b/test/rctest.c @@ -206,7 +206,19 @@ static void do_listen(void (*handler)(int sk)) goto error; } - syslog(LOG_INFO,"Waiting for connection on channel %d ...", channel); + /* Check for socket address */ + memset(&addr, 0, sizeof(addr)); + optlen = sizeof(addr); + + if (getsockname(sk, (struct sockaddr *) &addr, &optlen) < 0) { + syslog(LOG_ERR, "Can't get socket name: %s (%d)", + strerror(errno), errno); + goto error; + } + + channel = addr.rc_channel; + + syslog(LOG_INFO, "Waiting for connection on channel %d ...", channel); while(1) { memset(&addr, 0, sizeof(addr)); |