From: Evgeny Vereshchagin Date: Sat, 29 Sep 2018 02:47:18 +0000 (+0000) Subject: tests: make fuzz-dhcp6-client work in containers provided by the OSS-Fuzz project X-Git-Tag: v240~667^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45a7becfeaba0ab50b1aae9cddbb5c32789d56b2;p=thirdparty%2Fsystemd.git tests: make fuzz-dhcp6-client work in containers provided by the OSS-Fuzz project The containers come with an empty machine-id, which causes the fuzzer to fail as soon as it starts. See https://github.com/systemd/systemd/pull/9014#discussion_r189594104 --- diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c index 531cf6783bf..77c584ee60a 100644 --- a/src/libsystemd-network/dhcp-identifier.c +++ b/src/libsystemd-network/dhcp-identifier.c @@ -108,8 +108,13 @@ int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len) { assert(len); r = sd_id128_get_machine(&machine_id); - if (r < 0) + if (r < 0) { +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + machine_id = SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10); +#else return r; +#endif + } unaligned_write_be16(&duid->type, DUID_TYPE_EN); unaligned_write_be32(&duid->en.pen, SYSTEMD_PEN);