Skip to content

Switch from PF_INET to AF_PACKET #8

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

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

johnny-mnemonic
Copy link
Contributor

This patch set switches the "networking" functionality of Ski from using PF_INET to using AF_PACKET instead. Running a Ski instance with this patch set applied will no longer cause the host kernel to print bski uses obsolete (PF_INET,SOCK_PACKET) to the system console.

The change also solves the issue that came with the use of the sockaddr.sa_data array for "storing" the interface's name which can be up to 16 characters long (incl. binary zero) but sa_data has only room for 14 characters and is also not meant for storage according to bind(2). E.g. before this change I had to shorten the long interface name of my USB2Ethernet adapter (which included its MAC address) to eth4000000013 to make it usable for Ski.

I didn't observe any regressions when comparing operation of Ski at 71cdaba compared to Ski with this patch set applied and testing network related stuff (like using telnet or nc to execute commands in Ski, or mounting an NFS share and write/read/copy files there).

In addition this patch set also includes:

  • typo and whitespace fixes
  • and the addition of adapted code (from Linux's ifenslave) to bring up the selected network interface on the host for use by Ski before using it in Ski. During testing, this was a required prerequisite for successful operation (both for PF_INET and AF_PACKET cases, see commit message for respective behavior w/o doing this).

* otherwise Ski crashes on first console input (w/PF_INET) or
* the selected interface cannot be used inside Ski (w/AF_PACKET).
@trofi trofi merged commit 7b7466e into trofi:master Feb 12, 2025
1 check passed
@trofi
Copy link
Owner

trofi commented Feb 12, 2025

Looks great! Merged as is.

Thank you!

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