diff --git a/source/bforce/sess_answ.c b/source/bforce/sess_answ.c index 5ac45d9..c8095e1 100644 --- a/source/bforce/sess_answ.c +++ b/source/bforce/sess_answ.c @@ -81,8 +81,14 @@ int answ_system(e_session type, char *connstr, int inetd) logerr("can't get client address"); 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.peerport = (long)ntohs(client.sin_port); +#endif } } diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index 62538ed..930d9c4 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -254,8 +254,14 @@ int call_system_quiet(const char *connstr, bool inet) logerr("can't get client address"); 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.peerport = (long)ntohs(client.sin_port); +#endif } }