Skip to content

datalink(linux): add feature to pass the fd (socket) to ::channel()#584

Merged
mrmonday merged 1 commit intolibpnet:mainfrom
Martichou:raw_socket
May 30, 2024
Merged

datalink(linux): add feature to pass the fd (socket) to ::channel()#584
mrmonday merged 1 commit intolibpnet:mainfrom
Martichou:raw_socket

Conversation

@Martichou
Copy link
Copy Markdown

This can be useful if the caller want to manipulate the socket differently at creating.
For example setting a BPF filter on the socket before passing it in the channel:

datalink::linux::channel(interface, config, socket_fd)

Signed-off-by: Martin Andre martin.andre@tessares.net

@Martichou
Copy link
Copy Markdown
Author

Hey @mrmonday , sorry for the very very late reply and update on this. Just came back to this and still think this can be helpful to have in the lib.

The tests failing seems to not be linked with the change, can they be ignored? Or any idea?

@mrmonday
Copy link
Copy Markdown
Contributor

I've just rebased this. There are a couple of white space issues but if CI passes I'll fix that and get this merged in.

This can be useful if the caller want to manipulate the
socket differently at creating. For example setting a
BPF filter on the socket before passing it in the channel:

```
datalink::linux::channel(interface, config, socket_fd)
```

Signed-off-by: Martin Andre <martin.andre@tessares.net>
@mrmonday
Copy link
Copy Markdown
Contributor

Thanks! Sorry this took so long.

@mrmonday mrmonday merged commit 14a01ff into libpnet:main May 30, 2024
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.

2 participants