From c049506a56480d712ec3c31d251c2dde94456fc6 Mon Sep 17 00:00:00 2001 From: Dimitri Lozeve Date: Sat, 11 Jun 2016 14:01:40 +0200 Subject: [PATCH] Bitwise operation for manipulating IP addresses --- arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arp.c b/arp.c index 68b600f..d6cd8d1 100644 --- a/arp.c +++ b/arp.c @@ -254,7 +254,7 @@ int arp_scan(int sockfd, int ifindex, struct sockaddr_in *ipaddr, unsigned char current subnet */ unsigned long ip_counter = ntohl(ipaddr->sin_addr.s_addr) & ntohl(netmask->sin_addr.s_addr); /* The maximum address on the subnet */ - unsigned long ip_max = ip_counter + (~ntohl(netmask->sin_addr.s_addr)); + unsigned long ip_max = ip_counter | (~ntohl(netmask->sin_addr.s_addr)); while (ip_counter < ip_max) { char ip_string[16];