From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B2A225A027B for ; Mon, 24 Jul 2023 08:09:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1690178979; bh=Qj34+ARQLVZgceRy4GVcmyeSBl4jtUVlow+j5JRk7TA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0lzhucyodWhYt/fzrM5L572YUbYxxyMejdCBRk+XC7c4kGPdIasqppXwkTToknkJ HXQsLq6Qrclk8QXSkw5GiM5kOzIGvHiC+KaJX4E4fPLrjHsMr7Cm9sSvWI96rxXBCY Pb/79D/fg4xlsdu4/dHqwmbZvE1cjrk7kCCqb2v4= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4R8V9v4k1mz4wyl; Mon, 24 Jul 2023 16:09:39 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 07/17] netlink: Start sequence number from 1 instead of 0 Date: Mon, 24 Jul 2023 16:09:26 +1000 Message-ID: <20230724060936.952659-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230724060936.952659-1-david@gibson.dropbear.id.au> References: <20230724060936.952659-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: HF3J22DENOI5WNMWJ75VS3MAMLHLKM5X X-Message-ID-Hash: HF3J22DENOI5WNMWJ75VS3MAMLHLKM5X 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 bd76098..3620fd6 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