Skip to content

build(nix): Wrap vtysh so it loads the gateway's commands - #1704

Open
daniel-noland wants to merge 1 commit into
mainfrom
pr/daniel-noland/vtysh-extension-wrapper
Open

build(nix): Wrap vtysh so it loads the gateway's commands#1704
daniel-noland wants to merge 1 commit into
mainfrom
pr/daniel-noland/vtysh-extension-wrapper

Conversation

@daniel-noland

@daniel-noland daniel-noland commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Addresses the goal of issue #1674, by a different route than the one the issue proposes.

Our FRR fork teaches vtysh a -X <path> flag that dlopen()s an extension, and the commands the gateway adds live in one such extension, libvtysh_hedgehog.so. Nobody passes the flag today, so those commands are absent unless whoever is typing knows to ask.

Why a wrapper rather than an alias

An alias only reaches callers that read a shell rc, and the two that matter most do not: kubectl exec and docker exec start no login shell. The shortcut would be missing in exactly the session someone opened to work out what a running gateway is doing.

@daniel-noland daniel-noland added the dont-merge Do not merge this Pull Request label Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

FRR packaging now accepts optional vtysh extension libraries. The dataplane overlay enables extension loading, while the host build uses upstream FRR without extensions. Enabled builds wrap vtysh with -X arguments.

FRR vtysh extension support

Layer / File(s) Summary
FRR package extension wrapping
nix/pkgs/frr/default.nix
The package conditionally adds makeWrapper, accepts extension library paths, removes the extension patch, and wraps vtysh with -X arguments when enabled.
Overlay build wiring
nix/overlays/frr.nix
frr-build forwards the extension option. The dataplane build enables it, and the host build disables it.

Suggested reviewers: copilot, frostman

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes wrapping vtysh to load the gateway commands.
Description check ✅ Passed The description explains the vtysh extension wrapper and its purpose for kubectl exec and docker exec sessions.

Comment @coderabbitai help to get the list of available commands.

Wrap vtysh in our FRR fork so every invocation loads the Hedgehog extension, including sessions started through kubectl exec and docker exec.

Set up the wrapper after nuke-refs and use the plugin's runtime image path to avoid a dependency cycle. Upstream FRR remains unchanged because it does not support -X.

Also remove the obsolete extension patch reference; the loader already lives in the fork.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/vtysh-extension-wrapper branch from 09025de to c1f8579 Compare August 7, 2026 03:23
@daniel-noland daniel-noland linked an issue Aug 7, 2026 that may be closed by this pull request
@daniel-noland
daniel-noland requested a review from Copilot August 7, 2026 03:25
@daniel-noland daniel-noland self-assigned this Aug 7, 2026
@daniel-noland
daniel-noland requested a review from Frostman August 7, 2026 03:25
@daniel-noland daniel-noland removed the dont-merge Do not merge this Pull Request label Aug 7, 2026
@daniel-noland
daniel-noland marked this pull request as ready for review August 7, 2026 03:25
@daniel-noland
daniel-noland requested a review from a team as a code owner August 7, 2026 03:25
@daniel-noland
daniel-noland requested review from Fredi-raspall and removed request for a team August 7, 2026 03:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Nix packaging for FRR to ensure vtysh automatically loads the gateway’s custom command extension (libvtysh_hedgehog.so) when building the dataplane FRR fork, avoiding reliance on shell aliases that don’t apply to kubectl exec / docker exec.

Changes:

  • Add optional makeWrapper support and a postFixup wrapper that injects -X <extension> flags into vtysh when vtysh-extensions = true.
  • Introduce configurable vtysh-extension-libs (defaulting to /lib/libvtysh_hedgehog.so) as image-path targets to avoid Nix-store dependency cycles.
  • Adjust the FRR overlay to enable the wrapper only for frr.dataplane (fork), leaving frr.host (upstream) unwrapped.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
nix/pkgs/frr/default.nix Adds optional wrapping of vtysh in postFixup to auto-load configured extension libraries.
nix/overlays/frr.nix Enables the wrapper only for the dataplane FRR fork and keeps upstream host FRR unchanged.

Comment thread nix/pkgs/frr/default.nix
Comment on lines +63 to +67
# Whether this FRR source carries our vtysh extension loader, i.e. whether
# its vtysh understands `-X <path-to-extension.so>`. Our fork (`frr-dp`)
# does; upstream (`frr`, used for the host image) does not, and passing it
# `-X` would only earn us an "invalid option". When set, the install phase
# wraps `vtysh` so that it loads `vtysh-extension-libs` without being asked.
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.

image FRR: add alias for vtysh to load extensions

2 participants