Make network interface configurable and auto-detect if not specified #10
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.
This change removes the hardcoded eth0 network interface and adds support for either:
Passing a custom interface name via an environment variable (INTERFACE), or
Automatically detecting the first active non-loopback network interface if INTERFACE is not set.
Why this change?
On many modern Linux distributions (e.g., Arch/Manjaro), Ethernet interfaces are not named eth0 but instead follow a predictable naming scheme like enp0s31f6. The previous hardcoded approach caused the container to fail on those systems with errors like "Cannot find interface with name of 'eth0'".
This update ensures PPPwn works across all Linux distributions without manual changes.
What was changed:
Added INTERFACE as an environment variable (still defaults to eth0 if provided).
Updated start.sh to auto-detect the first active non-loopback interface when INTERFACE is not set.
Improved logging to show which interface is being used.
Maintains backward compatibility: users can still manually set INTERFACE with -e INTERFACE= when running the container.
How to test:
Run the container without INTERFACE set:
docker run --rm --net=host --privileged pppwn
It should auto-detect the active interface.
Run with a specific interface:
docker run --rm --net=host --privileged -e INTERFACE=enp0s31f6 pppwn
It should use the provided interface.
This makes the Docker setup much more portable and user-friendly.