-
Notifications
You must be signed in to change notification settings - Fork 7k
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
net/ip: fix input packet filtering criteria #14656
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14656 +/- ##
==========================================
+ Coverage 51.97% 51.98% +<.01%
==========================================
Files 309 309
Lines 45584 45584
Branches 10555 10555
==========================================
+ Hits 23694 23697 +3
+ Misses 17082 17079 -3
Partials 4808 4808
Continue to review full report at Codecov.
|
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.
We should never get into this function if the network packet destination IPv{4|6} address is not ours. Those things are already checked in ipv4.c:net_ipv4_input() line 211 and ipv6.c:net_ipv6_input() line 462 before the connection.c:net_conn_input() is called.
Could you elaborate how did you see this issue, perhaps attach pcap file that shows what the packet looks like?
Edit: as the bug was about IPv4 broadcast address, then ignore my references for IPv6 above. Anyway, we have a check for broadcast addresses in ipv4.c line 211, could you check what it does wrong in that line?
@jukkar Yes, you're, right, I believe there's a flaw in the logic of that filter there that makes it too permissive. The && at the end of line 212 should be a ||. Basically, there are four criteria checked on the input packet.
Currently the logic says "drop the packet if it's (not #1 and not #2), and (either #3 or #4). As it stands, any packet that gets through L2 that doesn't violate the case-specific restrictions outlined by #3 and #4 will get passed to the upper layers, if I'm reading this right. |
The "is this packet for us?" filter in net_ipv4_input() has a minor logic error which fails to discard many packets which are.. not for us. Fixes: #14647 Signed-off-by: Charles E. Youse <[email protected]>
e82769c works, no more bogus ICMP replies |
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.
Thanks Charles!
The "is this packet for us?" filter in net_ipv4_input() has a minor
logic error which fails to discard many packets which are.. not for us.
Fixes: #14647
Signed-off-by: Charles E. Youse [email protected]