
Nmap Development mailing list archives
[PATCH]in big-endian platform, nmap failed to resolve the service name
From: hejianet <hejianet () linux vnet ibm com>
Date: Tue, 25 Sep 2012 12:01:58 +0800
in bigendian platform, nmap failed to get the mapping relationship because all protocols are stored in protocol_table[0]. [root@host nmap-6.01]# ./nmap -sO localhost Starting Nmap 6.01 ( http://nmap.org ) at 2012-09-24 20:41 CDT Nmap scan report for localhost (127.0.0.1) Host is up (0.000016s latency). Other addresses for localhost (not scanned): 127.0.0.1 Not shown: 249 closed protocols PROTOCOL STATE SERVICE 1 open unknown 2 open|filtered unknown 6 open unknown 17 open unknown 103 open|filtered unknown 136 open|filtered unknown 255 open|filtered unknown Nmap done: 1 IP address (1 host up) scanned in 1.60 seconds [root@host nmap-6.01]# uname -m ppc64 Signed-off-by: Jia<hejianet () linux vnet ibm com> Tested-by: Jia<hejianet () linux vnet ibm com> --- nmap-6.01/protocols.cc.ori 2012-09-24 20:42:45.019985471 -0500 +++ nmap-6.01/protocols.cc 2012-09-24 20:44:01.130938317 -0500 @@ -145,7 +145,7 @@ static int nmap_protocols_init() { protno = htons(protno); /* Now we make sure our protocols don't have duplicates */ - for(current = protocol_table[0], previous = NULL; + for(current = protocol_table[protno%PROTOCOL_TABLE_SIZE], previous = NULL; current; current = current->next) { if (protno == current->protoent->p_proto) { if (o.debugging) { @@ -164,7 +164,7 @@ static int nmap_protocols_init() { current->protoent = (struct protoent *) cp_alloc(sizeof(struct protoent)); current->next = NULL; if (previous == NULL) { - protocol_table[protno] = current; + protocol_table[protno%PROTOCOL_TABLE_SIZE] = current; } else { previous->next = current; } test results: PROTOCOL STATE SERVICE 1 open icmp 2 open|filtered igmp 6 open tcp 17 open udp 103 open|filtered pim 136 open|filtered udplite 255 open|filtered unknown B.R. Jia _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [PATCH]in big-endian platform, nmap failed to resolve the service name hejianet (Sep 24)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name David Fifield (Sep 24)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name John Spencer (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name Matt Selsky (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name David Fifield (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name John Spencer (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve the service name David Fifield (Sep 24)