nft-update-addresses: add all_ipvX{addr,net} sets

main
Felix Stupp 1 month ago
parent 84fc26d1dc
commit 7f6e608fa0
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -374,6 +374,12 @@ class InterfaceUpdateHandler(UpdateStackHandler[IpAddressUpdate]):
ip_list.append(data.ip) # type: ignore[arg-type] ip_list.append(data.ip) # type: ignore[arg-type]
set_prefix = f"{self.config.ifname}v{data.ip.version}" set_prefix = f"{self.config.ifname}v{data.ip.version}"
op = NftValueOperation.if_deleted(data.deleted) op = NftValueOperation.if_deleted(data.deleted)
yield NftUpdate(
obj_type="set",
obj_name=f"all_ipv{data.ip.version}net",
operation=op,
values=(f"{self.config.ifname} . {data.ip.network.compressed}",),
)
yield NftUpdate( yield NftUpdate(
obj_type="set", obj_type="set",
obj_name=f"{set_prefix}net", obj_name=f"{set_prefix}net",
@ -386,6 +392,12 @@ class InterfaceUpdateHandler(UpdateStackHandler[IpAddressUpdate]):
f"{self.config.ifname}: only updated {set_prefix}net for changes in fc00::/7" f"{self.config.ifname}: only updated {set_prefix}net for changes in fc00::/7"
) )
return return
yield NftUpdate(
obj_type="set",
obj_name=f"all_ipv{data.ip.version}addr",
operation=op,
values=(f"{self.config.ifname} . {data.ip.ip.compressed}",),
)
yield NftUpdate( yield NftUpdate(
obj_type="set", obj_type="set",
obj_name=f"{set_prefix}addr", obj_name=f"{set_prefix}addr",
@ -688,6 +700,13 @@ def _gen_if_updater(
def static_part_generation(config: AppConfig) -> None: def static_part_generation(config: AppConfig) -> None:
for ipV in [4, 6]:
print(gen_set_def("set", f"all_ipv{ipV}addr", f"ifname . ipv{ipV}_addr"))
print(
gen_set_def(
"set", f"all_ipv{ipV}net", f"ifname . ipv{ipV}_addr", "interval"
)
)
dummy = IgnoreHandler() dummy = IgnoreHandler()
if_updater = _gen_if_updater(config.interfaces, dummy) if_updater = _gen_if_updater(config.interfaces, dummy)
for if_up in if_updater: for if_up in if_updater:

Loading…
Cancel
Save