X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fmessagehandler.c;fp=src%2Fmessagehandler.c;h=696cad3c6d750f90f642ee2c5aa734b07b9f0be1;hb=b331021d492fd5febb576a61717a489c5cc875ff;hp=f1a753f9e81495764d20f120f9e371ea51959b34;hpb=7a4674db9a32bccbcf8d1655ede3ac293a9171f5;p=umurmur.git diff --git a/src/messagehandler.c b/src/messagehandler.c index f1a753f..696cad3 100644 --- a/src/messagehandler.c +++ b/src/messagehandler.c @@ -878,8 +878,11 @@ void Mh_handle_message(client_t *client, message_t *msg) Log_fatal("Out of memory"); memset(sendmsg->payload.userStats->address.data, 0, 16); /* ipv4 representation as ipv6 address. Supposedly correct. */ - memcpy(&sendmsg->payload.userStats->address.data[12], &target->remote_tcp.sin_addr, 4); memset(&sendmsg->payload.userStats->address.data[10], 0xff, 2); /* IPv4 */ + if(target->remote_tcp.ss_family == AF_INET) + memcpy(&sendmsg->payload.userStats->address.data[12], &((struct sockaddr_in*)&target->remote_tcp)->sin_addr, 4); + else + memcpy(&sendmsg->payload.userStats->address.data[0], &((struct sockaddr_in6*)&target->remote_tcp)->sin6_addr, 16); sendmsg->payload.userStats->address.len = 16; } /* BW */