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.
This commit is contained in:
parent
3956ec0a89
commit
59c8c454eb
1 changed files with 1 additions and 1 deletions
|
@ -124,7 +124,7 @@ EthAddr::string() const
|
||||||
bool
|
bool
|
||||||
operator==(const EthAddr &left, const EthAddr &right)
|
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 &
|
ostream &
|
||||||
|
|
Loading…
Reference in a new issue