Generalized hardware address comparison function.
Tests if hwaddr1 and hwaddr2 "equal" (or more precisely, "equivalent"), with several advantages over a simple
cmp:
hwaddr1_len or hwaddr2_len is -1, then the corresponding address is assumed to be ASCII rather than
binary, and will be converted to binary before being compared.hwaddr1 or hwaddr2 is null, it is treated instead as though it was a
zero-filled buffer hwaddr1_len or hwaddr2_len bytes long.hwaddr1 and hwaddr2 are InfiniBand hardware addresses (that is, if they are <literal>
INFINIBAND_ALEN</literal> bytes long in binary form) then only the last 8 bytes are compared, since those are the only bytes
that actually identify the hardware. (The other 12 bytes will change depending on the configuration of the InfiniBand fabric that the
device is connected to.)If a passed-in ASCII hardware address cannot be parsed, or would parse to an address larger than nm_utils_hwaddr_len_max, then it will silently fail to match. (This means that externally-provided address strings do not need to be sanity-checked before comparing them against known good addresses; they are guaranteed to not match if they are invalid.)
| hwaddr1 |
pointer to a binary or ASCII hardware address, or null |
| hwaddr1_len |
size of |
| hwaddr2 |
pointer to a binary or ASCII hardware address, or null |
| hwaddr2_len |
size of |
|
true if |