From c4c7307fd4a94f2e51741c4645676c047641a708 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Fri, 8 May 2020 02:23:29 +0200 Subject: [PATCH] debug --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 7ab5b36..f9d9138 100644 --- a/main.c +++ b/main.c @@ -45,13 +45,13 @@ void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * t ipv4 = utmp->ut_addr_v6[0] & 0x000000ff; sprintf( str, "%x.", ipv4); strcat(host_ip, str); - ipv4 = utmp->ut_addr_v6[0] & 0x0000ff00; + ipv4 = (utmp->ut_addr_v6[0] & 0x0000ff00) >> 2; sprintf( str, "%x.", ipv4); strcat(host_ip, str); - ipv4 = utmp->ut_addr_v6[0] & 0x00ff0000; + ipv4 = (utmp->ut_addr_v6[0] & 0x00ff0000) >> 4; sprintf( str, "%x.", ipv4); strcat(host_ip, str); - ipv4 = utmp->ut_addr_v6[0] & 0xff000000; + ipv4 = (utmp->ut_addr_v6[0] & 0xff000000) >> 6; sprintf( str, "%x", ipv4); strcat(host_ip, str); @@ -60,7 +60,7 @@ void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * t for (x=0;x<4;x++) { - ipv6_1 = utmp->ut_addr_v6[x] & 0xffff0000; + ipv6_1 = (utmp->ut_addr_v6[x] & 0xffff0000) >> 4; sprintf( str, "%x:", ipv6_1); strcat(host_ipv6, str); ipv6_2 = utmp->ut_addr_v6[x] & 0x0000ffff;