Skip to content

[WIP] Implement basic managed ethernet switch with mac learning and vlan support#62

Open
Kilobyte22 wants to merge 6 commits into
fnuecke:1.18-forgefrom
Paranoidlabs:feature/eth-switch
Open

[WIP] Implement basic managed ethernet switch with mac learning and vlan support#62
Kilobyte22 wants to merge 6 commits into
fnuecke:1.18-forgefrom
Paranoidlabs:feature/eth-switch

Conversation

@Kilobyte22

Copy link
Copy Markdown

This implements an Ethernet Switch. It has been laying around for weeks without any work done, but is mostly working. I've just now rebased it ontop the current 1.16.5. It does compile, but i have not tested it since.

Features:

  • Shows up as a component for configuration
  • Learns MAC Addresses and therefore doen't need to flood every packet
  • Somewhat tested in order to give routers two interfaces (using two VLANs)
  • includes a small script in the plan9fs to configure the switch
  • default configuration is a dumb switch which just passes all VLANs through but does support mac learning

Missing:

  • Graphics
  • The configuration script is very shitty and doesn't support all features of the "hardware"

@fnuecke

fnuecke commented Aug 23, 2021

Copy link
Copy Markdown
Owner

Very cool, thanks! Will have a closer look as soon as possible. And I'll see about making a custom model.


// Keep Mac Address entries for 2 Real Life Minutes
private final long HOST_TTL = 20 * 60 * 2;
private final Map<Long, HostEntry> hostTable = new HashMap<>();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably make this a Long2ObjectMap to avoid the boxing of the key; I can do that after the merge though. Long2ObjectArrayMap would probably be sufficient with the number of devices I'd expect on such a network?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure on the performance characteristics, but i think a realistic number would be < 50. Fairly sure thats good enough.

@fnuecke fnuecke added the enhancement New feature or request label Aug 23, 2021
@Kilobyte22

Copy link
Copy Markdown
Author

I do probably want to add some improvements going forward, but since it should be working right now, I can just add them at a later stage. After all the entire Mod is currently mostly a prototype.

@Kilobyte22 Kilobyte22 force-pushed the feature/eth-switch branch 2 times, most recently from 184f4e6 to 449021e Compare January 29, 2022 20:39
@Kilobyte22

Copy link
Copy Markdown
Author

I believe i ruined things with git magic during a rebase. I'll see about sorting that out at some point

@Kilobyte22 Kilobyte22 changed the base branch from 1.16-forge to 1.18-forge January 29, 2022 21:38
@Kilobyte22

Copy link
Copy Markdown
Author

This PR should now be at the same state as when it was originally created. I still want to make a few modifications before this gets merged. In particular i want to change the management channel to in-band, which would in theory make it possible to write a linux kernel driver with DSA support.

@Kilobyte22

Kilobyte22 commented Feb 18, 2022

Copy link
Copy Markdown
Author

I'm having issues with the switch not showing up as a hardware component. It seems it didn't work since i rebased it to 1.18. Other blocks (redstone, projector etc) are detected just fine. Do you have any idea what i'm doing wrong?

@fnuecke

fnuecke commented Feb 22, 2022

Copy link
Copy Markdown
Owner

Thanks for the reminder in Discord; will try to have a look soon!

@fnuecke

fnuecke commented Feb 27, 2022

Copy link
Copy Markdown
Owner

Think I found it, the switch block currently returns a network hub tile-entity, and that one doesn't have callbacks.

@samuelh2005

Copy link
Copy Markdown

@Kilobyte22 I would like to use this switch, but I cant seem to configure it to forward packets. I enabled trunking on all ports, but that does nothing. The ping is not getting through.

@Kilobyte22

Copy link
Copy Markdown
Author

do you mind posting a screenshot of your config and your host table?

@samuelh2005

Copy link
Copy Markdown

Can you tell me where to find them?

@samuelh2005

Copy link
Copy Markdown

2022-06-16_13 09 11

Is this one of them?

@samuelh2005

Copy link
Copy Markdown

2022-06-16_13 12 29

Is this the other?

@Kilobyte22

Copy link
Copy Markdown
Author

https://github.com/Paranoidlabs/oc2/blob/d38e683abbc6815715cc67398a05d9a2e9ca4b3c/src/main/scripts/bin/swconfig.lua you can this script (it should be available on your computer somewhere in /mnt i believe) to dump both of them.

@samuelh2005

Copy link
Copy Markdown

I did use that script to enable trunking on all ports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants