-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Make packetbeat process monitor aware of bound address #9443
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The current implementation of Packetbeat's process monitor detects the local process by looking at the local port number used. However, differnet processes can be bound to the same port on different interfaces. This patch fixes the problem by looking up the process by using the tuple (address, port). Fixes elastic#9151
adriansr
changed the title
Make packetbeat process monitor local address aware
Make packetbeat process monitor aware of bound address
Dec 7, 2018
adriansr
added
the
needs_backport
PR is waiting to be backported to other branches.
label
Dec 9, 2018
andrewkroh
approved these changes
Dec 10, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This needs a CHANGELOG entry.
jenkins, test this |
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Dec 11, 2018
The current implementation of Packetbeat's process monitor detects the local process by looking at the local port number used. However, different processes can be bound to the same port on different interfaces. This patch fixes the problem by looking up the process by using the tuple (address, port). There's still a case where Packetbeat can pick the wrong process: When one process is bound to INADDR_ANY and another to a specific local address. Testing suggests that the last socket to be bound takes precedence over the other. However, I couldn't find this behavior documented anywhere. As Packetbeat can't tell which socket was bound first, there's no way of telling which process is really receiving the traffic. This PR will give precedence to a socket bound to a local IP-address over a socket bound to INADDR_ANY. Fixes elastic#9151 (cherry picked from commit 824d443)
adriansr
added
v6.6.0
and removed
needs_backport
PR is waiting to be backported to other branches.
labels
Dec 11, 2018
adriansr
added a commit
that referenced
this pull request
Dec 12, 2018
The current implementation of Packetbeat's process monitor detects the local process by looking at the local port number used. However, different processes can be bound to the same port on different interfaces. This patch fixes the problem by looking up the process by using the tuple (address, port). There's still a case where Packetbeat can pick the wrong process: When one process is bound to INADDR_ANY and another to a specific local address. Testing suggests that the last socket to be bound takes precedence over the other. However, I couldn't find this behavior documented anywhere. As Packetbeat can't tell which socket was bound first, there's no way of telling which process is really receiving the traffic. This PR will give precedence to a socket bound to a local IP-address over a socket bound to INADDR_ANY. Fixes #9151 (cherry picked from commit 824d443)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation of Packetbeat's process monitor detects the local process by looking at the local port number used. However, different processes can be bound to the same port on different interfaces, causing Packetbeat to associate an event to the wrong process.
This PR fixes the problem by looking up the process by using the tuple (address, port).
There's still a case where Packetbeat can pick the wrong process:
When one process is bound to INADDR_ANY and another to a specific local address. Testing suggests that the last socket to be bound takes precedence over the other. However, I couldn't find this behavior documented anywhere.
As Packetbeat can't tell which socket was bound first, there's no way of telling which process is really receiving the traffic. This PR will give precedence to a socket bound to a local IP-address over a socket bound to INADDR_ANY.
Fixes #9151