ether_addr_equal_masked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ether_addr_equal_masked(9) πŸ’–

okay bestie, so this one's a kernel API manual page β€” it lives in the kernel doc world, and honestly? it's giving "small function, big personality." let's get into it ✨


🌸 NAME 🌸

ether_addr_equal_masked β€” compare two Ethernet addresses with a mask, bestie πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

bool ether_addr_equal_masked (const u8 *addr1 , const u8 *addr2 , const u8 *mask );

like, that's it. that's the whole vibe. returns a bool, takes three pointers, no cap 🫢

πŸ¦‹ ARGUMENTS πŸ¦‹

  • addr1 β€” pointer to a six-byte array holding the 1st Ethernet address πŸ“ (yes, exactly six bytes, don't come at me with five)
  • addr2 β€” pointer to a six-byte array holding the 2nd Ethernet address 🌸 (also six bytes, we stan consistency)
  • mask β€” pointer to a six-byte array holding the Ethernet address bitmask πŸ‘‘

⭐ DESCRIPTION ⭐

so here's the tea: this function compares two Ethernet addresses with a mask, and it returns true if β€” for every single bit that's set in the bitmask β€” the equivalent bits in the two Ethernet addresses are equal. literally bit-for-bit matching, but only where the mask says "yeah look here" πŸ”₯

and the iconic little footnote: using a mask with all bits set is just a slower ether_addr_equal. like, it works, it's valid, but bestie… you're paying extra for the same thing 😭 so if your mask is all 1s, maybe just call the other one, iykyk πŸ’€

πŸ’œ SEE ALSO πŸ’œ

all the siblings live in the kernel file ./include/linux/etherdevice.h, and here's the full family reunion:

is_link_local_ether_addr(9), is_zero_ether_addr(9), is_multicast_ether_addr(9), is_local_ether_addr(9), is_broadcast_ether_addr(9), is_unicast_ether_addr(9), is_valid_ether_addr(9), eth_proto_is_802_3(9), eth_random_addr(9), eth_broadcast_addr(9), eth_zero_addr(9), eth_hw_addr_random(9), eth_hw_addr_crc(9), ether_addr_copy(9), eth_hw_addr_set(9), eth_hw_addr_inherit(9), ether_addr_equal(9), ether_addr_equal_64bits(9), ether_addr_equal_unaligned(9), ether_addr_to_u64(9), u64_to_ether_addr(9), eth_addr_dec(9), eth_addr_inc(9), eth_addr_add(9), is_etherdev_addr(9), compare_ether_header(9), eth_hw_addr_gen(9), eth_skb_pkt_type(9), eth_skb_pad(9)

like… that's the whole group chat, and every one of them is invited πŸ§šπŸ’–


ngl the only real caution here is that all-bits-set mask thing β€” it's not wrong, it's just slower than ether_addr_equal. no cap, no drama, just vibes πŸ’…

and that's the page, bestie!! πŸŽ€ source: ./include/linux, dated October 2026 β€” periodt, go compare some addresses responsibly πŸŒˆπŸ‘‘πŸ’œ

πŸ“¦ where this page comes from