Guillaume [Fri, 5 Jan 2024 16:45:07 +0000 (17:45 +0100)]
Removing all vif entries from xenstore at startup
When interfaces reported by Xenstore are suppressed while the service is
not running, these data remain. To avoid this we start by removing all
entries from previous agent. Entries that are still valid will be
repopulated immediatly.
Yann Dirson [Tue, 9 Jan 2024 11:16:20 +0000 (12:16 +0100)]
ci: use official package-installing scripts for freebsd
Note that devscripts/freebsd-fetch-package.sh was written for the CI,
and never worked from Cross.toml. Switch everything to the
slightly-improved-and-still-undocumented version of the scripts
shipped in the container itself.
Yann Dirson [Mon, 20 Nov 2023 11:13:18 +0000 (12:13 +0100)]
ci: cross-build Windows binary
Mostly a PoC, since we're missing crucial bits:
- Xenstore works differently on WIndows, and we don't have a crate
supporting it yet
- pnet will not build with mingw, needs msvc, and it seems there are
things to be done before we can use that
Yann Dirson [Tue, 12 Dec 2023 16:21:32 +0000 (17:21 +0100)]
ci/deb: publish APT repository as a gitlab "generic package"
This ought to be used as sources.list entry to access the repo, but
for some reason `apt-get update` gets HTTP 400 on Packages file,
whereas curl fetches it all right.
deb [trusted=yes] https://gitlab.com/api/v4/projects/xen-project%252Fxen-guest-agent/packages/generic/deb-amd64/ci/ ./
Yann Dirson [Fri, 24 Nov 2023 11:00:52 +0000 (12:00 +0100)]
net: prepare interface cache for name changing
While name changes do not necessarily have external impact (eg.
xenstore_schema_std does not expose those names), they are necessary
on Linux to know whether an iface is a VIF. This requires
NetInterface objects in the cache to be mutable.
Yann Dirson [Tue, 21 Nov 2023 13:55:17 +0000 (14:55 +0100)]
net: separate add/rm of interface and add/rm of MAC address
The current code would do nothing on interface removal, as we only
emit a `RmMac` event, with which xenstore_schema_std does nothing (we did
not add them in the first place).
An explicit `RmIface` allows for the removal of the full iface tree in
Xenstore, since there is no need to expose a mostly-empty tree.
Yann Dirson [Wed, 22 Nov 2023 16:11:57 +0000 (17:11 +0100)]
Drop unix_helper
We finally don't have a need for separately querying for an interface name
from its index, since we don't need to fetch this information every time a
packet arrives, netlink already gives us everything we need.
Yann Dirson [Thu, 23 Nov 2023 17:27:41 +0000 (18:27 +0100)]
pnet: keep a note on InterfaceInfo::name
Storage of interface name in pnet::InterfaceInfo would seem redundant
now, but we still need it stored temporarily, and this still looks
like the best place to do so.
Yann Dirson [Thu, 30 Nov 2023 16:45:00 +0000 (17:45 +0100)]
net: keep a cache of network interfaces
Collects in a central place a map of iface indices, their names, and their
toolstack interface if any.
Finally replaces add_vif_info() calls with get_toolstack_interface()
called once to populate the cache.
Finally the RmIp events can be applied when an interface disappears, which
essentially fixes #13.
Though this makes a new problem apparent: recreating the VIF sometimes
does not get caught on Linux, when the iface is created as eth0 and
then renamed by udev as enX0 in a subsequent Newlink message: since we
are now only attempting to identify the toolkit-interface once, if
when we try to access the /sys node for eth0 the renaming already
occured the toolkit-interface is frozen as None.
Yann Dirson [Thu, 30 Nov 2023 16:42:26 +0000 (17:42 +0100)]
netlink: refactor private funcs as methods
While there is no use for `self` today in there, we're going to need to
refer to an iface_cache in next commits, which gets much simplified if we
never have to borrow across method boundaries.
Yann Dirson [Wed, 22 Nov 2023 11:42:27 +0000 (12:42 +0100)]
net: rework toolstack-interface detection
Detection of toolstack-interface (and not only VIF) does not have to
be done on every NetEvent, but only once. To prepare for this,
introduce a new functional API that can be used instead of mutating a
NetEvent - this does not change call sites, which still make use of
the legacy API.
Yann Dirson [Mon, 20 Nov 2023 14:29:47 +0000 (15:29 +0100)]
netlink: use name from NLA in Link events
We were always calling `if_indextoname()` to get the interface name when
receiving a New/DelLink message. Just use the data we already received
instead.
On NewLink messages we just received the interface name, so we don't need
to make another query to get the information; on DelLink the sycall cannot
even give us this information any more.
Note at this point we still use "" to denote the lack of a name - it
seems unlikely to happen there anyway, and will be made cleaner next.
Yann Dirson [Tue, 21 Nov 2023 09:11:29 +0000 (10:11 +0100)]
xenstore_schema_std: index the iface address cache with OS index
Iface name is not always part of a Netlink message, as opposed to the
OS index of the interface, and looking up the name following reception of
an interface removal notification just does not work.
All supported and prospective platforms seem to have a concept of
interface OS index, so this should cause no problem and be more efficient.
Yann Dirson [Mon, 20 Nov 2023 15:26:13 +0000 (16:26 +0100)]
pnet: index NetworkView by interface index, not name
Current structure made us fill NetInterface with a dummy interface
number, and we want to use interface number in xenstore_schema_std to
fix #13.
Iface name becomes part of the associated data, bundle it into
InterfaceInfo for now (it will get redundant with introduction of a more
global interface cache).
Yann Dirson [Fri, 1 Dec 2023 09:57:38 +0000 (10:57 +0100)]
ci: make sure collapsed-section footer is always printed
In case of error the lack of footer would fool gitlab log display into
thinking error summary from git-rebase was part of the collapsible section,
which is confusing to the reader.
Yann Dirson [Fri, 24 Nov 2023 11:03:04 +0000 (12:03 +0100)]
ci: use stderr not stdout in build wrapper
The "Executing ..." lines from gitlab-ci occasionally got captured before
the footer of previous collapsed section, so hidden when said section is
collapsed.