summaryrefslogtreecommitdiffstats
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-01-03 12:17:52 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-01-03 12:17:52 +0100
commitcf31112f0d7618464097f71228f84bd534f1bc0f (patch)
tree68f7fa93bd2154a16169b4db3dc9c16e51c2e84f /sysdep/unix/io.c
parent610bb3cff05f6d5b09c77724bc97295b809d15e2 (diff)
downloadbird-cf31112f0d7618464097f71228f84bd534f1bc0f.tar
bird-cf31112f0d7618464097f71228f84bd534f1bc0f.zip
Implements MRTdump feature.
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index cd5c5db..74612ac 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -947,7 +947,14 @@ sk_passive_connected(sock *s, struct sockaddr *sa, int al, int type)
t->rbsize = s->rbsize;
t->tbsize = s->tbsize;
if (type == SK_TCP)
- get_sockaddr((sockaddr *) sa, &t->daddr, &t->dport, 1);
+ {
+ sockaddr lsa;
+ int lsa_len = sizeof(lsa);
+ if (getsockname(fd, (struct sockaddr *) &lsa, &lsa_len) == 0)
+ get_sockaddr(&lsa, &t->saddr, &t->sport, 1);
+
+ get_sockaddr((sockaddr *) sa, &t->daddr, &t->dport, 1);
+ }
sk_insert(t);
if (err = sk_setup(t))
{