From 71111356d9587b9725bc629a389ec2fbf5119286 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 8 May 2020 11:13:56 +0200 Subject: [PATCH] debug --- main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index f9d9138..0b95e50 100644 --- a/main.c +++ b/main.c @@ -42,16 +42,16 @@ void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * t sprintf(host_ip, "%s", utmp->ut_host); //got ip of origin if((utmp->ut_addr_v6[1] && utmp->ut_addr_v6[2] && utmp->ut_addr_v6[3]) == 0) { - ipv4 = utmp->ut_addr_v6[0] & 0x000000ff; - sprintf( str, "%x.", ipv4); - strcat(host_ip, str); - ipv4 = (utmp->ut_addr_v6[0] & 0x0000ff00) >> 2; + ipv4 = (utmp->ut_addr_v6[0] & 0xff000000) >> 6; sprintf( str, "%x.", ipv4); strcat(host_ip, str); ipv4 = (utmp->ut_addr_v6[0] & 0x00ff0000) >> 4; sprintf( str, "%x.", ipv4); strcat(host_ip, str); - ipv4 = (utmp->ut_addr_v6[0] & 0xff000000) >> 6; + ipv4 = (utmp->ut_addr_v6[0] & 0x0000ff00) >> 2; + sprintf( str, "%x.", ipv4); + strcat(host_ip, str); + ipv4 = utmp->ut_addr_v6[0] & 0x000000ff; sprintf( str, "%x", ipv4); strcat(host_ip, str);