mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00

YAML specs don't normally include the C prefix name in the name of the YAML attr. Remove the ifa- prefix from all attributes in addr-attrs and specify name-prefix instead. This is a bit risky, hopefully there aren't many users out there. Fixes: dfb0f7d9d979 ("doc/netlink: Add spec for rt addr messages") Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250403013706.2828322-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31 lines
866 B
Python
Executable File
31 lines
866 B
Python
Executable File
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
from lib.py import ksft_exit, ksft_run, ksft_ge, RtnlAddrFamily
|
|
import socket
|
|
|
|
IPV4_ALL_HOSTS_MULTICAST = b'\xe0\x00\x00\x01'
|
|
|
|
def dump_mcaddr_check(rtnl: RtnlAddrFamily) -> None:
|
|
"""
|
|
Verify that at least one interface has the IPv4 all-hosts multicast address.
|
|
At least the loopback interface should have this address.
|
|
"""
|
|
|
|
addresses = rtnl.getmulticast({"ifa-family": socket.AF_INET}, dump=True)
|
|
|
|
all_host_multicasts = [
|
|
addr for addr in addresses if addr['multicast'] == IPV4_ALL_HOSTS_MULTICAST
|
|
]
|
|
|
|
ksft_ge(len(all_host_multicasts), 1,
|
|
"No interface found with the IPv4 all-hosts multicast address")
|
|
|
|
def main() -> None:
|
|
rtnl = RtnlAddrFamily()
|
|
ksft_run([dump_mcaddr_check], args=(rtnl, ))
|
|
ksft_exit()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|