Skip to content

Kernel: T9010: update existing patches to remove "hunk off" notices - #1226

Merged
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:kernel-patch-update
Jun 26, 2026
Merged

Kernel: T9010: update existing patches to remove "hunk off" notices#1226
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:kernel-patch-update

Conversation

@c-po

@c-po c-po commented Jun 25, 2026

Copy link
Copy Markdown
Member

Change summary

Just update the existing Kernel patches to cleanly apply to the latest Kernel version.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test / Smoketest result

Kernel compiles and no "hunk off" lines appear.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a new IPv6 interface setting to control how packet handling behaves when a network link is down or inactive.
    • Kernel builds now produce a separate perf package for the matching kernel release.
  • Bug Fixes

    • Improved route selection so traffic can be filtered more consistently based on interface state and carrier status.

Walkthrough

Adds an IPv6 link_filter sysctl and route-selection check based on interface state, and extends Debian kernel packaging to build a linux-perf-${KERNELRELEASE} binary package.

Changes

IPv6 link_filter plumbing

Layer / File(s) Summary
Contract and documentation
include/linux/inetdevice.h, include/linux/ipv6.h, include/uapi/linux/ip.h, include/uapi/linux/ipv6.h, scripts/package/build-linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
Lines 52, 64, 76, 88, and 30 add the link_filter accessor, field, UAPI enum values, and sysctl documentation.
Sysctl entries
net/ipv4/devinet.c, net/ipv6/addrconf.c
Lines 100 and 112-123 register the IPv4 and IPv6 link_filter sysctls and publish DEVCONF_LINK_FILTER.
Route gating
net/ipv6/route.c
Lines 138-156 add rt6_link_filter() and make rt6_score_route() return -1 when the link filter matches.

linux-perf package build

Layer / File(s) Summary
Perf staging helper
scripts/package/builddeb
Lines 23-32 add install_perf() to stage tools/perf with an absolute srctree and DESTDIR.
Perf package wiring
scripts/package/builddeb, scripts/package/debian/rules, scripts/package/mkdebian
Lines 53-61 route linux-perf-* through install_perf, add binary-perf and perf-package, and append the linux-perf-${KERNELRELEASE} control stanza.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: refreshing kernel patches for T9010 to eliminate hunk-off notices.
Description check ✅ Passed The description is aligned with the changeset and PR objective, describing patch updates to cleanly apply to the latest kernel.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

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

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch (2)

145-151: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Guard __in6_dev_get(dev) before dereference to avoid crash

At Line 148, __in6_dev_get(dev) is dereferenced unconditionally. If it returns NULL, this is a kernel NULL-pointer dereference in route scoring path.

Proposed fix
 static inline int rt6_link_filter(const struct fib6_nh *nh)
 {
 	const struct net_device *dev = nh->fib_nh_dev;
-	int linkf = __in6_dev_get(dev)->cnf.link_filter;
+	const struct inet6_dev *idev = __in6_dev_get(dev);
+	int linkf;
+
+	if (!idev)
+		return 0;
+
+	linkf = idev->cnf.link_filter;
 	return (linkf && !netif_running(dev))
 		|| (linkf > 1 && !netif_carrier_ok(dev));
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`
around lines 145 - 151, The rt6_link_filter helper dereferences
__in6_dev_get(dev) without checking for NULL, which can crash in the route
scoring path. Update rt6_link_filter to first store the __in6_dev_get(dev)
result in a local pointer and guard the cnf.link_filter access with a NULL check
before using it; keep the existing netif_running and netif_carrier_ok logic
unchanged.

37-46: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Enforce documented link_filter range (0..2) in sysctl handlers

Lines 37-46 document only 0/1/2, but Line 107 and Lines 127-133 register unrestricted integer writes. Out-of-range values are currently accepted, creating a doc/UAPI contract break and undefined admin behavior.

Proposed fix (IPv6 table pattern)
 	{
 		.procname	= "link_filter",
 		.data		= &ipv6_devconf.link_filter,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= (void *)SYSCTL_ZERO,
+		.extra2		= (void *)SYSCTL_TWO,
 	},

Apply equivalent min/max enforcement for the IPv4 link_filter sysctl entry as well.

Also applies to: 107-107, 127-133

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`
around lines 37 - 46, The `link_filter` sysctl accepts unrestricted integers in
the IPv4 and IPv6 handlers, which conflicts with the documented 0..2 range.
Update the sysctl registration/handler setup around the `link_filter` entries to
enforce minimum 0 and maximum 2 for both tables, following the IPv6 table
pattern and applying the same bounds to the IPv4 `link_filter` entry as well.
scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch (2)

69-77: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Guard binary-perf target creation on package presence.

binary-targets includes binary-perf unconditionally (Line 69), but perf-package is conditional (Line 76). When no linux-perf-* package is emitted, this target can execute with an empty package binding.

Proposed fix
-binary-targets := $(addprefix binary-, image image-dbg headers libc-dev perf)
+binary-targets := $(addprefix binary-, image image-dbg headers libc-dev)
@@
 perf-package = $(filter linux-perf-%, $(all-packages))
+ifneq ($(strip $(perf-package)),)
+binary-targets += binary-perf
+endif
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`
around lines 69 - 77, Guard the unconditional binary-perf target in the
packaging make logic: binary-targets currently always includes binary-perf while
perf-package in the same block may be empty, so adjust the target list or the
perf package selection in the kernel packaging rules to only create binary-perf
when a linux-perf-* package exists. Use the existing binary-targets and
perf-package symbols in the build rules to keep the perf target conditional
alongside the other package-specific targets.

91-95: 🎯 Functional Correctness | 🟠 Major

Use debhelper substvars for linux-perf-${KERNELRELEASE} dependencies. scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch:91-95 hardcodes runtime libs only; add ${shlibs:Depends} and ${misc:Depends} so perf tracks its actual ELF and package metadata dependencies.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`
around lines 91 - 95, The linux-perf package stanza is missing
debhelper-generated dependency substitution, so update the package metadata in
the linux-perf patch to use substvars instead of only hardcoded runtime
libraries. In the package definition for linux-perf-${KERNELRELEASE}, add
${shlibs:Depends} and ${misc:Depends} to the Depends field alongside the
existing libs so the package tracks ELF and metadata dependencies correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`:
- Around line 145-151: The rt6_link_filter helper dereferences
__in6_dev_get(dev) without checking for NULL, which can crash in the route
scoring path. Update rt6_link_filter to first store the __in6_dev_get(dev)
result in a local pointer and guard the cnf.link_filter access with a NULL check
before using it; keep the existing netif_running and netif_carrier_ok logic
unchanged.
- Around line 37-46: The `link_filter` sysctl accepts unrestricted integers in
the IPv4 and IPv6 handlers, which conflicts with the documented 0..2 range.
Update the sysctl registration/handler setup around the `link_filter` entries to
enforce minimum 0 and maximum 2 for both tables, following the IPv6 table
pattern and applying the same bounds to the IPv4 `link_filter` entry as well.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`:
- Around line 69-77: Guard the unconditional binary-perf target in the packaging
make logic: binary-targets currently always includes binary-perf while
perf-package in the same block may be empty, so adjust the target list or the
perf package selection in the kernel packaging rules to only create binary-perf
when a linux-perf-* package exists. Use the existing binary-targets and
perf-package symbols in the build rules to keep the perf target conditional
alongside the other package-specific targets.
- Around line 91-95: The linux-perf package stanza is missing
debhelper-generated dependency substitution, so update the package metadata in
the linux-perf patch to use substvars instead of only hardcoded runtime
libraries. In the package definition for linux-perf-${KERNELRELEASE}, add
${shlibs:Depends} and ${misc:Depends} to the Depends field alongside the
existing libs so the package tracks ELF and metadata dependencies correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6d31f33c-800a-43f5-b361-4133d26a7ea5

📥 Commits

Reviewing files that changed from the base of the PR and between 0e7145f and c6479a4.

📒 Files selected for processing (2)
  • scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
  • scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ansible/ansible (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🔍 Remote MCP

Additional context

  • A 2009 netdev RFC proposed IPv4 link_filter with values 0/1/2 to ignore packets when the interface is down or has no carrier, but David Miller rejected the idea in-thread. (groups.google.com)
  • Current kernel IP sysctl docs don’t mention link_filter at all; I found no matches in the 6.8, 6.18, or generic docs pages. (docs.kernel.org)
  • Debian currently ships linux-perf as the perf-tools package. An older kernel builddeb perf patch used linux-tools-$version instead. (packages.debian.org)
  • VyOS downstream already writes /proc/sys/net/ipv4/conf/<iface>/link_filter during interface setup, so this sysctl is already part of the IPv4 config flow. (vyos.dev)

@asklymenko asklymenko 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.

This change is to clean up the patch.

@sever-sever sever-sever left a comment

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.

Cleanup Kernel patches
no functional changes

@sever-sever
sever-sever merged commit fde8fc6 into vyos:rolling Jun 26, 2026
11 of 12 checks passed
@vyos-bot vyos-bot Bot added mirror-initiated This PR initiated for mirror sync workflow mirror-completed and removed mirror-initiated This PR initiated for mirror sync workflow labels Jun 26, 2026
@c-po
c-po deleted the kernel-patch-update branch July 2, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants