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

Support specifying a default route #2033

Closed
wants to merge 5 commits into from

Conversation

mbirtwell
Copy link
Contributor

ARTIQ Pull Request

Description of Changes

Add support for setting the default route/gateway for core devices. If DHCP is enabled it uses the default route from the DHCP response if present. Or it can be set in the config file with the key "ipv4_default_route". Additionally the subnet mask can be specified by appending a prefix length to the ip address configuration in CIDR format.

Related Issue

Closes #1930

Type of Changes

Type
✨ New feature

Steps (Choose relevant, delete irrelevant before submitting)

All Pull Requests

  • Use correct spelling and grammar.
  • Update RELEASE_NOTES.rst if there are noteworthy changes, especially if there are changes to existing APIs.
  • Close/update issues.
  • Check the copyright situation of your changes and sign off your patches (git commit --signoff, see copyright).

Code Changes

  • Run flake8 to check code style (follow PEP-8 style). flake8 has issues with parsing Migen/gateware code, ignore as necessary.
  • Test your changes or have someone test them. Mention what was tested and how.
  • Add and check docstrings and comments
  • Check, test, and update the unittests in /artiq/test/ or gateware simulations in /artiq/gateware/test

Documentation Changes

  • Check, test, and update the documentation in doc/. Build documentation (cd doc/manual/; make html) to ensure no errors.

Git Logistics

  • Split your contribution into logically separate changes (git rebase --interactive). Merge/squash/fixup commits that just fix or amend previous commits. Remove unintended changes & cleanup. See tutorial.
  • Write short & meaningful commit messages. Review each commit for messages (git show). Format:
    topic: description. < 50 characters total.
    
    Longer description. < 70 characters per line
    

Licensing

See copyright & licensing for more info.
ARTIQ files that do not contain a license header are copyrighted by M-Labs Limited and are licensed under LGPLv3+.

New config option "ipv4_default_route", which sets a static default route.
Support passing a CIDR as ip, e.g. ip = "192.168.1.2/24" the prefix defaults
to 0 same as before.
If ip mode is use dhcp, then get the default route from the DHCP config.
Need to set the prefix length of unspecified IP addresses to be 32 so that
they don't appear to be in the same subnet as valid IPs
@sbourdeauducq
Copy link
Member

What about the default IPv6 route?

@mbirtwell
Copy link
Contributor Author

What about the default IPv6 route?

IPv6 isn't completely analogous to IPv4 in this respect. In particular IPv6 includes router discovery natively in the protocol using router advertisement and router solicitation messages. It would be interesting to talk to someone using IPv6 to see what feature they actually want here. As someone who's not used IPv6 it's not obvious to me.

@sbourdeauducq
Copy link
Member

While not an expert on it, I'm using IPv6 and use either static default route or router discovery depending on the situation. I don't think router discovery is very different from the DHCP-configured IPv4 routes, and just like DHCP it requires the routers to run specific application software (radvd, dnsmasq, etc.).

For the device, router discovery is probably going to be fine in many situations, but does the firmware support it? If not, adding a static config option is probably easier, consistent with the v4 settings, and also applicable to situation where routers don't advertise.

@thomasfire
Copy link
Contributor

I tested this PR with dedicated subnet with port forwarding setuped for Kasli, and tried to access the coremgmt from outer network. On release-7 it works, on master and this PR - no.

@mbirtwell
Copy link
Contributor Author

@thomasfire I've just commented some instructions to try and reproduce my test setup. I'm not sure what you mean by port forwarding that sounds a bit like you've mapped a specific port from a public IP to a private IP like static or reverse NAT. If so I think that's quite different from what's going on here although I don't know why that wouldn't work normally in NAT like scenarios the traffic appears to come from the local network.

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.

Cannot access coredevice across subnets after DHCP feature merge
3 participants