Component: python/vyos/utils/network.py
Description:
is_intf_addr_assigned(ifname, addr) calls ip_interface(addr) (line ~508) without validating addr first. If addr is a hyphenated address range (e.g. 192.0.2.1-192.0.2.2,
a form accepted elsewhere as valid by is_valid_ipv4_address_or_range()/is_valid_ipv6_address_or_range()), ip_interface() raises ValueError instead of the function
returning False. The exception is uncaught and propagates out of is_intf_addr_assigned() and its caller is_addr_assigned() (which loops over all interfaces), crashing
any code path that checks whether a range-form address is assigned to an interface.
Repro:
from ipaddress import ip_interface
ip_interface('192.0.2.1-192.0.2.2')
ValueError: '192.0.2.1-192.0.2.2' does not appear to be an IPv4 or IPv6 interface
Suggested fix: In is_intf_addr_assigned(), strip any IPv6 zone suffix from addr first, then reject (return False early for) hyphenated ranges before calling
ip_interface() — matching the existing CodeRabbit "Learnings" guidance for this function (from PR #5266).
Found via: coderabbitai review on vyos-1x PR #5374, flagged as pre-existing/out-of-scope for that PR.