summaryrefslogtreecommitdiffstats
path: root/test/l2test.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-21 23:56:48 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-21 23:56:48 +0000
commitb4ccc4c8dec3b4421f5f644424103eb0274d446a (patch)
treede1ca2e78620fd45f790d3980a85801887b7f743 /test/l2test.c
parent137a41351e834e4ca98edbfdb40c4726dc3d2f04 (diff)
Check socket address to get the dynamic PSM and channel values
Diffstat (limited to 'test/l2test.c')
-rw-r--r--test/l2test.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/l2test.c b/test/l2test.c
index c7155e73..733c0524 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -370,6 +370,18 @@ static void do_listen(void (*handler)(int sk))
goto error;
}
+ /* 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;
+ }
+
+ psm = btohs(addr.l2_psm);
+
syslog(LOG_INFO, "Waiting for connection on psm %d ...", psm);
while(1) {