From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 953C05A027E for ; Thu, 3 Aug 2023 09:20:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1691047199; bh=jA5oqDD4vqO8ssjgKBmgBoc2XlDKozdAfhVMBAFHwuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CKqeJ7lu6/lYE81sXEPbZbmD6SpNZvh4JIpzhjiMZJHEzx0ay3RJe4a5cO2VPxWL3 5iIDx095lsdJ3k2L9LUhQGCtrcDrterAX23l32X0cp93MPGcia/V1kxikzdplSWI1e l0MbTTCGojiMJusCRwcfH3DZFe4As8mYmT535cV4= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RGgGR60f3z4wy5; Thu, 3 Aug 2023 17:19:59 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 07/17] netlink: Start sequence number from 1 instead of 0 Date: Thu, 3 Aug 2023 17:19:46 +1000 Message-ID: <20230803071956.3198452-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230803071956.3198452-1-david@gibson.dropbear.id.au> References: <20230803071956.3198452-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 4WBIHBNRAVBSGOWUHDZD5VOHMYRR5DWM X-Message-ID-Hash: 4WBIHBNRAVBSGOWUHDZD5VOHMYRR5DWM X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Netlink messages have a sequence number that's used to match requests to responses. It mostly doesn't matter what it is as long as it monotonically increases, so we just use a global counter which we advance with each request. However, we start this counter at 0, so our very first request has sequence number 0, which is usually reserved for asynchronous messages from the kernel which aren't in response to a specific request. Since we don't (for now) use such async messages, this doesn't really matter, but it's not good practce. So start the sequence at 1 instead. Link: https://bugs.passt.top/show_bug.cgi?id=67 Signed-off-by: David Gibson --- netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlink.c b/netlink.c index 1e15bf5..d5b86aa 100644 --- a/netlink.c +++ b/netlink.c @@ -40,7 +40,7 @@ /* Socket in init, in target namespace, sequence (just needs to be monotonic) */ int nl_sock = -1; int nl_sock_ns = -1; -static int nl_seq; +static int nl_seq = 1; /** * nl_sock_init_do() - Set up netlink sockets in init or target namespace -- 2.41.0