summaryrefslogtreecommitdiff
path: root/src/tests
AgeCommit message (Collapse)Author
2026-11-13Merge pull request #5628 from natali-rs1985/T9568rollingJohn Estabrook
remote: T9568: Do not send HTTP credentials to another host after a redirect
2026-11-12T9615: run is_ip_network test shadowed by a duplicate nameChristian Breunig
Two tests shared one name, so the is_ip_network test was replaced by the compare_netmask test and never ran.
2026-11-10Merge pull request #5636 from jestabro/perms-write-fileJohn Estabrook
T9590: fix order of set perms/ownership and first write in utils write_file
2026-11-08Merge pull request #5526 from yzguy/wwan-static-bearer-addressingChristian Breunig
wwan: T9388: apply a static bearer's address/gateway/DNS directly instead of DHCP(v6)/SLAAC
2026-11-08utils: T9322: simplify address assignment lookup and document ValueErrorChristian Breunig
The lookup for an address on all interfaces carried a copy of the zone index and VRF filtering that already exists in the lookup returning the matching interfaces. It now delegates to it, so the two cannot drift. The per-interface address match is written as a single condition, the comments are trimmed, and the docstrings state that anything but a single address raises ValueError instead of being reported as not assigned. The sflow zone index smoketest removes the dummy interface it creates, and the unit tests drop a stale task reference and a duplicate import.
2026-11-08utils: T9322: reject addresses that are not a single address and honour zone ↵Ruben Herold
indexes The helper that tells whether an address is assigned to an interface accepted ranges and addresses with a zone index. A range ended in a traceback. A zone index was ignored, so an address on the loopback interface was reported as assigned to the interface named in the zone. The helper now rejects everything that is not a single address, a zone index included. The functions that look for an address on all interfaces use the zone to pick the one interface to check, so a zone that names an interface which does not hold the address is no longer accepted. The command that lists the addresses is passed as a list, so the interface name and the namespace do not reach a shell. Unit tests and a smoketest cover the cases.
2026-11-07wwan: T9388: apply a static bearer's address/gateway/DNS directlyAdam Smith
QMI raw-ip modems get their address, gateway and DNS from ModemManager as a "static" bearer instead of over a DHCP(v6) or Router Advertisement exchange, so "address dhcp", "address dhcpv6" and "ipv6 address autoconf" never produced a usable config and only worked for IPv4 by accident. Check the interface's connected bearer first. If its method for the family is static, apply it directly; if it is dhcp, or there is no bearer yet, fall through to the existing DHCP(v6) client / kernel SLAAC unchanged. - Address and DNS are applied from the bearer. DNS is registered with vyos-hostsd under the same dhcp-<if>/dhcpv6-<if> tags a real client uses. A DHCP(v6) client which was started while the bearer was still missing, including one which keeps restarting, is stopped before the settings are applied. - The default route is rendered into FRR as a tag 210 static route, the same way a DHCP one is. WWANIf records the gateway of the bearer in /run/vyos-wwan, which the new get_wwan_router() filter reads, and a new block in staticd.frr.j2 fed by get_wwan_interfaces() renders the IPv4 and IPv6 default routes. Distance, no-default-route and VRFs behave as for DHCP, also for an interface without "address dhcp". frrender notices a gateway change, and WWANIf reconciles FRR with vyos-frr-render.py whenever the recorded gateway changes, the way the dhclient lease hook does, so op-mode reconnect is covered as well. The state is written atomically, as the renderer reads it concurrently. - The address installed from the bearer is recorded in /run/vyos-wwan too. It is removed on reconnect, when the family is no longer configured and when the interface goes away, and nothing else on the interface is ever touched. - vyos-netlinkd applies the bearer again after it re-dials a lost session, as the new session can come back with a different address or gateway. A DHCP client used to pick that up on its own. What a previous session left behind is dropped for a family the new one does not supply, the configured DHCP(v6) client or SLAAC is started for it as a commit would, and an incomplete result is retried on the following reconcile passes for a while. - The bearer is picked by its connected status rather than bearers[0], and its config is polled briefly with wait_for() until it is no longer missing or a placeholder, since it can be populated slightly after the bearer reports connected.
2026-11-06T9590: add unittest to check perms at first write of utils write_fileJohn Estabrook
2026-11-06Merge pull request #5631 from c-po/T9559Viacheslav Hletenko
https: T9559: fix bogus port conflict with "vrf default"
2026-11-05interfaces: T6393: install mirror and redirect filters for VLAN targetsChristian Breunig
A VLAN sub-interface used as mirror or redirect target (e.g. bond0.10) was only accepted if it already existed in the Kernel. The configuration committed at runtime, but at boot the source interface is committed before the VLAN is created - verify failed and the whole source interface was rolled back, as reported for tunnel targets. A VLAN target is now also accepted if its parent interface has the vif, vif-s or vif-c configured on the CLI. VLAN sub-interfaces learn which interfaces mirror or redirect into them and install their filters once created, as other interfaces already do. Add a config load test mirroring and redirecting into tunnel and bond VLAN targets, which are committed after the ethernet sources.
2026-11-05interfaces: T6393: accept mirror and redirect targets defined on the CLIciaens
Interface types are committed in priority order (ethernet 318, bridge 319, bonding 320, ... tunnel 380). verify_mirror_redirect() required the mirror and redirect target to exist in the Kernel, so "interfaces ethernet eth1 mirror ingress tun0" (or "redirect tun0") could never commit on the first pass at boot, or when both interfaces are created in the same commit: VYOS_TAGNODE_VALUE=eth1 .../interfaces_ethernet.py Requested mirror interface "tun0" does not exist! Sending reply: ERROR_COMMIT with output VYOS_TAGNODE_VALUE=tun0 .../interfaces_tunnel.py Sending reply: SUCCESS with output The whole ethernet node was rolled back, taking its addresses and everything on top of them down with it. The tc filter itself is installed by the target's commit since the previous commit, only verify() blocks. Also accept a target which is defined on the CLI, at its interface name position of the interfaces tree that Config.get_config_dict() attaches to its dictionaries. A target that is neither configured nor existing still fails the commit with the same error message as before. VLAN sub-interface targets are only accepted from the Kernel, as nothing would install their filter later on. VLAN sub-interfaces as sources get the interfaces tree attached to their own dictionaries in get_interface_dict(). A target placed in a network namespace is out of reach for tc(8) and is rejected with its own message, also while its device still sits in the default namespace. A target whose device is created asynchronously by a daemon (OpenVPN) now also passes verify at boot; if its device is not up yet when that interface applies, the filter is installed on the next commit of either side instead of the source interface being rolled back. src/tests/test_configverify.py was removed together with its last test case (T8859) and is re-added with tests for the target verification.
2026-11-05https: T9559: fix bogus port conflict with "vrf default"Christian Breunig
Committing "set service https vrf default" failed with "TCP port 443 in vrf default is already used by another service" although nothing listened on the port. The port check bound its test socket to a VRF device named "default", which does not exist, and reported that failure as a port conflict. The default VRF is now treated like no VRF at all. A VRF device that does not exist no longer counts as a busy port, as nothing can listen in it; any other error is raised instead of being reported as a conflict. The same check is used by the Prometheus VPP exporter.
2026-11-04remote: T9568: Do not use .netrc credentials for redirect targetsNataliia Solomko
A "default" entry in .netrc matches any host, so a download that was redirected to a different host could send those credentials there. Credentials from .netrc are now only used for the original host.
2026-11-04remote: T9568: Do not send HTTP credentials to another host after a redirectNataliia Solomko
Downloads that were redirected to a different host sent the user's credentials to that host. Credentials are now dropped when the redirect leaves the original host.
2026-11-03T9562: add unitest to check argument of is_* path attribute functions.John Estabrook
2026-11-02Merge pull request #5582 from ruben-herold/T9482-static-same-distanceChristian Breunig
static: T9482: handle a blackhole next to a next-hop of the same distance
2026-11-01frrender: T9482: drop a blackhole route FRR would refuseChristian Breunig
The default route of a DHCP or PPPoE interface changes with an interface-only commit or a lease event, without a commit of the static routes. If it gets the same prefix and distance as a blackhole or reject route, FRR refuses the reload and every static route added with it is lost. The rendered FRR configuration is now checked for a blackhole or reject route next to any other route of the same prefix and distance, per VRF and table. Such a blackhole or reject route is not rendered, and an error naming it is logged to the journal. Prefixes are compared in their normalized form, as FRR stores them.
2026-11-01static: T9482: check static routes onlyChristian Breunig
Verification also refused a blackhole or reject default route next to the default route of a PPPoE interface, or of a DHCP interface once its lease had a router. Those routes change without a commit of the static routes, by an interface-only commit or a lease event. The check missed those cases, depended on the lease, and was not covered by the migration, so a PPPoE configuration with a plain blackhole default route failed to load after the upgrade. Only conflicts between static routes are refused now, the renderer handles the interface default routes. The default distance is looked up only for a route without a distance. The migration comment claimed FRR keeps the route configured first. A conflict makes frr-reload lose every static route of that reload. A unit test covers the migration, and the config test asserts which route was disabled.
2026-11-01utils: T9553: do not assume host forwarding state in sysctl read testChristian Breunig
The build-time sysctl read test expected IPv4 forwarding on loopback to be enabled. That holds on a typical Docker host, but an LXC container has its own network namespace where forwarding defaults to off, so the package build failed in the test stage. The test now compares against the value the kernel reports in /proc, so it still checks a real read without depending on the build host's setup.
2026-10-31Merge pull request #5479 from c-po/T3871-ifname-storeChristian Breunig
T3871: bind interface names to hardware slots instead of hw-id
2026-10-31interfaces: T3871: keep the address policy the distribution shipsChristian Breunig
Only the first matching link file is applied, and ours sets just the name, so the address policy shipped with the system never ran on any interface. Hardware with a permanent address was unaffected - there was nothing to apply - but a modem, which has none, was left on whatever random address its driver had picked that boot, a different one every time. Spell the policy out again. A permanent address is still kept where there is one, and a device without one is given an address derived from the machine and the device, which is the same on every boot of that machine. An address set through the CLI is applied later and is unaffected.
2026-10-31wwan: T3871: stop reporting a modem as replaced hardware every bootChristian Breunig
A modem that reports no permanent address is given a random one by its driver at every probe. That address was read as if it identified the hardware, so it never matched what was recorded and the modem was taken for a different card in the same socket on each boot, warning the operator to check a port nobody had touched. The map also kept being rewritten with the address of the boot before, so it could never settle. Keep no address for a modem, and compare one only where there is one. An address recorded by an earlier version is dropped on the next pass, so a machine already carrying one needs nothing done to it. A card whose address really did change is still reported.
2026-10-31interfaces: T3871: give a re-created Hyper-V NIC the name of the NIC it replacedAlex Kudentsov
A Hyper-V NIC is known by its MAC alone. One deleted and created again on the same VM - an Azure NIC re-created, or a Hyper-V adapter removed and added - comes back with a new MAC, so nothing on it matched the store: its name stayed reserved, the new NIC got a new name, and its configuration was left on a name with no NIC. cloud-init does not run again on the same instance, so nothing else repairs it. At boot, a vacant name now goes to a new NIC only when the pairing is not in doubt: - exactly one recorded name has no NIC, and exactly one new Hyper-V NIC appeared. With more of either, the order the NICs come up in does not say which replaced which, so nothing is handed over and the names stay reserved, as before; - the name went missing at this pass. The store records which names were missing at the last pass, so a NIC removed for good does not hand its name to a NIC added at a later boot; - the name's own NIC was a Hyper-V one. The store records which names sat on a Hyper-V NIC; a MAC-keyed name can belong to other hardware, and a store written before this was recorded hands nothing over (the boot pass logs that when it holds a name back); - only at boot. On a running system the configuration under a name is not applied to the NIC that takes it, so the hotplug unit passes --hotplug, which names the new NIC like any other and records the vacant name as missing, so the next boot does not hand it over either. An adoption is logged as a warning, reported under 'adopted' in the status file (kept there across hotplug passes while it holds), and repeated by vyos-router, as a slot match is: verify the port before relying on its configuration.
2026-10-31interfaces: T3871: keep an accelerated-networking VF off its NIC's .link fileAlex Kudentsov
On Azure every Hyper-V NIC shares one ID_PATH and has no slot, so it is keyed on its MAC. Its accelerated-networking VF carries the same MAC and matched the NIC's .link file, so udev tried to give the VF the NIC's name. The .link file of a Hyper-V NIC now also matches Driver=hv_netvsc, so the VF cannot match it. This holds for a lone NIC keyed on the VMBus path too. A NIC absent at a pass cannot say what it is, so its file keeps the pin it already carries. NICs that are not Hyper-V ones get no Driver line, and their files do not change. The 34-to-35 migration passes the hardware it found, so the pin is written on the first boot of an upgrade too.
2026-10-31smoketest: T3871: run the naming tests on a VMware guest in CI tooChristian Breunig
The interface naming testcases gained a second variant in vyos-build, running on a guest that presents VMware firmware - the one platform where the adapter order comes from the firmware rather than from the PCI topology, and the one the reported regression was found on. CI now runs both variants and reports them separately. The target the existing job calls was renamed along with it.
2026-10-31interfaces: T3871: keep the hypervisor's adapter order on ESXiChristian Breunig
ESXi does not lay its adapters out in PCI address order. With four or more it puts the fourth on a root port sorting ahead of the first three, so naming by address made Network adapter 4 eth0 and shifted the rest. On the vmware-vsphere OVA that moved the WAN, because cloud-init takes eth0 from the OVF properties. The firmware port label carries the adapter order, and is what the VMware udev rule this series removed matched on. Order by it, ahead of the address, for hardware the hypervisor presented - recognised by its PCI vendor, or by DMI for a model whose IDs are not known here. A physical server labels its ports too and must not be reordered. The label orders, it never identifies: a relabelled adapter is still the same card.
2026-10-31interfaces: T3871: never rename an interface which is in useChristian Breunig
Editing the map and then plugging any card in applied the edit to every interface at once, because the pass re-resolves the whole system whatever woke it. A running port was renamed out from under the configuration still naming it, a bridge member included since members became discoverable. Leave a name alone while the system is relying on it - the port is up, or it has a master. At boot that is true of nothing, as the pass runs before the configuration is applied, so naming is unaffected; afterwards it is true of everything configured, and a card which has just arrived is still down. Say in the log and the status file when a rename was refused, as the map and the running system then disagree until the next boot.
2026-10-31interfaces: T3871: keep the naming tests off the base systemChristian Breunig
Three of the tests which write the interface map went through the check for an encrypted configuration volume, and that check asks the running system where its persistent storage is. A build host answers "nowhere", so the tests passed - but anywhere that does have such a volume the write is refused and all three fail, for a reason none of them is about. Pin the answer. What these tests cover is what the map does with a directory, not where the directory came from.
2026-10-31interfaces: T3871: only give a name to a device of its own kindChristian Breunig
A recorded slot was enough to claim a name, whatever turned up in it. Pull a modem and put an ordinary USB NIC in the same port and the NIC was handed wwan0 - a name 'interfaces wwan' reads, so a modem's configuration would be applied to a card which can not carry it. The reverse was already handled. Require the device to belong to the namespace the name is read under. If it does not, the name stays reserved for the hardware that earned it and the newcomer is named as what it is.
2026-10-31interfaces: T3871: report a name which changed hands between known cardsChristian Breunig
Cards rearranged among themselves, or a map edited by hand, leave every name matched to a card the store knows - just not the one it had. That was filed as an ordinary match, indistinguishable from a machine where nothing moved, while the addresses configured under those names had quietly changed cable. Report it separately. Which name goes to which card is unchanged, the slot still decides; only the account of what happened is.
2026-10-31interfaces: T3871: keep bridge and bond members discoverableChristian Breunig
An interface was passed over as soon as it had a master, which covers a VF datapath but also every bridge, bond and VRF member. Those are still their own card in their own slot, so the naming pass reported them as hardware which had not appeared, on any run made while they were in use. Skip only when the master is a device itself. That is what tells the accelerated path, which belongs to the interface it is enslaved to, apart from a member, which does not.
2026-10-31wwan: T3871: name a modem in the namespace the CLI readsChristian Breunig
Anything that was not wireless was named ethN, so an LTE module came up as an ethernet port: bound, working and invisible, because 'interfaces wwan' looks at wwanN and nothing else. Give it its own namespace, keyed on DEVTYPE, and drop what an earlier version filed under an ethernet name - that entry still matches the modem by path and would capture it again.
2026-10-31interfaces: T3871: leave wireless names to the configurationChristian Breunig
Every interface created on a radio carries that phy's address, so they are indistinguishable here. A name recorded against one of them was applied to whichever appeared next: configuring a second interface on a phy renamed it on top of the first, and the smoketests lost the interface they had just asked for. Nothing anchors a radio, and nothing needs to - wireless names come from 'physical-device'. Stop discovering them, stop writing a .link for them, and drop what an earlier version recorded so the entry and its file go on upgrade.
2026-10-31interfaces: T3871: name a card by the card, not only by the slot it sits inChristian Breunig
The map now records which card each name sat on. A card moved to another slot keeps its name rather than leaving it behind for whatever turns up next, and the slot it vacated does not lend that name out. Where the map and the hardware disagree, the map wins: a card the store already knows, found in a name's slot, takes that name. Only a card nothing knows about, sitting in a slot on record, is treated as a replacement - the one case which can quietly move a configured address onto another cable.
2026-10-31interfaces: T3871: persist interface names on the first boot of a pre-built ↵Christian Breunig
image The check guarding that write looked for a marker which an activation script creates only after interface naming has already run. On a deployed qcow2 the marker is absent on the first boot, so nothing was recorded and the next boot named the hardware from scratch. Removing a card then moved every name below it onto the neighbouring port, taking that interface's address with it. Only an encrypted configuration has a volume which may still be locked, so ask about that instead - everywhere else the directory is already the persistent one.
2026-10-31interfaces: T3871: remove the hw-id node and migrate its bindingsChristian Breunig
The node decides nothing now that the mapping store owns naming, and keeping it would leave two sources of truth free to disagree. Existing bindings are carried into the store by matching each hw-id against the permanent address of the hardware present, so a box named by an older release keeps exactly the names it had. Entries whose hardware is absent are skipped - the configuration may well originate from another machine. The hardware address of an interface is now read off the device rather than from the configuration.
2026-10-31interfaces: T3871: name interfaces from a slot-anchored mapping storeChristian Breunig
Names used to be derived from 'hw-id' in config.boot. A node carrying an address but no hw-id had to be matched to some NIC, and nothing available at boot could say which one - every heuristic could bind a configured address to the wrong physical wire. Naming authority moves to a mapping store binding a name to the slot the hardware occupies. The slot is the identity, so a replacement card in that slot is that interface again. The store renders systemd .link files, leaving udev to apply names as devices appear.
2026-10-31Revert: T3871: make boot-time interface naming deterministic and hw-id awareChristian Breunig
This reverts commit 22cfee116c9935f4a33da4923eff189f2f646371.
2026-10-31Revert: T3871: never guess a pending node's hardware when ambiguousChristian Breunig
This reverts commit 4b92c2fe6f9928a1ff126c92e89e993de17fb0f5.
2026-10-27frrender: T9442: cache the FRR configuration only after it was appliedRuben Herold
The configuration was stored as the cached one before FRR had reloaded it. If the reload failed, or FRR was down, the next commit found the configuration unchanged, skipped the reload and reported success while FRR kept running the old configuration. Keep the rendered configuration aside and make it the cached one only after the reload succeeded. A render which does not reach the reload is not cached either. If the reload fails, FRR may run a part of the new configuration. The cache is dropped then, so even a return to the previous configuration reloads FRR. A reload that succeeds on the last try no longer raises an error.
2026-10-19Merge pull request #5573 from c-po/firewall-fixesChristian Breunig
firewall: T9474: multiple issues in rule processing (time based rules, fragment matching and failing commits)
2026-10-18Merge pull request #5543 from alexk37/ospf-opaque-canonicalChristian Breunig
ospf: T9441: drop "parameters opaque-lsa" (migrated to "capability opaque") and render "compatible rfc1583" as FRR prints it
2026-10-18wwan: T9388: request an IPv6 bearer for autoconf without an address nodeAdam Smith
"ipv6 address autoconf" lives below "ipv6", so an interface which only gets its address by SLAAC has no "address" node at all. connect_options() only worked out the IP type when that node existed and fell back to ipv4 otherwise, which dialled an IPv4-only bearer and left the interface without any IPv6. Read the address list with a default instead. All other combinations of dhcp, dhcpv6 and autoconf give the same IP type as before.
2026-10-18ospf: T9441: migrate "parameters opaque-lsa" to "capability opaque"Alex Kudentsov
"protocols ospf parameters opaque-lsa" and "protocols ospf capability opaque" are two CLI nodes for one FRR setting, FRR's "capability opaque". Keep "capability opaque" only. The migration script ospf/2-to-3 sets "capability opaque" where "parameters opaque-lsa" exists in the default VRF, and deletes the old node (and the "parameters" node when it is left empty). FRR refuses opaque LSAs outside the default VRF, so in a VRF instance the option never took effect: for a VRF the migration drops both "parameters opaque-lsa" and a plain "capability opaque" instead of moving the value into a node FRR would refuse at the next commit. The template renders the line from "capability opaque" only; it rendered the alias form "ospf opaque-lsa" for the old node, which frr-reload found missing in the running config on every reload: while only the old node was set, every commit that reloads FRR reset all adjacencies of that OSPF instance. Tests: a migration unit test (global instance, VRF instance, a VRF with "capability opaque" set directly, both nodes set together in a VRF, and global+VRF independence), the vrf-ospf config test (now carries "parameters opaque-lsa" in both the default instance and a VRF instance; the VRF instance is expected to lose it with no replacement), test_ospf_02 uses the new node, and test_ospf_21 checks the generated FRR config.
2026-10-17firewall: T9474: match time windows crossing midnight in UTCChristian Breunig
Rules with a start and stop time were rendered as two separate hour comparisons. nft converts both to UTC when loading the ruleset, so a window crossing midnight in UTC never matched - e.g. 22:00-06:00 anywhere, or 01:00-02:00 on a system running in CEST. A start or stop time on its own had the same problem. Hours are now rendered as a single range, which nft turns into its complement when it wraps around midnight. A missing start or stop defaults to the beginning or end of the day.
2026-10-01openvpn: T9370: add chacha20poly1305 data cipherAntonio Quartulli
Offer chacha20poly1305 in "encryption data-ciphers" and "encryption data-ciphers-fallback", rendered as CHACHA20-POLY1305 and allowed with DCO.
2026-09-29openvpn: T9364: default the MTU to 1420 when DCO is enabledAntonio Quartulli
The ovpn Kernel module does no MSS clamping, so with a 1500 bytes MTU full sized packets get fragmented on the underlay. Add an "mtu" node, rendered as "tun-mtu". With "offload dco" it defaults to 1420, unless a raw tun-mtu/link-mtu/udp-mtu option is present. Reject "mtu" together with such an option, below 100, and below 1280 when IPv6 runs inside the tunnel.
2026-09-29openvpn: T9363: multiply the site-to-site keepalive timeoutAntonio Quartulli
"failure-count" counts missed intervals, so the timeout it describes is interval * failure-count. Server mode renders and verifies it that way; site-to-site passed the bare count to "ping-restart", where it lands as seconds - 60s instead of 600s with the defaults. Render the product. That puts a timeout past the 86400 "ping-restart" accepts within reach, so verify() rejects it and the 5-to-6 migration clamps configurations already beyond it. This changes behaviour on upgrade: site-to-site tunnels now tolerate a longer silence, 600 seconds instead of 60 with the defaults.
2026-09-28Merge pull request #5266 from MPStudyly/T8977_fix_haproxy_rebindDaniil Baturin
T8977: Fix regression with is_addr_assigned and is_listen_port_bind_service
2026-09-26configverify: T8859: remove dead code for verify_diffie_hellman_length()Christian Breunig
Commit a9e9c4acfa ("pki: openvpn: T3642: Migrate OpenVPN to PKI and refactor") was the last caller of verify_diffie_hellman_length() despite the build time testcases. Unused code is dead code, drop it.