Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capture-nics-fixups #1000

Merged
merged 1 commit into from
Aug 19, 2021
Merged

Conversation

DimaGolomozy
Copy link
Contributor

@DimaGolomozy DimaGolomozy commented Aug 18, 2021

  1. move the isDevice(l.host, pi) to be first, as no need to iterate on all nics if it returns true
  2. first compare by name, as same nics will have same names
  3. if not found by name, compare by ips.

the bug was the strings.HasPrefix
2 different nics with ipv6:

#nic1 ip: f1234::55
#nic2 ip: f1234::55::66::66

so because of the strings.HasPrefix it was evaluated as the name nics. but they are not.

@buger ^
it should also be a fix to release-1.3

@sonarcloud
Copy link

sonarcloud bot commented Aug 18, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.6% 0.6% Duplication

@buger buger merged commit 02a0904 into buger:master Aug 19, 2021
buger pushed a commit that referenced this pull request Aug 19, 2021
1. move the `isDevice(l.host, pi)` to be first, as no need to iterate on all nics if it returns `true`
2. first compare by name, as same nics will have same names
3. if not found by name, compare by ips.

the bug was the `strings.HasPrefix`
2 different nics with ipv6:
```
#nic1 ip: f1234::55
#nic2 ip: f1234::55::66::66
```

so because of the `strings.HasPrefix` it was evaluated as the name nics. but they are not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants