Fix min_refresh_interval() side effect#6
Open
theogilbert wants to merge 2 commits into
Open
Conversation
This file contains hidden or 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
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.
When
PacketMatchercannot find a PID associated to a connection, it refreshes its mapping tables and then tries to find the connection's PID, which will be bound to the connection until the connection is dropped.But there is a scenario which causes a connection's packets to never be assigned to a process:
min_refresh_intervalis set, to let's say 20msa.
refresh()is called, updating the connection / inode / PID mapping tablesb. These tables are used to retrieve the PID associated to the connection
a.
refresh()is called, but because of themin_refresh_interval, the mapping tables are not updatedb. The mapping tables only contains data known at the step 2.b, and do not include this new connection.
c. The return value of
self.tables.map_connection(), in this caseNone, is assigned to the connectionFrom now on, all captured packets from this connection will never be assigned to a process.
To fix this behavior, I propose to attempt a
refresh()infind_pid_cached(), when no PID is assigned to the connection.refresh()will then callupdate_known_connection()which will try to assign a PID from the updated mapping tables.