Skip to content

linux: use poll api instead of select inorder to support fd > 1024. Fixes #612 and #639#681

Merged
mrmonday merged 1 commit intolibpnet:mainfrom
ionosnetworks:feat/linux-poll-api
May 30, 2024
Merged

linux: use poll api instead of select inorder to support fd > 1024. Fixes #612 and #639#681
mrmonday merged 1 commit intolibpnet:mainfrom
ionosnetworks:feat/linux-poll-api

Conversation

@nemosupremo
Copy link
Copy Markdown
Contributor

This PR replaces the usage of select with poll on linux. select has a limitation that the number of descriptors and the actual descriptor value must be lower than FD_SETSIZE which is 1024[1]. The number of descriptor isn't an issue, however if a socket is created that has an FD that is greater than 1024, this will cause libc::FD_SET to panic.

To fix this, instead of using select, we can use poll. poll does not have this limitation. This PR replaces libc::pselect with libc::poll

This fixes #612 and #639.

[1] https://linux-tips.com/t/is-it-possible-to-listen-file-descriptor-greater-than-1024-with-select/45

@mrmonday mrmonday merged commit 49c8c68 into libpnet:main May 30, 2024
@mrmonday
Copy link
Copy Markdown
Contributor

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panicked at 'index out of bounds When using pnet_datalink to send arp request

2 participants