Date: Wed, 08 Jan 2020 01:56:06 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 243164] blacklistd not handling masks correctly Message-ID: <bug-243164-227-djsDrm4Rhn@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-243164-227@https.bugs.freebsd.org/bugzilla/> References: <bug-243164-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243164 --- Comment #3 from Conrad Meyer <cem@freebsd.org> --- Ah. I wonder if this is it? 459 #define MASK(m) ((uint32_t)~((1 << (32 - (m))) - 1)) 460 461 static int 462 conf_amask_eq(const void *v1, const void *v2, size_t len, int mask) 463 { 464 const uint32_t *a1 = v1; 465 const uint32_t *a2 = v2; 466 uint32_t m; 467 int omask = mask; 468 469 len >>= 2; 470 switch (mask) { 471 case FSTAR: 472 if (memcmp(v1, v2, len) == 0) 473 return 1; 474 goto out; // Above is definitely wrong, only compares the first 1/4 of the address // bytes. Maybe that's what we're seeing? ... 484 for (size_t i = 0; i < len; i++) { 485 if (mask > 32) { 486 m = htonl((uint32_t)~0); 487 mask -= 32; 488 } else if (mask) { 489 m = htonl(MASK(mask)); 490 mask = 0; 493 if ((a1[i] & m) != (a2[i] & m)) 494 goto out; // This part seems fine for v4, but I'm not sure if it's correct for v6. 495 } 496 return 1; 497 out: ... 506 return 0; -- You are receiving this mail because: You are the assignee for the bug.help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-243164-227-djsDrm4Rhn>
