Repository navigation
fix(vrouter): preserve configured router hostnames - #347
Conversation
|
The question - why are those changes made (vyos, vyatta, minirouter requirements)? If these are requirements they should be added to the schema, validated at configure time. |
The vrouter app wrote router hostnames into VyOS and Vyatta configs through Node.RouterName(), which lowercased the name and replaced "." and "_" with "-". The guest hostname then differed from the minimega VM name, so exact-match lookups such as `cc filter hostname=` missed routers. Firewall nodes, rendered from the same template, were never rewritten. Vyatta and every VyOS release accept uppercase letters and dots in `system host-name` and never lowercase it; only underscores are rejected. The topology schema has rejected "_" and "." in node hostnames since 65f8e83. Remove RouterName() and render the hostname as written, as the Linux and Windows startup scripts already do. Fixes sandialabs#335 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
818cb3a to
4494bdd
Compare
|
@nblair2 Vyatta and every VyOS release validate That regex also needs at least 2 characters, and Windows DNS host names have the same minimum, so #429 raises the schema's hostname minimum from 1 to 2 (docs: sandialabs/sceptre-phenix-docs#70). sandialabs/sceptre-phenix-apps#148 replaces the apps test fixture that modeled the old rewrite. One caveat: a config created with |
|
makes sense to me, just need to fix the changelog conflict |
|
@cmulk resolved |
Description
tl;dr: remove special handling for router hostnames, set them exactly as defined in topology
Previously
Node.RouterName()lowercased router hostnames and replaced.and_with-. That made the guest hostname differ from the minimega VM name, so exact-match lookups such ascc filter hostname=missed routers. This special handling is no longer necessary with the hostname validation added in #268Background
Why the rewrite existed, and why it's safe to remove:
RouterName()was added with the original Vyatta app in f7c9d35 (2020). No commit says why. Its only caller issystem host-nameinvyatta.tmpl. Minirouter never used it, and the startup app skips routers.host-nameagainst[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9](max 63) and never lowercase it. Uppercase letters and dots are accepted. Only_is rejected._and.in hostnames since 65f8e83, so the./_rewrite only mattered for configs that skipped validation.RouterName()never rewrote their hostnames.Changes
RouterName()from the v0 and v1Nodetypes.vyatta.tmplnow uses$node.General.Hostname, like the Linux and Windows startup templates.config.bootwith a mixed-case hostname.Related Issues/PRs
Type of Change
fix)feat)docs)refactor)chore)Checklist
Testing
Tested with an experiment with a VyOS router, tweaking the hostname a few times:
router,ROUTER1,ROUTER-123.Additional Notes
A config created with
--skip-validation, or stored before 65f8e83, that has_in a router hostname will now have VyOS reject the host-name line instead of getting-in its place. Renaming the node fixes it.🤖 Generated with Claude Code