2004-11-25 Leon Woestenberg <leon.woestenberg@gmx.net>

* ipv4/ip_addr.h: Renamed ip_addr_maskcmp() to _netcmp() as we are
    comparing network addresses (identifiers), not the network masks
    themselves.
  * ipv4/ip_addr.c: ip_addr_isbroadcast() now checks that the given
    IP address actually belongs to the network of the given interface.
This commit is contained in:
likewise
2004-11-25 13:33:07 +00:00
parent 3488a5c3c4
commit fd49ee3c8d
6 changed files with 10 additions and 8 deletions

View File

@@ -125,7 +125,7 @@ extern const struct ip_addr ip_addr_broadcast;
* @arg mask network identifier mask
* @return !0 if the network identifiers of both address match
*/
#define ip_addr_maskcmp(addr1, addr2, mask) (((addr1)->addr & \
#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
(mask)->addr) == \
((addr2)->addr & \
(mask)->addr))

View File

@@ -45,7 +45,7 @@ struct ip_addr {
(ipaddr)->addr[2] = htonl(((e & 0xffff) << 16) | (f & 0xffff)); \
(ipaddr)->addr[3] = htonl(((g & 0xffff) << 16) | (h & 0xffff)); } while(0)
int ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2,
int ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2,
struct ip_addr *mask);
int ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2);
void ip_addr_set(struct ip_addr *dest, struct ip_addr *src);