This commit is contained in:
Sergey Dorofeev 2011-12-16 20:58:22 +04:00
parent b7d8c716ac
commit 463e7a6eaa
2 changed files with 12 additions and 0 deletions

View File

@ -81,8 +81,14 @@ int answ_system(e_session type, char *connstr, int inetd)
logerr("can't get client address"); logerr("can't get client address");
else else
{ {
#ifdef IPV6
>char addr_str[INET6_ADDRSTRLEN+1];
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
state.peerport = (long)ntohs(client.sin6_port);
#else
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr)); state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
state.peerport = (long)ntohs(client.sin_port); state.peerport = (long)ntohs(client.sin_port);
#endif
} }
} }

View File

@ -254,8 +254,14 @@ int call_system_quiet(const char *connstr, bool inet)
logerr("can't get client address"); logerr("can't get client address");
else else
{ {
#ifdef IPV6
char addr_str[INET6_ADDRSTRLEN+1];
state.peername = (char*)xstrcpy(inet_ntop(AF_INET6, client.sin6_addr, addr_str, INET6_ADDRSTRLEN));
state.peerport = (long)ntohs(client.sin6_port);
#else
state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr)); state.peername = (char*)xstrcpy(inet_ntoa(client.sin_addr));
state.peerport = (long)ntohs(client.sin_port); state.peerport = (long)ntohs(client.sin_port);
#endif
} }
} }