Fix assert fail on FreeBSD in libdnet

This commit is contained in:
dmiller 2013-11-07 19:32:33 +00:00
parent ba239a8610
commit 795ca1b64f
2 changed files with 14 additions and 2 deletions

View file

@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o Fixed a bug in libdnet with handling interfaces with AF_LINK addresses on
FreeBSD >9 reported by idwer on IRC. Likely affected other *BSDs. Handled by
skipping these non-network addresses. [Daniel Miller]
o Fixed a bug with UDP checksum calculation. When the UDP checksum is zero
(0x0000), it must be transmitted as 1's-complement -0 (0xffff) to avoid
ambiguity with +0, which indicates no checksum was calculated. This affected

View file

@ -1327,7 +1327,11 @@ static int collect_dnet_interfaces(const struct intf_entry *entry, void *arg) {
/* The first time through the loop we add the primary interface record.
After that we add the aliases one at a time. */
if (!primary_done) {
if (addr_ntos(&entry->intf_addr, (struct sockaddr *) &tmpss) == -1) {
if ( (addr_ntos(&entry->intf_addr, (struct sockaddr *) &tmpss) == -1)
#ifdef AF_LINK
|| (tmpss.ss_family == AF_LINK)
#endif
) {
dcrn->ifaces[dcrn->numifaces].addr.ss_family = 0;
} else {
rc = canonicalize_address(&tmpss, &dcrn->ifaces[dcrn->numifaces].addr);
@ -1336,7 +1340,11 @@ static int collect_dnet_interfaces(const struct intf_entry *entry, void *arg) {
dcrn->ifaces[dcrn->numifaces].netmask_bits = entry->intf_addr.addr_bits;
primary_done = true;
} else if (num_aliases_done < entry->intf_alias_num) {
if (addr_ntos(&entry->intf_alias_addrs[num_aliases_done], (struct sockaddr *) &tmpss) == -1) {
if ( (addr_ntos(&entry->intf_alias_addrs[num_aliases_done], (struct sockaddr *) &tmpss) == -1)
#ifdef AF_LINK
|| (tmpss.ss_family == AF_LINK)
#endif
) {
dcrn->ifaces[dcrn->numifaces].addr.ss_family = 0;
} else {
rc = canonicalize_address(&tmpss, &dcrn->ifaces[dcrn->numifaces].addr);