Skip to content
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

Linux-Only Interface, Marking, and IP Unit Tests #488

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

flu0r1ne
Copy link
Contributor

@flu0r1ne flu0r1ne commented Oct 2, 2023

This commit introduces three unit tests focused on interface binding, packet marking, and IP source address spoofing/selection. Each of these tests builds upon the original MtrPacketTest base class. To evaluate these network-dependent features, the tests utilize an emulated network environment. To enable this, a small network emulation library, netem, has been developed specifically for this purpose. netem allows for the creation of arbitrary network configurations for testing and can reliably set up and clean up virtual network environments on Linux systems. The only dependencies are iproute2 and libc, which are generally pre-installed on most Linux hosts.

The commit adds three tests that are expected to fail (see #485):

  1. Interface Binding: Evaluates the capability of mtr-packet to bind to a specific interface.
  2. Packet Marking: Assesses the ability of mtr-packet to apply a Linux networking mark (fwmark).
  3. Source Address Selection: Tests mtr-packet's ability to spoof or bind to a specified source address.

This commit introduces three unit tests focused on interface binding,
packet marking, and IP source address spoofing/selection. Each of these
tests builds upon the original `MtrPacketTest` base class. To evaluate
these network-dependent features, the tests utilize an emulated network
environment. To enable this, a small network emulation library, `netem`,
has been developed specifically for this purpose. `Netem` allows for the
creation of arbitrary network configurations for testing and can reliably
set up and clean up virtual network environments on Linux systems. The only
dependencies are `iproute2` and `libc`, which are generally pre-installed
on most Linux hosts.

The commit adds three tests that are expected to fail:

1. Interface Binding: Evaluates the capability of `mtr-packet` to bind to
   a specific interface.
2. Packet Marking: Assesses the ability of `mtr-packet` to apply a Linux
   networking mark (fwmark).
3. Source Address Selection: Tests `mtr-packet`'s ability to spoof or bind
   to a specified source address.
@rewolff
Copy link
Collaborator

rewolff commented Oct 2, 2023

The netem seems to fail LINT checks. Please look into that.

You should've said: They "expected to fail" issues are issues that should be in progress of being fixed, but these tests actually detect that the issue is still present.

@flu0r1ne
Copy link
Contributor Author

flu0r1ne commented Oct 2, 2023

I will investigate the linting issues. Thank you for bringing them to my attention.

You are correct, I intended for them to fail with the main branch to demonstrate the issues. Fixes for some of these issues are currently underway.

@rewolff
Copy link
Collaborator

rewolff commented Oct 2, 2023

OK. great.
I think that now that I've approved running of the tests once for your pull requests, in the future they will run automatically, so that you don't have to wait for me to be awake.

- Remove unused imports
- Search for ip executables in known locations
- Fix f-string
- Ignore assert warnings
@flu0r1ne
Copy link
Contributor Author

flu0r1ne commented Oct 3, 2023

I believe I've resolved the linting issues; my local version of flake8 is no longer reporting any errors. However, it seems that the CI pipeline is not triggered when I push changes.

@rewolff rewolff merged commit 4b11182 into traviscross:master Oct 3, 2023
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