From 59c8c454ebdb88ca031d7f597e301bbbbdf7617b Mon Sep 17 00:00:00 2001 From: Anthony Gutierrez Date: Wed, 9 Jul 2014 09:28:15 -0400 Subject: [PATCH] base: fix operator== for comparing EthAddr objects this operator uses memcmp() to detect if two EthAddr object have the same address, however memcmp() will return 0 if all bytes are equal. operator== returns the return value of memcmp() to indicate whether or not two address are equal. this is incorrect as it will always give the opposite of the intended behavior. this patch fixes that problem. --- src/base/inet.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/inet.cc b/src/base/inet.cc index bdd1b57ad..190a7a11e 100644 --- a/src/base/inet.cc +++ b/src/base/inet.cc @@ -124,7 +124,7 @@ EthAddr::string() const bool operator==(const EthAddr &left, const EthAddr &right) { - return memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN); + return !memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN); } ostream &