supports all ports when target_port is 0 #409
Merged
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.
当使用pcapng模式时,如果
--port
参数为0,则支持所有端口的网络包捕获。否则则只捕获--port
对应的端口数据。默认是443
端口。--port
默认没有捕获所有网络包,是因为有很多场景,主机的网络流量很大,eBPF的map写入太快,用户空间消费过慢,导致丢包的问题。虽然用户空间在创建eBPF map时,已经申请了BufferSizeOfEbpfMap
大的内存,但仍然还存在网络包过多导致数据丢失的可能。 而且,在Android上有内存大小限制,BufferSizeOfEbpfMap
的值仅为1024
。When using pcapng mode, if the
--port
parameter is set to 0, it supports capturing network packets from all ports. Otherwise, it only captures data from the port corresponding to--port
. The default port is 443.The reason why
--port
does not capture all network packets by default is that in many scenarios, the host's network traffic is high and eBPF map writes too fast while user space consumption is slow, resulting in packet loss issues. Although user space has already allocated memory of sizeBufferSizeOfEbpfMap
when creating eBPF map, there still exists a problem of data loss due to excessive network packets. Moreover, on Android, there are memory size limitations and the value ofBufferSizeOfEbpfMap
is only 1024.