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

router: add option to include custom routes in RA #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dbnk0
Copy link

@dbnk0 dbnk0 commented Oct 12, 2024

Introduces new configuration option ra_staticroute for adding custom route(s) in route advertisement (RA) messages when no default route is advertised.

This is useful when, for example, end devices are given only ULA IPv6 addresses (e.g. from fc00:0:100::/48), but one still needs inter subnet communication to e.g. fc00:0:200::/48. Currently, this wouldn't be possible without static route on each end device as the odhcpd server doesn't present itself as default router and no route information is given except for local ULA subnet (fc00:0:100::/48).

New configuration option ra_staticroute makes it possible to advertise arbitrary routes to the end devices and thus making correct routing possible even when no default route (or public IPv6 prefix) is available.

Option ra_staticroute exists under both odhcpd section and interfaces' sections. Latter sets up interface-specific routes. Routes configured under odhcpd are global and advertised for all interfaces (including those with interface-specific static routes).

Config example:

config odhcpd 'odhcpd'
	...
	list ra_staticroute 'fc00:10::/32'
	list ra_staticroute 'fc00:20::/32'

config dhcp 'lan'
	...
	list ra_staticroute 'fd50:60:70::/48'

Fixes: #74 and possibly helps with #152

@systemcrash
Copy link
Contributor

I think this is a good option to have.

@DavidB137 please fix the conflicts.

dbnk0 added a commit to dbnk0/odhcpd that referenced this pull request Feb 3, 2025
Resolves merge conflicts in pull request openwrt#224.

Signed-off-by: Dávid Benko <[email protected]>
@dbnk0 dbnk0 force-pushed the master branch 2 times, most recently from d52aee0 to b8f6ff0 Compare February 3, 2025 18:35
@dbnk0 dbnk0 closed this Feb 3, 2025
@dbnk0 dbnk0 reopened this Feb 3, 2025
@dbnk0
Copy link
Author

dbnk0 commented Feb 3, 2025

Sorry, I messed up quite a bit when resolving the conflicts. At first, I used spaces instead of tabs for indentation and then tried to fix it (unsuccessfully). So I instead synced my fork with upstream and reapplied the changes which should also make the history cleaner as there's no merge commit. Once again, sorry for the confusion.

@systemcrash Hopefully you can merge now.

@systemcrash
Copy link
Contributor

I wonder whether it'd be better to call them list ra_customroute or list ra_staticroute instead? Add is a verb which might suggest something else than what they are for. What do you think @dbnk0 ?

Introduces new configuration option `ra_staticroute` for adding custom
route(s) in route advertisement (RA) messages when no default route is
advertised.

This is useful when, for example, end devices are given only ULA IPv6
addresses (e.g. from fc00:0:100::/48), but one still needs inter subnet
communication to e.g. fc00:0:200::/48. Currently, this wouldn't be
possible without static route on each end device as the odhcpd server
doesn't present itself as default router and no route information is
given except for local ULA subnet (fc00:0:100::/48).

New configuration option `ra_staticroute` makes it possible to advertise
arbitrary routes to the end devices and thus making correct routing
possible even when no default route (or public IPv6 prefix) is available.

Option `ra_staticroute` exists under both `odhcpd` section and interfaces'
sections. Latter sets up interface-specific routes. Routes configured
under `odhcpd` are global and advertised for all interfaces (including
those with interface-specific static routes).

Config example:

config odhcpd 'odhcpd'
	...
	list ra_staticroute 'fc00:10::/32'
	list ra_staticroute 'fc00:20::/32'

config dhcp 'lan'
	...
	list ra_staticroute 'fd50:60:70::/48'

Fixes: openwrt#74

Signed-off-by: Dávid Benko <[email protected]>
@dbnk0
Copy link
Author

dbnk0 commented Mar 24, 2025

I completely agree with you, list ra_staticroute seems like the best option to me.

I renamed everything, did some refactoring, removed unnecessary dynamic memory allocation and improved error handling.
In case you want to review rename and everything else individually, these are the commits: f1ee9c6, 4fec3c8, 8b8b1cc, af20724.

I squashed everything together now.

@systemcrash Let me know if you want to change anything else.

@systemcrash
Copy link
Contributor

This still looks great - more readable now. Could you update your initial post example please?

@dbnk0
Copy link
Author

dbnk0 commented Mar 25, 2025

Updated

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.

Support adding static router advertisments
2 participants