Skip to content

babeld: add new package - #30162

Open
BKPepe wants to merge 6 commits into
openwrt:masterfrom
BKPepe:add-babeld
Open

BKPepe wants to merge 6 commits into
openwrt:masterfrom
BKPepe:add-babeld

Conversation

@BKPepe

@BKPepe BKPepe commented Aug 6, 2026

Copy link
Copy Markdown
Member

Adds babeld from the openwrt/routing feed — the routing packages are being moved into openwrt/packages one by one, as discussed in openwrt/routing#184.

Includes the small MAKE_FLAGS cleanup pending in openwrt/routing#1197.

The content matches the current routing feed master. Once this is merged, the package will be removed from the routing feed (a coordinated removal PR is prepared there).

Maintainer: @PolynomialDivision

Copilot AI lite review requested due to automatic review settings August 6, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment on lines +1 to +4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Thu, 17 Dec 2020 12:41:32 +0100
Subject: [PATCH] add ubus bindings

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@PolynomialDivision This is your patch, please take a look if it can be upstreamed or what to do with this one

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it is ubus and so openwrt specific. I think it is not upstreamable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I know it’s ubus and pretty OpenWrt-specific, but our goal should simply be to get some eyes on the patch and have it reviewed, ideally by an upstream developer. I honestly think you could put in a bit of effort and try to upstream it, because otherwise this patch will just sit in our repo forever and we'll be stuck maintaining it. If upstream rejects it, so be it, but right now we're just acting on the assumption that someone, somewhere, thinks upstream won't take it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you look at the Babel repository, you'll see that I tried to upstream multiple PRs, but they're still open. So I don't know if that is worth the effort.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Come on, I see you have two open pull requests there. One is a WIP, and the other is just waiting to be merged and looks good. I really don't think it's that hard to just take the patch and put it out there. This patch has been sitting here since 2020, and with this kind of mindset, we're really not going to get anywhere. Meanwhile, babeld development is pretty active, so in my view, we're mostly just making excuses instead of putting in the effort to make things better around here.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 1 new commit; the commit message matches the change. Packaging looks sound — conffiles layout, the procd init script, the 2-space/tab indentation split in the Makefile, and the literal BuildPackage,babeld all match the feed conventions, and src/ubus.c/ubus.h land in the build dir via the default Build/Prepare, so no explicit prepare step is needed.

The only finding I'd call a real defect is the uninitialized metric in babeld_ubus_add_filter() — one line, and worth fixing while the code is being moved rather than after. The unvalidated filter type next to it is a question, not a blocker. The rest are marked nit:, plus one non-blocking heads-up about this feed's generic runtime version check, which the routing feed does not run.

I left the patch's missing Signed-off-by/upstream reference alone since you've already raised the upstreaming question with @PolynomialDivision on that file.


Generated by Claude Code

Comment thread net/babeld/src/ubus.c Outdated
struct blob_buf b = {0};
struct filter *filter = NULL;
char *ifname;
int metric, type;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

metric is only assigned when tb[FILTER_METRIC] is present, but it is read unconditionally at filter->action.add_metric = metric; (ubus.c:109). metric is optional in filter_policy — only ifname and type are rejected when missing — so ubus call babeld add_filter '{"ifname":"eth0","type":0}' installs a filter whose metric is whatever was on the stack. In babeld a filter's add_metric of INFINITY means "deny", so a garbage value can silently turn an allow-filter into a deny-filter.

Suggested change
int metric, type;
int metric = 0, type;

Generated by Claude Code

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fixed, thanks


Generated by Claude Code

Comment thread net/babeld/src/ubus.c
if (!tb[FILTER_TYPE])
return UBUS_STATUS_INVALID_ARGUMENT;

type = blobmsg_get_u32(tb[FILTER_TYPE]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

type is taken straight from the ubus message and handed to add_filter(filter, type) without a range check, even though ubus.h:5-10 documents only 0..3 (FILTER_TYPE_INPUT … FILTER_TYPE_INSTALL) as valid.

I can't see babeld's add_filter() from this diff to confirm what it does with an out-of-range type — if it ends its if/else chain in abort() (as several babeld dispatchers do), an unexpected value from a ubus caller would take the daemon down rather than return an error. Would it be worth rejecting out-of-range values with UBUS_STATUS_INVALID_ARGUMENT here, so the validation doesn't depend on upstream's internals?


Generated by Claude Code

Comment thread net/babeld/files/babeld.config Outdated
Comment thread net/babeld/patches/600-add-ubus.patch Outdated
Comment thread net/babeld/Makefile
include $(TOPDIR)/rules.mk

PKG_NAME:=babeld
PKG_VERSION:=1.13.1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Heads-up rather than a defect: this feed's CI runs a generic runtime check that executes each installed binary with version/help flags and expects PKG_VERSION in the output — the routing feed doesn't run that, so it's new surface for this package.

Two things make it worth a look before merge: babeld's own option parser is short-option based, and 600-add-ubus.patch rewrites generate-version.sh to emit "$version-ubus-mod". The suffix itself is harmless (1.13.1-ubus-mod still contains 1.13.1), but if $version resolves to unknown when building from the release tarball rather than a git checkout, the printed string won't contain 1.13.1 at all. If the check doesn't pass, the fix is a net/babeld/test-version.sh that returns 0 for this package. The multi-arch jobs were still queued when I looked, so I couldn't confirm either way.


Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 1 new commit; no new issues found.

fc5110b does exactly what its message says — int metric = 0, type; in babeld_ubus_add_filter() — and closes the uninitialized-read path I flagged. Nothing else changed.

Two follow-ups from the previous round, for the record:

  • The generic runtime version check I warned about is answered: all ten Feeds Package Test Build jobs are green on fc5110b, so no net/babeld/test-version.sh is needed and the -ubus-mod version suffix is not a problem in practice.
  • Still open, both non-blocking and unchanged since they live in the moved-as-is code: the unvalidated filter type handed to add_filter(), the /tmp/babel.d/ vs /tmp/babeld.d/ typo in files/babeld.config, and the tab+spaces indentation in 600-add-ubus.patch. None of these need to hold up the move from the routing feed — they can be follow-ups here just as easily.

Generated by Claude Code

BKPepe added a commit to BKPepe/openwrt-routing that referenced this pull request Aug 11, 2026
The package has been moved to the openwrt/packages feed, as
discussed in openwrt#184.

See openwrt/packages#30162.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@BKPepe

BKPepe commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

ping @PolynomialDivision

@BKPepe

BKPepe commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@PolynomialDivision Gentle ping this is sitting here for a month.

@openwrt

openwrt Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Formality Check: Failed

We checked this pull request against the contribution guidelines. Here is what needs your attention:

🛑 CRITICAL ERRORS

Commit f78c2c8 - Update net/babeld/files/babeld.config:

  • Commit subject must start with <package name or prefix>:

Commit cab46c4 - Update net/babeld/patches/600-add-ubus.patch:

  • Commit subject must start with <package name or prefix>:

Commit 0169cb7 - Update net/babeld/files/babeld.config:

  • Commit subject must start with <package name or prefix>:

Commit 9b7d496 - Update net/babeld/patches/600-add-ubus.patch:

  • Commit subject must start with <package name or prefix>:

Tip

Do not close this pull request to make corrections. Instead, modify your existing commits (e.g. git commit --amend) and update the branch using git push --force-with-lease --force-if-includes. The checks will re-run automatically.


Something broken? Consider reporting an issue.
Running version 26ec621 deployed on 2026-09-20 09:46:35 CEST

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commit checks

  • 3517621 "Update net/babeld/files/babeld.config" — GitHub-web template subject, no body, and it only corrects a typo in the file added by 93f3f3d in this same unmerged series; squash it into 93f3f3d.
  • 476205a "Update net/babeld/patches/600-add-ubus.patch" — same shape, same series; squash into 93f3f3d so the patch is added in its final form.

Generated by Claude Code

Comment thread net/babeld/files/babeld.config Outdated
Comment thread net/babeld/patches/600-add-ubus.patch Outdated

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commit checks

  • f02c5ef, 7316b6e — template subjects with no body, both fixing up 93f3f3d inside this same unmerged series; squash all four fixups into 93f3f3d so the package is added in its final form.

Generated by Claude Code

local_notify_route_1(&local_sockets[i], route, kind);
}
+ if(ubus_bindings)
+ ubus_notify_route(route, kind);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: last remaining tab+four-spaces line in this patch — the other two if(ubus_bindings) bodies are now four spaces, and surrounding babeld code is four spaces per level.

Suggested change
+ ubus_notify_route(route, kind);
+ ubus_notify_route(route, kind);

Generated by Claude Code

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 6 new commits; no new issues found.


Generated by Claude Code

@IvanTheGeek

IvanTheGeek commented Sep 23, 2026 •

Copy link
Copy Markdown

A data point from downstream, from someone waiting on this one. Since routing#1198 landed on 2026-08-11, SNAPSHOT has had no babeld in any feed. luci-app-babeld is still in luci master (LUCI_DEPENDS:=+luci-base +babeld), so every SNAPSHOT build now prints

WARNING: Makefile 'package/feeds/luci/luci-app-babeld/Makefile' has a dependency on 'babeld', which does not exist

and neither package can be selected. openwrt-25.12 is fine: its routing feed still has 1.13.1-r3, including the add_filter metric fix.

As far as I can tell from this thread, the only thing left is the four Update net/babeld/... fixup commits that the Formality Check flags. They are the maintainer's own review fixes and carry his Signed-off-by, so they only need squashing into the first commit, as openwrt-ai suggested. Until then the Feeds Package Test Build is skipped, so CI has not built the current head.

We plan to run babeld on snapshot-based builds for mediatek/filogic (Cudy WR3000S and WR3000H).

Edit: I first listed "an ack from the maintainer" as outstanding, but those fixups are already his.

AI assistance: researched and drafted with help from Claude Opus 5.5 (Anthropic); I reviewed it before posting.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The ubus API has malformed notification payloads, missing recovery and validation paths, and the init script can generate invalid configuration.

Review effort: Balanced
Findings: 2 High severity · 4 Medium severity

Open (6)

Comment on lines +125 to +129
# "option ifname" is a special option, don't actually
# generate configuration for it.
[ "$option" = "ifname" ] && return
[ -n "$interface" ] && _interface="interface $interface" || _interface="default"
cfg_append "$_interface ${option//_/-} $value"
Comment thread net/babeld/src/ubus.c
Comment on lines +207 to +209
struct xroute_list_entry *xr =
calloc(1, sizeof(struct xroute_list_entry));
xr->xroute = xroute;
Comment thread net/babeld/src/ubus.c
if (!tb[FILTER_TYPE])
return UBUS_STATUS_INVALID_ARGUMENT;

type = blobmsg_get_u32(tb[FILTER_TYPE]);
Comment thread net/babeld/src/ubus.c
Comment on lines +444 to +446
shared_ctx = ubus_connect(NULL);
if (!shared_ctx)
return false;
Comment thread net/babeld/src/ubus.c
Comment on lines +464 to +467
blob_buf_init(&b, 0);
babeld_add_route_buf(route, &b);
snprintf(method, sizeof(method), "route.%s", local_kind(kind));
ubus_notify(shared_ctx, &babeld_object, method, b.head, -1);
Comment thread net/babeld/src/ubus.c

blob_buf_init(&b, 0);
babeld_add_neighbour_buf(neigh, &b);
snprintf(method, sizeof(method), "neigh.%s", local_kind(kind));
BKPepe and others added 6 commits October 3, 2026 20:28
Babel is a loop-avoiding distance-vector routing protocol for
IPv6 and IPv4 with fast convergence properties (RFC 8966).

Moved from the openwrt/routing feed, as discussed in
openwrt/routing#184.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The metric is optional in filter_policy: only ifname and type are
rejected when missing, so `ubus call babeld add_filter
'{"ifname":"eth0","type":0}'` reaches

    filter->action.add_metric = metric;

with metric never assigned, i.e. whatever was left on the stack. In
babeld an add_metric of INFINITY means "deny", so an uninitialized
read can silently turn an allow filter into a deny filter.

Initialize it to 0, which is the neutral value the filter would have
had if the caller had passed it explicitly.

Reported-by: openwrt-ai[bot]
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de>
Signed-off-by: Nick Hainke <vincent@systemli.org>
Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de>
Signed-off-by: Nick Hainke <vincent@systemli.org>
Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de>
Signed-off-by: Nick Hainke <vincent@systemli.org>
Co-authored-by: OpenWrt AI review account <openwrt-ai@hauke-m.de>
Signed-off-by: Nick Hainke <vincent@systemli.org>
@BKPepe

BKPepe commented Oct 3, 2026 •

Copy link
Copy Markdown
Member Author

Those commits should be squashed before merging and someone e.g. @PolynomialDivision should take a look at Copilot's review

@robimarko

Copy link
Copy Markdown
Contributor

Well, I am getting quite annoyed with the dropping of the package for it to just sit in this state here for months

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants