10000 proposal: multiple ports, pcap options and isolating capture package · Issue #784 · buger/goreplay · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

proposal: multiple ports, pcap options and isolating capture package #784

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

Closed
urbanishimwe opened this issue Jul 3, 2020 · 2 comments · Fixed by #797
Closed

proposal: multiple ports, pcap options and isolating capture package #784

urbanishimwe opened this issue Jul 3, 2020 · 2 comments · Fixed by #797
Assignees
Labels
enhancement New feature or feature request

Comments

@urbanishimwe
Copy link
Collaborator
urbanishimwe commented Jul 3, 2020

PCAP Options to improve

  • snapshot length: we have only two possibilities, if input-raw-override-snaplen is false the maximum transmission unit of an interface will become its handler snapshot length otherwise the snapshot length is set to 64kb which may be problematic to some interface like USB with snapshot length of up to 256kb. the user may also wish to have a smaller snapshot to only capture headers. for this, input-raw-snaplen ** can be an unsigned 32-bit integer** which indicates the snapshot length. if its 0, the snapshot will be the MTU (or 64kb if we can't get the MTU) else the snapshot will be equal to input-raw-snaplen flag.

  • promiscuous, monitor mode: should also be opt-in, this is to say they will not be enabled unless enabled by the user. for this, we need to add a new flag called --enable-promiscuous and --enable-monitor flag.

  • input raw expires: currently flag input-raw-expire has two functions, to set the maximum time to wait for the final packet in TCP and to set the timeout of a pcap handler. However, the behaviors of pcap timeout shouldn't be confused by the time we wait for the final packet otherwise there can be some unexpected behaviors like losing large amount of packets and it's likely that there will be only a single read for the entire message. For this, we can have two separate flags input-raw-message-expire and input-raw-buffer-expire. the default value of input-raw-buffer-expire is a negative time!

Isolating capture package

for the sake of scalability, future improvements, and supporting people who may wish to implement their own sniffer, we can isolate the functionalities of capturing. this is to say package capture will solely be responsible for handling the functionalities of reading packets and it will send data of type gopacket.Packet over channels. there will be other packages like tcp to handle re-ordering of packets and managing lost packets, this may help users to implement other transport layer protocols. However, Listener will have a field that indicates the transport layer expected(this will help us to set default BPFFilter so that listener can capture packet from one type of transport layer). Some other functionalities may be isolated into packages too, like output, input etc...

Multiple ports

pcap may listen to multiple ports when port is 0. range of ports can be configured by using BPF filters e.g: dst portrange 3000-8000 and src portrange 3000-8000. packets handling will be possible but how messages will be handled by the output, in this case, is not yet defined!

@buger
Copy link
Owner
buger commented Jul 3, 2020

it almost feels like that Pcap capability should be extracted from the raw-input itself, and act like a singleton. So multiple input raw plugins communicate with it via some interface.

@urbanishimwe
Copy link
Collaborator Author

About snap-shot, I realized it may require a lot of configurations to handle larger snapshot length since the normal packet length doesn't exceed 64kb, to limit the amount of data, max-message-size can be used.

@urbanishimwe urbanishimwe self-assigned this Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0