Commit Graph

89 Commits

Author SHA1 Message Date
Richard Hughes
28678235cd Move the fuzzing files into the plugin directories
We only had to pile everything into the src/fuzzing/firmware directory
because honggfuzz could not cope with more than one input path.

This way each plugin is self contained and easy to copy.
Also, install the fuzzing builder objects as this fixes the installed
tests when srcdir does not exist.

Based on a patch by Jan Tojnar <jtojnar@gmail.com>, many thanks.
2021-10-22 15:24:05 +01:00
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00
Richard Hughes
852a6dbdc2 redfish: Handle EPERM when testing devices with a IPMI device
Fixes https://github.com/fwupd/fwupd/issues/3849
2021-10-12 19:12:57 -05:00
Richard Hughes
478e44bc19 trivial: Do not use g_assert() in self test code
Note that g_assert() should not be used in unit tests, since it is a
no-op when compiling with G_DISABLE_ASSERT. Use g_assert() in production
code, and g_assert_true() in unit tests.

See https://github.com/fwupd/fwupd/issues/3790
2021-09-24 22:20:21 +01:00
Richard Hughes
4b09701452 redfish: Fix a potential NULL dereference spotted by Coverity 2021-09-24 19:03:52 +01:00
Richard Hughes
ac1ae33b05 redfish: Install the config file readable only by root
It's got a password there, so this seems entirely appropriate.
2021-09-21 15:35:09 +01:00
Richard Hughes
0955e08a72 redfish: Do not hardcode the KCS user_id to be 0x4 2021-09-21 15:35:09 +01:00
Richard Hughes
40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00
Richard Hughes
1210aa4ae7 redfish: Create user accounts automatically using IPMI
This allows the Redfish plugin to "just work" when there is no username
or password in the SMBIOS data. Using KCS we can create an admin account
from the host OS and then automatically enumerate devices.
2021-09-07 17:25:37 +01:00
Richard Hughes
fb3f869810 redfish: Refactor the PATCH modify code 2021-09-07 17:25:37 +01:00
Richard Hughes
d8af914072 trivial: Remove some unused variables 2021-08-28 10:17:56 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Mario Limonciello
73fe71a65e trivial: redfish: fix a wrong return value 2021-08-24 11:18:40 -05:00
Mario Limonciello
cedc772b91 trivial: redfish: remove duplicate dictionary key
found by codacity
2021-08-18 07:58:17 -05:00
Mario Limonciello
393777b9fb trivial: redfish: drop unused import and variables
found by codacity
2021-08-18 07:58:17 -05:00
Richard Hughes
ad24f1623d redfish: Also conflict with the bios plugin when required 2021-08-06 20:51:22 +01:00
Richard Hughes
d4a4362621 redfish: Fix writing large firmware files 2021-08-06 20:51:22 +01:00
Richard Hughes
f5c0eab25d redfish: Add a per-vendor quirk to set all devices as requiring a reboot
Some versions of XCC do not send the Base.1.10.ResetRequired message.
2021-08-06 20:51:22 +01:00
Richard Hughes
a5a978b3f6 Rename some confusing API
More than one person has asked about 'why call fu_plugin_update() for a
reinstall or downgrade' and I didn't have a very good answer.

The plugin API is not officially stable, and we should fix things to be
less confusing. Use the same verbs as the FuDevice vfuncs instead.
2021-08-06 19:49:53 +01:00
Richard Hughes
27fbab1990 redfish: Disable the uefi_capsule plugin if coldplug succeeded
We don't want to show the big warning about the missing ESRT on server
hardware that is managed by a BMC:

    WARNING: UEFI capsule updates not available or enabled in firmware setup
      See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
2021-08-03 13:10:10 +01:00
Richard Hughes
25c93aa7ca redfish: Identify hardware that needs to be updated to the same version
For instance, the EFI driver for a given network card cannot be
different for identical hardware.
2021-07-23 13:16:47 +01:00
Richard Hughes
a8206b2bf6 redfish: Work around a XCC-ism on Lenovo hardware
Only the backup BMC device (which we ignore anyway...) can be updated
by specifying the target ID, the others need an *empty* array so that
XCC can work out what devices need to be processed.
2021-07-23 13:16:47 +01:00
Richard Hughes
6b238b2daa redfish: Automatically connect the BMC network interface at startup
Some distributions like RHEL change the default to not autoconnect
ethernet devices. This breaks connecting to the SMBIOS-defined BMC
adapter which means all the reads fail after a 60s timemout.

Autoconnect the internal USB ethernet adapter so we can use Redfish
without user action.
2021-07-22 12:48:22 +01:00
Richard Hughes
6b151a6acb redfish: Fix parsing USB/PCI network VID/PIDs 2021-07-22 12:48:22 +01:00
Richard Hughes
70a64190cb redfish: Limit requests to 30s max
The default in new libcurl versions is 'forever' which isn't useful for
a shared daemon.
2021-07-22 12:48:22 +01:00
Richard Hughes
ecd4c5431b redfish: Fix the docs to match reality 2021-07-22 12:48:22 +01:00
Mario Limonciello
798d1ed3ee trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00
Richard Hughes
a71f100e5a redfish: Use the HotPluggable attribute if provided
Although, this only seems provided for PSU devices...
2021-07-14 15:21:04 +01:00
Richard Hughes
10cd248948 redfish: Restore compatibility with old libcurl versions
Making the redfish plugin disabled on RHEL 8 was... unpopular.
2021-07-09 16:30:30 +01:00
Richard Hughes
5343a4a083 Export the build timestamp from plugins 2021-07-08 16:31:07 +01:00
Richard Hughes
a923ae2804 redfish: Refactor plugin and add some unit tests 2021-07-08 15:35:02 +01:00
Richard Hughes
4fb8c7ad51 trivial: Fix precommit issue
Weird.
2021-07-06 17:33:33 +01:00
Richard Hughes
5f42fcb0c4 redfish: Port FuRedfishClient to derive from FuBackend 2021-07-06 17:13:16 +01:00
Richard Hughes
ad825eac24 redfish: Allow discovery of Redfish BMCs specified by VID-PID or MAC
Also, allow overriding the data using the config file.
2021-07-06 17:13:16 +01:00
Richard Hughes
35e701556f redfish: Add GUIDs lowercase to match all the other plugins 2021-06-28 19:42:03 +01:00
Richard Hughes
7b7d33554a redfish: Fix a download warning for libcurl >= 7.62.0 2021-06-28 19:41:37 +01:00
Richard Hughes
6ff0ae2bc4 redfish: Split out the SMBIOS table parsing
This makes it more robust against corrupted data, and also adds support
for fuzzing.
2021-06-25 19:55:19 +01:00
Richard Hughes
5acee72213 redfish: Fix the SMBIOS table type value
It's 'type 42' in _decimal_, not hex.
2021-06-25 19:55:19 +01:00
Mario Limonciello
73cdf067ed trivial: fixup includes for a variety of plugins 2021-06-14 10:12:45 +01:00
Mario Limonciello
b0fd08b077 trivial: don't hardcode dependency on libjsonglib for any plugins 2021-06-14 09:25:43 +01:00
Richard Hughes
b333e0045c Split out a shared system context
There is a lot of code in fwupd that just assigns a shared object type to
a FuPlugin, and then for each device on that plugin assigns that same shared
object to each FuDevice.

Rather than proxy several kinds of information stores over two different levels
of abstraction create a 'context' which contains the shared *system* state
between the daemon, the plugins and the daemon.

This will allow us to hold other per-machine state in the future, for instance
the system battery level or AC state.
2021-04-01 21:11:29 +01:00
Richard Hughes
a5966f7085 trivial: Codespell fixes 2021-03-19 16:42:33 +00:00
Richard Hughes
b3f9841924 Support more than one protocol for a given device
Devices may want to support more than one protocol, and for some devices
(e.g. Unifying peripherals stuck in bootloader mode) you might not even be able
to query for the correct protocol anyway.
2021-03-01 16:14:36 +00:00
Richard Hughes
078beafb2d Add a new internal flag to opt-in to GUID matching
It is far too easy to forget to set FWUPD_DEVICE_FLAG_NO_GUID_MATCHING for new
plugins, and without it it all works really well *until* a user has two devices
of the same type installed at the same time and then one 'disappears' for hard
to explain reasons. Typically we only need it for replug anyway!

Explicitly opt-in to this rarely-required behaviour, with the default to just
use the physical and logical IDs. Also document the update behavior for each
plugin to explain why the flag is being used.

This allows you to have two identical Unifying plugged in without one of them
being hidden from the user, at the same time allowing a HIDRAW<->USB transition
when going to and from bootloader and runtime modes.

This removes the workaround added in 99eb3f06b6.

Fixes https://github.com/fwupd/fwupd/issues/2915
2021-02-25 15:47:25 +00:00
Richard Hughes
a22c13c637 Move the plugin build logic to the plugins themselves 2021-02-18 14:46:20 +00:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
00640f42f2 Lower the CURL version required to fix build in RHEL
Some vendors really really want 1.5.x in newer RHEL versions, but the version
of curl is too old. Add #ifdefs so that we can emulate (somewhat imperfectly)
the 'new' CURLU functonality.
2020-12-07 14:17:22 +00:00
Richard Hughes
3a73c342ba Switch from libsoup to libcurl
The former drags on glib-networking and then gsettings-desktop-schemas, which
add over 5Mb to the minimal IoT and CoreOS composes. Everything already uses
libcurl (even NetworkManager!) and so this is an easy way to reduce image size.
2020-11-19 19:39:37 +00:00
Mario Limonciello
8aa5d41eb7 Add external interface messages 2020-10-26 12:05:20 -05:00