diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-01-25 16:20:08 -0800 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-02-03 12:24:13 -0800 |
commit | 130f6e5faa6190ca00000ebcb627e2d4ca3d4b37 (patch) | |
tree | 406a4c73f1ec64241f0dab157f3d5f3285eccbd1 /lib/packets.h | |
parent | d5ca4fce0d017040a6f941beac7bb2a8bcaa685d (diff) |
packets: Add eth_addr_compare_3way function.
This commit adds eth_addr_compare_3way() which behaves like memcmp
for Ethernet addresses.
Diffstat (limited to 'lib/packets.h')
-rw-r--r-- | lib/packets.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/packets.h b/lib/packets.h index 3ff3babf..38f98fb0 100644 --- a/lib/packets.h +++ b/lib/packets.h @@ -60,10 +60,15 @@ static inline bool eth_addr_is_zero(const uint8_t ea[6]) { return !(ea[0] | ea[1] | ea[2] | ea[3] | ea[4] | ea[5]); } +static inline int eth_addr_compare_3way(const uint8_t a[ETH_ADDR_LEN], + const uint8_t b[ETH_ADDR_LEN]) +{ + return memcmp(a, b, ETH_ADDR_LEN); +} static inline bool eth_addr_equals(const uint8_t a[ETH_ADDR_LEN], const uint8_t b[ETH_ADDR_LEN]) { - return !memcmp(a, b, ETH_ADDR_LEN); + return !eth_addr_compare_3way(a, b); } static inline uint64_t eth_addr_to_uint64(const uint8_t ea[ETH_ADDR_LEN]) { |