diff --git a/CHANGELOG b/CHANGELOG index 2de5f290b..b8fb99ae4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 28c624c2f..e19f6c1be 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -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);