Re: [PATCH] Fix for ipv6 address merge error reported on argus mailing list.
Carter Bullard <[email protected]> Mon, 2 Jul 2018 09:12:22 -0400
| Newsgroups | gmane.network.argus |
|---|---|
| Message-ID | <[email protected]> |
Hey Frank, We’ll release a new version of open source argus in the Aug/Sept time frame. Until then can you use the patch ?? Carter > On Jul 2, 2018, at 4:59 AM, Frank <[email protected]> wrote: > > thx! > > is it possible to get that version somewhere? > > On 06/29/2018 05:56 PM, Carter Bullard wrote: >> IPv6 address merging generated short or mangled results. >> Fixed issue where not looking at right part of the address for comparison. >> Needed to ntohl the 32-bit chunk that was being compared. >> >> (cherry picked from commit 97b17fb3da6cde58f1d2386315fb9e746dd76c85) >> --- >> common/argus_client.c | 12 +++++++----- >> 1 file changed, 7 insertions(+), 5 deletions(-) >> >> diff --git a/common/argus_client.c b/common/argus_client.c >> index 013fea6e..7603f33b 100644 >> --- a/common/argus_client.c >> +++ b/common/argus_client.c >> @@ -6946,15 +6946,17 @@ ArgusMergeAddress(unsigned int *a1, unsigned int *a2, int type, int dir, unsigne >> for (z = 0; z < 4; z++) { >> if (a1[z] != a2[z]) { >> unsigned int i = 32, value = 0, ind; >> + unsigned int na1 = ntohl(a1[z]); >> + unsigned int na2 = ntohl(a2[z]); >> ind = 0x80000000; >> >> - while (ind && ((*a1 & ind) == (*a2 & ind)) && (i > (32 - *masklen))) { >> - value |= (*a1 & ind); >> - ind >>= 1; >> + while (ind && ((na1 & ind) == (na2 & ind))) { >> + value |= (na1 & ind); >> + ind >>= 1; >> i--; >> - } >> + } >> *masklen = (z * 32) + (32 - i); >> - a1[z] = value; >> + a1[z] = htonl(value); >> while ((z + 1) < 4) { >> a1[z + 1] = 0; >> z++; > >