Age | Commit message (Collapse) | Author |
|
|
|
Verify if the given IPv4/IPv6 address is assigned to specific interface. It can
check both a single IP address (e.g. 192.0.2.1 or a assigned CIDR address
192.0.2.1/24.
Used testbench:
===============
20: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
inet 192.0.2.1/24 brd 192.0.2.255 scope global br0
inet 192.0.3.1/24 brd 192.0.3.255 scope global br0
inet6 2001:db8:2::ffff/64 scope global tentative
inet6 2001:db8:1::ffff/64 scope global tentative
is_intf_addr_assigned('br0', '192.0.2.1/24') -> True
is_intf_addr_assigned('br0', '192.0.2.1') -> True
is_intf_addr_assigned('br0', '2001:db8:2::ffff/64') -> True
is_intf_addr_assigned('br0', '2001:db8:2::ffff') -> True
is_intf_addr_assigned('br0', '192.0.100.1/24') -> False
is_intf_addr_assigned('br0', '192.0.100.1') -> False
is_intf_addr_assigned('br0', '2001:db8:100::ffff/64') -> False
is_intf_addr_assigned('br0', '2001:db8:100::ffff') -> False
|
|
interface
|
|
Previosly the check failed when a network statement was passed which contained
host bits set e.g. 192.0.2.1/24. This no longer is an issue b/c this is
a valid v4 address. Address is now split on / and validated.
|
|
The problem is that some IPv6 addresses reported by the system (mainly
link-local addresses) contain an interface suffix like %eth0, this was
not properly handeled in the validator script.
Remove any given interface attribute on passed IPv6 addresses. If no
interface suffix is added - there is no problem.
|
|
|
|
Verify given IPv4/IPv6 subnet is connected to any interface on this
system. Required by e.g. DHCP server that we have for IPv4 and IPv6.
|
|
* is_addr_assigned(addr) - Test if address is assigned to ANY interface
on the system
* is_ipv4(addr) - Test if it is an IPv4 address, both network and host
* is_ipv6(addr) - Test if it is an IPv6 address, both network and host
|