-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Restore sndrcv behaviour from before 53afe84 #4538
base: master
Are you sure you want to change the base?
Conversation
Aims to fix #4531 |
Thanks a lot for figuring this out, this is great work ! |
I was trying, if this would immediately fix the unit tests. But my next guess is, that we may need to remove the daemon flag of the send thread.
--
Mit freundlichen Grüßen
Dr. Nils Weiß
dissecto GmbH
Franz-Mayer-Str. 1
93053 Regensburg
________________________________
From: gpotter2 ***@***.***>
Sent: Sunday, September 22, 2024 2:48:59 PM
To: secdev/scapy ***@***.***>
Cc: Dr. Nils Weiß ***@***.***>; Author ***@***.***>
Subject: Re: [secdev/scapy] Restore sndrcv behaviour from before 53afe84 (PR #4538)
@gpotter2 commented on this pull request.
________________________________
In scapy/sendrecv.py<#4538 (comment)>:
@@ -357,6 +357,7 @@ def sndrcv(*args, **kwargs):
WARNING: This is an internal function. Using sr/srp/sr1/srp is
more appropriate in many cases.
"""
+ kwargs['threaded'] = kwargs.pop('threaded', True) or True
Why this commit?
—
Reply to this email directly, view it on GitHub<#4538 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAMZGFZ4CDPX6JVXG3VMTWDZX24DXAVCNFSM6AAAAABOUIRDESVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMRQHA2DQMRSG4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
450d941
to
56e82b2
Compare
@@ -323,9 +330,7 @@ def _process_packet(self, r): | |||
self.noans += 1 | |||
sentpkt._answered = 1 | |||
break | |||
if self._send_done and self.noans >= self.notans and not self.multi: |
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.
To explain this code can be reached before the sending thread exists (because of the new time.sleep) in which case the sniffer is never closed
f4e06ce
to
9e5d6e6
Compare
Seems to really be failing on the |
# In threaded mode, timeout. | ||
if self.threaded and self.timeout is not None and not self.breakout: | ||
t = time.monotonic() + self.timeout | ||
while time.monotonic() < t: |
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.
And while we're at it, this code is disgusting and has terrible perfs. Should have used a lock or something, so I just did that.
Try to get it debug as soon as possible |
Could I get #4533 merged before I start debugging? |
Sure thing ! |
6a5faf5
to
65100e7
Compare
a05c650
to
1b12525
Compare
This PR rolls back the internal behaviour of sndrcv from before 53afe84
Two major changes happend in 53afe84
inter
is only forwarded totime.sleep
if it is not0
. However, callingtime.sleep(0)
gives the python threading system the possibility to do a context switch.sr
was always executed inthreaded
mode.