From patchwork Tue Jul 9 07:58:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1958226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=BZ9WMHuD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::339; helo=mail-wm1-x339.google.com; envelope-from=swupdate+bncbd2zdgn6sekrblo3wo2amgqeal4z7uy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-wm1-x339.google.com (mail-wm1-x339.google.com [IPv6:2a00:1450:4864:20::339]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WJCzn5mckz1xr9 for ; Tue, 9 Jul 2024 17:58:44 +1000 (AEST) Received: by mail-wm1-x339.google.com with SMTP id 5b1f17b1804b1-42671a6fb9dsf3813415e9.3 for ; Tue, 09 Jul 2024 00:58:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1720511919; cv=pass; d=google.com; s=arc-20160816; b=RYmZjOw/icpfokosEoZ5HEmTEqhOa/DzF642np8j5Td7n17sVgfSq9YBPvSdLyjhVV BF8bxy/5FuXUJhGCFV7icfLSv5o00UA1eFsI7Dbrcb9RW1QLIb0Oe1xw2ClYYaoyBJF7 xSAXY8A5dqzpQyV5ReuYf1l+9AHaM5zPdmRikE+PN7XElgOQ2OzzMLMfry6w0B0wBpMJ lgKR9b3CUBgILoV8z1YTkZDis6wjph+5WeWeFDrLG0ZJwtEu+90Nsp0qOC5gPvd4ShgM 4F9Bqlh64ErwDzFmpUAgIPpZ7rciggW/MupCs+6FJHgKwGERtSmhcUKg60RGFKs6cnxv P6Qg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=WmJ5PVxyhGv7PjGvzdknr8EsfflFDVA2ifqB8zFxSUU=; fh=X3ZWDA+bNgxkppm4qmc3n6RBAd2nBwl6FEQmS1u+N20=; b=lhWR8BAShS0pP+ia8ung/jaLdAnvz6/qAlV0We9IR4NnyfM0hV5V81XzuzSLi41coV zfRnBuMQy+UTGKy9uAClxVRX//QzZWwTfcEZENMg4ApdGkgaQOAbcVvv1Ia2oyDCPvJ1 ZqPwvZIWqywdZY5ULl9cqUGcGiisRtAEe21uwSjxKlM/TCfCoDVi+YyGU4Tmpge8keSi 7wTARK3lotVmCGeCyHToV1fr7unc4ty4DWXBrxxXmL88ZV/2TPrNq/JlBmwt7ddKo954 9OerYNDpeh1WfmmV9NbO5q5wFEzTrrkLQyXLjLQx1PKf8DJyUa4sWv6RhLRRuWlUqfup OBQw==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=LtjLNqg7; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1720511919; x=1721116719; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=WmJ5PVxyhGv7PjGvzdknr8EsfflFDVA2ifqB8zFxSUU=; b=BZ9WMHuDd00VIejSIooXpOPQfXgbp7Hl815tTSCB5g+esU+2IbM/lPc/5yuZrc3PQG 5ZhTK3yJxhr7/rFXnwcY4T2Twf5GnFx3PR3ruknVyb4NXXs1Q1KcwxmiuCq7Kc4dQjqv XOL7wiHz9+8mJnGWWOgosKMUE1N5lBB7zcgO8Qlz3xfi+ET7/ivz2cu3xNYC8Vsm47mK jRrfZTUzsnekl+6UG5XKZcJbiyy5Hf/9ur7+MqcacEkf8GCTT8hwtGc3IOt8rfn2A86u cXfEdrrjPC7KVzeeEl18CLQ8EnqsFS3GCe8h/kdR5bMG9bMUdozy+2rL1a/wAQgMn+tW HdKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720511919; x=1721116719; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=WmJ5PVxyhGv7PjGvzdknr8EsfflFDVA2ifqB8zFxSUU=; b=WSi5lKjjenroV7CecBvVfvaQPSgjkOmG9m1x1fUUAyEjzLREPocmGNeMpQKqGahvRX L/Dn38B52k1Mb/Iu281NsFrfpH4wq8zGwPUXL+pvjgkIjub4PTdvWn4MTDbiefgU4FS5 +qWWlQW67uwTGj6K1q7nJBHBJC11uFi6yVpuezNkpWdjErGs8IWvvpWY6x8ylYYi43Nc D0jz5SdCUeQXAqdqThODROftVfFklJxtbZDEio0yPPAhoFoGju5/nOKFrvsAYEtjHgrh P1DVZUPNWjF2i2vM/e/NzIYlwJsMkXKwFCSGkYBuaCgnEreQYpyve+dcW6w4Aw7s4lCV TJ7A== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCU7tkdkPCZcrdyGfACm53mtozQgiKFRP4F9++OvHHVwApvypG+eHQ0FqRQo7r3Rb3VPElrSIADNpzBS06xg7qubmMtj/TF9wmTdS+lrRA== X-Gm-Message-State: AOJu0YxfrpciY6Kr62qKTzUdP0hl8oSh4jQujfsswxWf7IkR5t9SEUI+ QDBtnIf4cFwOOIg2nqLtpZveLu5OVPZ7XFEXMppSX6/mKgqFyARu X-Google-Smtp-Source: AGHT+IF7VlokfFyGTRySKjiXlzHAL+kw3rXUZYUDJ5TWS42HKD/xK3WmvhcW+nB6h7g+lRrLKhl2oQ== X-Received: by 2002:a05:600c:896:b0:426:5216:3254 with SMTP id 5b1f17b1804b1-426708f1eebmr12967945e9.32.1720511918636; Tue, 09 Jul 2024 00:58:38 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:600c:4755:b0:421:7e41:1867 with SMTP id 5b1f17b1804b1-42649790972ls19926805e9.0.-pod-prod-08-eu; Tue, 09 Jul 2024 00:58:36 -0700 (PDT) X-Received: by 2002:a05:600c:896:b0:426:5216:3254 with SMTP id 5b1f17b1804b1-426708f1eebmr12967225e9.32.1720511915829; Tue, 09 Jul 2024 00:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720511915; cv=none; d=google.com; s=arc-20160816; b=iwcPwTLEOhMUWNe6vFPLe3vlbmhZBTX3GSIUJTV4FHKyfGOYug3tBb9jrT1lHXw2II eWOTTBXNPw+saF8dPInvHZd8NO0TzQqFRjdqzz7ec+uOOEoSkD+FMLjEk6+5i77YVA11 FQixKGzMecV0CR8aOUcHgvvWjwgL0bgvejdMlsI8H+bd16yvvvHoHGvC22mtySRHd5cL 6h6eV8dldyk4spufcq/Y1bjwcaGYiKvBr51HS6X8u8pE83D8jLmF2gPR6WkPHvJW0o+A B/lGoPsdxLhgqyIPdHqmduzOATs2ZPwDtGrmB4IcGtL8+lQ7wCIZuU9iju5+DCq5o5Gj Ru+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Wf9yl918u0WWGiCeZa9d1OiGC9+ry1z6qlmoSdsRamM=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=EP5RKkI20etnbv9mHwBVkCorTo8xP7cfhDp+Oi6qcnFsd0iy94BFseie5yjK0eLnLq 9ALy5YbLvShHmyUE9Dib0wA4FMkhC+3vCXYxGQs753upHWSnDIy3PljiFHOh54JNOQCR 7svKtDtssT7ZHWt9OsW9T8YfEh91UvlG1y70/PGVEukxUyuIQy7T7d+Pm4JNov92YEIN C8saNx0JpAs3m94I7WquDtWZOez3+KUafLlMnm/eI73tkFwqa2sZI90r1mhXw1+zTaTX oNvZMFg0/cWKGWp9EalSdswoM09yl/btPNbZHtPOD+uCwYmRzAG1FXkY4sYqwnSo2VQF XLnQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=LtjLNqg7; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.135]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-4266f6941c0si310435e9.0.2024.07.09.00.58.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 00:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) client-ip=212.227.126.135; X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MkHEH-1ryaPK1RcH-00q0sV; Tue, 09 Jul 2024 09:58:35 +0200 From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/2] hawkbit: raise a WARN if a action id is not in env Date: Tue, 9 Jul 2024 09:58:33 +0200 Message-Id: <20240709075833.2345799-2-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240709075833.2345799-1-stefano.babic@swupdate.org> References: <20240709075833.2345799-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1:TSXTwHbiR1IAM5oQ67AAElXX4Jb52jathlwHvtB0oYSnAjhN86j vF5JutiRYk3t4mCU4m9AIUGbkR+wfJgQ1/Yt7tKyLA//MHpb7nAdoxz+vgBTb2NcjJXEM07 eLRBCk9HJQmf60SKClAf4Bxop3jJq1mS5qZ1rLoKw0Pr4oU6qLWirVhNsp0Ff9wAWx+2dkA Ntf4rRgjl2XbRhQGTAAOg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:VTjoWIRdtWE=;aQB4gPn6SbBzfo5GAHAyjtvviLP 7aW++MUzN0dgln6C4K1TzzXeM0FncuRXl6Dk3PgGWivXY8/W/z+NrbYh4lqTBZE/azPsvVn1G Tld9Fm8zOH0p73v+LhP54j8JmsKQYx47tCUt+PU8u6anpie35kXexGXVYerz5dhjQSXTlbKLO 3kFJ6DAwgUMHmVZQFs6uiT4gsmqsFAUYXmbPyz5AGZYXLX2bGmfH38HX6EnJcLvSjMmQYmqlB fu1vXNHQdfN2S+FuLHpFn92VlK+lLdo6WpIqRDjRsmuK3vAKZDJRBQHr+ydUGv6FFFcYTDjPo X32bPEojZACBgXM/IM5RXzdBx7zCbw/f3+6RyV4S5fY7oOZw2kDwcCF3kyvyXlQO+IOalx2Jw ebgQZ8sQ8Y+KFnR6Q8FCu3AE9hnN0Hz+GxriirHpmJPhuFDWVTNfIvZfo8I4jKkk4vSXn8LQz RD7A5HnNv2ipFYNHPbudZBnlrEYPNqx1mqaFVSv2XdoHA85dPu2a4kjOadY43iacDevdZhyZl q+iBzuWmkRAuAhGxl8YKYdp2k/8QP+fvxr5sdrqeUKg1uvUZ8rTCcgbH9uJv9eoivRQOMsky7 ySHAqHbrEQO63JOS2Qj4lpKYqw2rWWPj+U9O6o79XNYFYf5Ay8Ed9AB0FDsObY1FgMkJIG9d+ vjGg8pkA5V+2GT+CalaayXAIzC4ncAP1b48NpBZpv3BrTluzWimalER15DG/ceNXlLZ/NRifK LlTNcyUtMMmbTq4M5rWvK07wzElg2iaXH1j8XLLGP6y4tAsHmDD0Ys= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@swupdate.org header.s=s1-ionos header.b=LtjLNqg7; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.126.135 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , For long time, thjere was a race condition with Hawkbit: if after a restart, the operator changed on the server the deploy, SWUpdate committed an update that wasn't executed. To avoid this, the action id of the update that was executed is now stored in env, but to be compatible with the past, the old behavior is accepted as well. This raises a warning in case the old behavior is chosen to advise that the answer to Hawkbit could be wrong. Signed-off-by: Stefano Babic Reviewed-by: Dominique Martinet --- suricatta/server_hawkbit.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) -- 2.34.1 diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 9d71a318..aa83676a 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -868,20 +868,22 @@ static void get_action_id_from_env(int *action_id) * stored. */ char *action_str = swupdate_vars_get("action_id", NULL); - if (action_str) { - int tmp = ustrtoull(action_str, NULL, 10); - if (errno) - WARN("action_id %s: ustrtoull failed", - action_str); - /* - * action_id = 0 is invalid, then check it - */ - if (tmp > 0) { - *action_id = tmp; - TRACE("Retrieve action_id from previous run: %d", *action_id); - } - free(action_str); + if (!action_str) { + WARN("Action id not in env: action from server sent, possible mismatch "); + return; + } + int tmp = ustrtoull(action_str, NULL, 10); + if (errno) + WARN("action_id %s: ustrtoull failed", + action_str); + /* + * action_id = 0 is invalid, then check it + */ + if (tmp > 0) { + *action_id = tmp; + TRACE("Retrieve action_id from previous run: %d", *action_id); } + free(action_str); } server_op_res_t server_handle_initial_state(update_state_t stateovrrd)