
Nmap Developmentmailing 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 localhostStarting Nmap 6.01 (http://nmap.org ) at 2012-09-24 20:41 CDTNmap scan report for localhost (127.0.0.1)Host is up (0.000016s latency).Other addresses for localhost (not scanned): 127.0.0.1Not shown: 249 closed protocolsPROTOCOL STATE SERVICE1 open unknown2 open|filtered unknown6 open unknown17 open unknown103 open|filtered unknown136 open|filtered unknown255 open|filtered unknownNmap done: 1 IP address (1 host up) scanned in 1.60 seconds[root@host nmap-6.01]# uname -mppc64Signed-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 SERVICE1 open icmp2 open|filtered igmp6 open tcp17 open udp103 open|filtered pim136 open|filtered udplite255 open|filtered unknownB.R.Jia_______________________________________________Sent through the nmap-dev mailing listhttp://cgi.insecure.org/mailman/listinfo/nmap-devArchived athttp://seclists.org/nmap-dev/
Current thread:
- [PATCH]in big-endian platform, nmap failed to resolve the service namehejianet (Sep 24)
- Re: [PATCH]in big-endian platform, nmap failed to resolve theservice nameDavid Fifield (Sep 24)
- Re: [PATCH]in big-endian platform, nmap failed to resolve theservicenameJohn Spencer (Sep 25)
- Re: [PATCH]in big-endian platform,nmap failed to resolve the service nameMatt Selsky (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve theservice nameDavid Fifield (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve theservicenameJohn Spencer (Sep 25)
- Re: [PATCH]in big-endian platform, nmap failed to resolve theservice nameDavid Fifield (Sep 24)