babeld: add new package - #30162
babeld: add new package#30162BKPepe wants to merge 6 commits into
Conversation
| 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 |
There was a problem hiding this comment.
@PolynomialDivision This is your patch, please take a look if it can be upstreamed or what to do with this one
There was a problem hiding this comment.
it is ubus and so openwrt specific. I think it is not upstreamable.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
| struct blob_buf b = {0}; | ||
| struct filter *filter = NULL; | ||
| char *ifname; | ||
| int metric, type; |
There was a problem hiding this comment.
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.
| int metric, type; | |
| int metric = 0, type; |
Generated by Claude Code
There was a problem hiding this comment.
| if (!tb[FILTER_TYPE]) | ||
| return UBUS_STATUS_INVALID_ARGUMENT; | ||
|
|
||
| type = blobmsg_get_u32(tb[FILTER_TYPE]); |
There was a problem hiding this comment.
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
| include $(TOPDIR)/rules.mk | ||
|
|
||
| PKG_NAME:=babeld | ||
| PKG_VERSION:=1.13.1 |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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 Buildjobs are green onfc5110b, so nonet/babeld/test-version.shis needed and the-ubus-modversion 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
typehanded toadd_filter(), the/tmp/babel.d/vs/tmp/babeld.d/typo infiles/babeld.config, and the tab+spaces indentation in600-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
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>
|
ping @PolynomialDivision |
|
@PolynomialDivision Gentle ping this is sitting here for a month. |
Formality Check: FailedWe checked this pull request against the contribution guidelines. Here is what needs your attention: 🛑 CRITICAL ERRORS
Tip Do not close this pull request to make corrections. Instead, modify your existing commits (e.g. Something broken? Consider reporting an issue. |
openwrt-ai
left a comment
There was a problem hiding this comment.
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 by93f3f3din this same unmerged series; squash it into93f3f3d.476205a"Update net/babeld/patches/600-add-ubus.patch" — same shape, same series; squash into93f3f3dso the patch is added in its final form.
Generated by Claude Code
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
f02c5ef,7316b6e— template subjects with no body, both fixing up93f3f3dinside this same unmerged series; squash all four fixups into93f3f3dso 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); |
There was a problem hiding this comment.
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.
| + ubus_notify_route(route, kind); | |
| + ubus_notify_route(route, kind); |
Generated by Claude Code
|
A data point from downstream, from someone waiting on this one. Since routing#1198 landed on 2026-08-11, SNAPSHOT has had no and neither package can be selected. As far as I can tell from this thread, the only thing left is the four 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. |
There was a problem hiding this comment.
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
Open (6)
Exclude the OpenWrt ignore option from babeld configuration · New Handle route node allocation failures safely · New Validate filter type and handle add_filter failure · New Recover the ubus connection after ubusd restarts · New Serialize notification route fields at the message root · New Emit documented neighbour event names · New
| # "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" |
| struct xroute_list_entry *xr = | ||
| calloc(1, sizeof(struct xroute_list_entry)); | ||
| xr->xroute = xroute; |
| if (!tb[FILTER_TYPE]) | ||
| return UBUS_STATUS_INVALID_ARGUMENT; | ||
|
|
||
| type = blobmsg_get_u32(tb[FILTER_TYPE]); |
| shared_ctx = ubus_connect(NULL); | ||
| if (!shared_ctx) | ||
| return false; |
| 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); |
|
|
||
| blob_buf_init(&b, 0); | ||
| babeld_add_neighbour_buf(neigh, &b); | ||
| snprintf(method, sizeof(method), "neigh.%s", local_kind(kind)); |
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>
|
Those commits should be squashed before merging and someone e.g. @PolynomialDivision should take a look at Copilot's review |
|
Well, I am getting quite annoyed with the dropping of the package for it to just sit in this state here for months |


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