[PATCH 0/4] Prefer UUIDs for referring to discover devices

Samuel Mendoza-Jonas sam at mendozajonas.com
Tue Sep 6 11:45:50 AEST 2016


These patches are intended to improve the resiliency of interface and
device tracking in Petitboot. In particular they are in response to an
odd scenario where the following events would occur:

	- New interface enP1p5s0f0 with UUID x:x:x:x:x:x
		New discover device created with
			name: enP1p5s0f0
			uuid: x:x:x:x:x:x
	- New interface enP1p5s0f0 with UUID y:y:y:y:y:y
		Device enP1p5s0f0 already exists, uuid set to
			uuid: y:y:y:y:y:y
	- Interface name update: enP1p5s0f0 -> enP7p1s0f1
	- 'Remove' event for enP7p1s0f1

This resulted in two separate interfaces referencing the same discover
device struct, which was then freed when a pb-event 'remove' event was
processed. This shortly led to a segfault in pb-discover when the other
interface tried to access its stale reference to the struct.

Patch 1 is a neatness patch that removes a superseded method that was
noticed during debugging.
Patch 2 ensures that events generated by pb-udhcpc always reference the
MAC address of the concerned interface.
Patch 3 and 4 update various checks in pb-discover to prefer searching
for devices by UUID rather than by a name which may not be unique.

Samuel Mendoza-Jonas (4):
  discover: Deprecate 'conf' user event
  utils: Always pass MAC address in pb-udhcpc
  discover: Pass UUID to discover_device_create()
  discover/network: Add find_interface_by_uuid

 discover/device-handler.c | 45 +++++++-----------------------
 discover/device-handler.h |  4 +--
 discover/event.c          |  2 --
 discover/event.h          |  1 -
 discover/network.c        | 71 ++++++++++++++++++++++++++++++-----------------
 discover/udev.c           |  2 +-
 discover/user-event.c     | 40 ++++++++------------------
 test/parser/utils.c       |  2 +-
 utils/pb-udhcpc           |  5 ++--
 9 files changed, 74 insertions(+), 98 deletions(-)

-- 
2.9.3



More information about the Petitboot mailing list