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

Add IP medium support, part 2 #401

Merged
merged 5 commits into from
Mar 31, 2021
Merged

Add IP medium support, part 2 #401

merged 5 commits into from
Mar 31, 2021

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Dec 27, 2020

Previously #336 #346. includes #399, review that one first

TODO:

  • Add a way for examples to use TAP or TUN. For example with --tap / -- tun. Not sure how to do this because Device is not object-safe.
  • Prettyprinter doesn't work
  • pcap doesn't work

@Dirbaio Dirbaio force-pushed the medium-ip-part2 branch 4 times, most recently from c70eadc to 0a6c281 Compare January 9, 2021 01:21
@Dirbaio Dirbaio mentioned this pull request Mar 10, 2021
4 tasks
@Dirbaio Dirbaio force-pushed the medium-ip-part2 branch 3 times, most recently from 691469d to 38276fa Compare March 24, 2021 23:21
@Dirbaio Dirbaio marked this pull request as ready for review March 24, 2021 23:22
@Dirbaio Dirbaio force-pushed the medium-ip-part2 branch 2 times, most recently from 91f08a2 to 56d70a8 Compare March 25, 2021 00:13
@Dirbaio
Copy link
Member Author

Dirbaio commented Mar 25, 2021

  • Changed tun/tap code so there's now a single TunTapDevice instead of TapDevice and TunDevice. Less code duplication, nicer for code that wants to use both.
  • Added --tun and --tap options to examples so they can use either.
  • Updated PcapWriter to write the right LinkType based on the medium.
  • Updated Tracer to prettyprint with the right type based on the medium.

@whitequark this is ready to go :)

This is now stuck with 22 pending tests that will never happen because the Cargo features have been renamed... Best solution is to probably tweak repo settings to mark the new checks as required, then merge..?

- Add `medium` in `DeviceCapabilities`.
- Rename EthernetInterface to Interface.
- Add support to Interface for both Ethernet and IP mediums. The medium to use is detected from `device.capabilities().medium`.
- Ethernet-only features are gated behind the "ethernet" feature, as before.
- IP features are always enabled for now.
DeviceCapabilities contains the `medium` field, so tests had to give it a value
even if it was unused. This is impossible to do with no `medium-*` enabled, because
it makes `Medium` uninhabited (empty enum).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant