public inbox for autofs@vger.kernel.org
 help / color / mirror / Atom feed
From: tbecker@redhat.com
To: autofs@vger.kernel.org
Cc: Thiago Becker <tbecker@redhat.com>
Subject: [PATCH] Fix masks in parse_sub.c, so that hosts are correctly matched.
Date: Thu, 19 Mar 2026 17:08:00 -0300	[thread overview]
Message-ID: <20260319200800.2512262-1-tbecker@redhat.com> (raw)

From: Thiago Becker <tbecker@redhat.com>

In the case local address is 10.x.x.x and one of the replica addresses
is 138.x.x.x, MASK_A will make both equal, and get_priority will return
PROXIMITY_NET, which is not correct.

MASK_A = 0x7F000000 = 01111111 00000000 00000000 00000000
LOCAL  = 10.x.x.x   = 00001010 00000000 00000000 00000000
REMOTE = 138.x.x.x  = 10001010 00000000 00000000 00000000

Signed-off-by: Thiago Becker <tbecker@redhat.com>
---
 lib/parse_subs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/parse_subs.c b/lib/parse_subs.c
index 2acb056b..1575e999 100644
--- a/lib/parse_subs.c
+++ b/lib/parse_subs.c
@@ -37,9 +37,9 @@
 static int volatile ifc_buf_len = MAX_IFC_BUF;
 static int volatile ifc_last_len = 0;
 
-#define MASK_A  0x7F000000
-#define MASK_B  0xBFFF0000
-#define MASK_C  0xDFFFFF00
+#define MASK_A  0xFF000000
+#define MASK_B  0xFFFF0000
+#define MASK_C  0xFFFFFF00
 
 /* Get numeric value of the n bits starting at position p */
 #define getbits(x, p, n)	((x >> (p + 1 - n)) & ~(~0 << n))
-- 
2.53.0


                 reply	other threads:[~2026-03-19 20:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260319200800.2512262-1-tbecker@redhat.com \
    --to=tbecker@redhat.com \
    --cc=autofs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox