Skip to content

Conversation

@gpotter2
Copy link
Member

@gpotter2 gpotter2 commented Jul 27, 2024

Currently you can send() on multiple interfaces, but not sr().

This PR:

  • fixes sr on multiple interfaces by allowing L3socket* to recursively spawn sockets on other interfaces if necessary
  • fixes sending on tun-like interfaces through libpcap

@codecov
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

Attention: Patch coverage is 67.39130% with 30 lines in your changes missing coverage. Please review.

Project coverage is 81.67%. Comparing base (420173c) to head (0f68903).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4474      +/-   ##
==========================================
- Coverage   81.68%   81.67%   -0.01%     
==========================================
  Files         355      355              
  Lines       84706    84754      +48     
==========================================
+ Hits        69190    69225      +35     
- Misses      15516    15529      +13     
Files Coverage Δ
scapy/layers/inet6.py 88.47% <100.00%> (+<0.01%) ⬆️
scapy/sendrecv.py 87.21% <100.00%> (ø)
scapy/arch/libpcap.py 76.92% <82.35%> (+0.86%) ⬆️
scapy/arch/linux/__init__.py 83.45% <84.21%> (-0.56%) ⬇️
scapy/arch/bpf/supersocket.py 0.00% <0.00%> (ø)

... and 4 files with indirect coverage changes

@gpotter2 gpotter2 force-pushed the sr-multi-ifaces branch 3 times, most recently from 6cfa194 to 1faafa8 Compare July 27, 2024 14:02
Copy link
Member

@guedou guedou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool PR! I did not test it but it looks good.

raise

@staticmethod
def select(sockets, remain=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use a generic select()method instead of duplicating it in all sockets?

Copy link
Member Author

@gpotter2 gpotter2 Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if that's clearer, considering the types change in each function.
We would also require a dependency to another L3Socket or something, and I think sockets are already abstracted enough

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A classmethod could do the trick. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like a LOT of refactoring work that I honnestly don't really want to do :(

@gpotter2 gpotter2 mentioned this pull request Jul 29, 2024
@gpotter2 gpotter2 changed the title Fix sr() on multiple interfaces Fix sr() on multiple interfaces and libpcap L3 sockets Jul 29, 2024
@gpotter2 gpotter2 added this to the 2.6.0 milestone Jul 29, 2024
@guedou
Copy link
Member

guedou commented Jul 30, 2024 via email

@gpotter2
Copy link
Member Author

You are right though. How about we let it pass today, but I promise I'll come back to it eventually, or whenever we touch it again :)

@gpotter2 gpotter2 merged commit 891e44d into secdev:master Jul 30, 2024
@gpotter2 gpotter2 deleted the sr-multi-ifaces branch July 30, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants