[Bugs] [Bug 1739320] The result (hostname) of getnameinfo for all bricks (ipv6 addresses) are the same, while they are not.
bugzilla at redhat.com
bugzilla at redhat.com
Wed Aug 14 06:15:06 UTC 2019
https://bugzilla.redhat.com/show_bug.cgi?id=1739320
Aravinda VK <avishwan at redhat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags|needinfo?(avishwan at redhat.c |
|om) |
--- Comment #5 from Aravinda VK <avishwan at redhat.com> ---
I think it is failing while doing strcmp comparison.
```
if (!strcmp(firstip, nextip)) {
return GF_AI_COMPARE_MATCH;
}
```
Wrote a small script to compare the hostnames
```
#include <stdio.h>
#include <string.h>
int main()
{
char* first = "roger-1812-we-01";
char* second = "roger-1903-we-01";
char* third = "roger-1812-cwes-01";
printf("First(%s) vs Second(%s): %d\n", first, second, strcmp(first,
second));
printf("First(%s) vs Third(%s): %d\n", first, third, strcmp(first,
third));
printf("Second(%s) vs Third(%s): %d\n", second, third, strcmp(second,
third));
}
```
And the output is
First(roger-1812-we-01) vs Second(roger-1903-we-01): -1
First(roger-1812-we-01) vs Third(roger-1812-cwes-01): 20
Second(roger-1903-we-01) vs Third(roger-1812-cwes-01): 1
We should change the comparison to
```
if (strcmp(firstip, nextip) == 0) {
return GF_AI_COMPARE_MATCH;
}
```
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
More information about the Bugs
mailing list