Skip to content

Instantly share code, notes, and snippets.

@tonusoo
Last active August 8, 2025 12:50
Show Gist options
  • Select an option

  • Save tonusoo/8b6bf1ed248afe03a6d4adb7a0ffea81 to your computer and use it in GitHub Desktop.

Select an option

Save tonusoo/8b6bf1ed248afe03a6d4adb7a0ffea81 to your computer and use it in GitHub Desktop.
disables fallback to less specific routes explained in RFC 4191 3.2 and 3.6; patch --ignore-whitespace net/ipv6/route.c route.patch; tested on Linux 6.12.38
--- net/ipv6/route.c~ 2025-08-08 13:44:04.928000000 +0300
+++ net/ipv6/route.c 2025-08-08 13:48:01.448000000 +0300
@@ -2221,24 +2221,13 @@
int fib6_table_lookup(struct net *net, struct fib6_table *table, int oif,
struct flowi6 *fl6, struct fib6_result *res, int strict)
{
- struct fib6_node *fn, *saved_fn;
+ struct fib6_node *fn;
fn = fib6_node_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
- saved_fn = fn;
-
-redo_rt6_select:
rt6_select(net, fn, oif, res, strict);
- if (res->f6i == net->ipv6.fib6_null_entry) {
- fn = fib6_backtrack(fn, &fl6->saddr);
- if (fn)
- goto redo_rt6_select;
- else if (strict & RT6_LOOKUP_F_REACHABLE) {
- /* also consider unreachable route */
- strict &= ~RT6_LOOKUP_F_REACHABLE;
- fn = saved_fn;
- goto redo_rt6_select;
- }
- }
+
+ if (res->f6i == net->ipv6.fib6_null_entry)
+ return -ENOENT;
trace_fib6_table_lookup(net, res, table, fl6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment