-
Notifications
You must be signed in to change notification settings - Fork 81
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
NGINX agent cannot find the default network interface on Linux hosts. #317
Comments
richbrowne
added a commit
to richbrowne/agent
that referenced
this issue
May 18, 2023
…nginx#317) The parser was skipping over the first (header) line with the first invocation of scanner.Scan(). The second invocation of scanner.Scan() called in the for loop points to the first line of route data; however, this line was being skipped. The tests were incorrect because they started with a newline before the header.
6 tasks
Looking at func parseToLinuxRouteStruct(output []byte) (routeStruct, error) {
const (
destinationField = 1 // field containing hex destination address
)
lineNumber := 0
scanner := bufio.NewScanner(bytes.NewReader(output))
// Skip header line
if !scanner.Scan() {
return routeStruct{}, errors.New("Invalid linux route file")
}
for scanner.Scan() {
lineNumber++
if lineNumber == 1 {
// Skip header line.
continue
}
row := scanner.Text()
... |
dekobon
added a commit
to dekobon/agent
that referenced
this issue
Jun 5, 2023
Fixes nginx#317 This fix resolves a problem where the header line of /proc/net/route is skipped twice when running on Linux. Additionally, this change also adds error checking to the Scanner performing the parsing operation.
6 tasks
Dean-Coakley
pushed a commit
that referenced
this issue
Jun 8, 2023
Fixes #317 This fix resolves a problem where the header line of /proc/net/route is skipped twice when running on Linux. Additionally, this change also adds error checking to the Scanner performing the parsing operation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
The NGINX agent is incorrectly reporting the loopback interface as the default destination for network traffic.
When the agent reads
/proc/net/route
it always skips over the first line of route data. This causes it to miss the default route in many cases and it will report the default interface as loopback.Reproduce:
Run the agent on any Linux host with debug logging level. You will see the error message:
time="2023-05-18T05:25:01Z" level=debug msg="Error getting default network interface, interface with default destination not found"
Expected Result:
There is no error in the agent log about not being able to find the default destination and the agent reports the correct default interface.
Actual Result:
There is an error message about not finding the default destination and the agent reports 'lo' as the default interface.
The text was updated successfully, but these errors were encountered: