Re: git: c9f9c4fe47bf - main - ip6_forward: Do not reference the nexthop
- In reply to: R. Christian McDonald : "git: c9f9c4fe47bf - main - ip6_forward: Do not reference the nexthop"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Nov 2026 22:08:19 UTC
On Sun, Nov 22, 2026 at 09:18:49PM +0000, R. Christian McDonald wrote: R> Author: R. Christian McDonald <rcm@FreeBSD.org> R> AuthorDate: 2026-11-22 21:18:16 +0000 R> Commit: R. Christian McDonald <rcm@FreeBSD.org> R> CommitDate: 2026-11-22 21:18:16 +0000 R> R> ip6_forward: Do not reference the nexthop R> R> ip6_forward() looked the route up with NHR_REF and released the nexthop R> before returning. It runs in the network epoch and uses the nexthop R> only until it returns: nd6_output_ifp() gets the interface, and R> icmp6_redirect_output() runs before the return. The epoch keeps the R> nexthop valid that long, which ip6_tryforward() already relies on. R> R> Every packet that takes this path wrote twice to the nexthop reference R> count, which all CPUs forwarding to that nexthop share. Forwarded R> packets take it whenever IPsec has a security policy, and today also R> whenever net.inet6.ip6.redirect is set, which is the default. R> R> Look the nexthop up without a reference, and assert that the caller is R> in the network epoch. R> R> No functional change intended. I think this commit actually carries quite a lot of functional change if we are talking about how the code works. It doesn't bring any user visible change, though. We should use this statement (NFC) more responsibly. -- Gleb Smirnoff