* [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations
@ 2025-11-04 14:48 David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr David Lamparter
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: David Lamparter @ 2025-11-04 14:48 UTC (permalink / raw)
To: netdev, Jakub Kicinski; +Cc: David Lamparter, Lorenzo Colitti, Patrick Rohr
Hi all,
Jakub, you had asked me a little while ago to resend this at a later
point not shortly before the merge window closes. Unfortunately I don't
do enough kernel work to track when that is (sorry), so here goes
nothing I guess. I'm still trying to get Patrick or Lorenzo to look at
this and throw a Reviewed-by.
To emphasise, these patches **should not change any behavior**.
following 4 patches are preparations for RFC6724 (IPv6 source address
selection) rule 5.5, which says "prefer addresses announced by the
router you're using". The changes here just pass down the route into
the source address selection code, it's not used for anything yet. I
have the actual 6724 rule 5.5 code working and am putting together
kernel self-tests currently.
Cheers,
David
David Lamparter (4):
net/ipv6: flatten ip6_route_get_saddr
net/ipv6: create ipv6_fl_get_saddr
net/ipv6: use ipv6_fl_get_saddr in output
net/ipv6: drop ip6_route_get_saddr
include/net/addrconf.h | 4 ++++
include/net/ip6_route.h | 26 ------------------------
net/ipv6/addrconf.c | 45 +++++++++++++++++++++++++++++++----------
net/ipv6/ip6_output.c | 25 +++++++++++++++++------
net/ipv6/route.c | 16 ++++++++++++---
5 files changed, 70 insertions(+), 46 deletions(-)
--
2.50.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr
2025-11-04 14:48 [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations David Lamparter
@ 2025-11-04 14:48 ` David Lamparter
2025-11-04 17:52 ` Lorenzo Colitti
2025-11-04 14:48 ` [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr David Lamparter
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: David Lamparter @ 2025-11-04 14:48 UTC (permalink / raw)
To: netdev, Jakub Kicinski; +Cc: David Lamparter, Lorenzo Colitti, Patrick Rohr
Inline ip6_route_get_saddr()'s functionality in rt6_fill_node(), to
prepare for replacing the former with a dst based function.
NB: the l3mdev handling introduced by 252442f2ae31 "ipv6: fix source
address selection with route leak" is dropped here - the l3mdev ifindex
was a constant 0 on this call site, so that code was in fact dead.
Signed-off-by: David Lamparter <equinox@diac24.net>
---
net/ipv6/route.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index aee6a10b112a..9508e46b9e56 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5822,9 +5822,19 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
if (nla_put_u32(skb, RTA_IIF, iif))
goto nla_put_failure;
} else if (dest) {
- struct in6_addr saddr_buf;
- if (ip6_route_get_saddr(net, rt, dest, 0, 0, &saddr_buf) == 0 &&
- nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
+ struct in6_addr saddr_buf, *saddr = NULL;
+
+ if (rt->fib6_prefsrc.plen) {
+ saddr = &rt->fib6_prefsrc.addr;
+ } else {
+ struct net_device *dev = fib6_info_nh_dev(rt);
+
+ if (ipv6_dev_get_saddr(net, dev, dest, 0,
+ &saddr_buf) == 0)
+ saddr = &saddr_buf;
+ }
+
+ if (saddr && nla_put_in6_addr(skb, RTA_PREFSRC, saddr))
goto nla_put_failure;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr
2025-11-04 14:48 [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr David Lamparter
@ 2025-11-04 14:48 ` David Lamparter
2025-11-04 17:51 ` Lorenzo Colitti
2025-11-11 9:50 ` Paolo Abeni
2025-11-04 14:48 ` [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr David Lamparter
3 siblings, 2 replies; 13+ messages in thread
From: David Lamparter @ 2025-11-04 14:48 UTC (permalink / raw)
To: netdev, Jakub Kicinski; +Cc: David Lamparter, Lorenzo Colitti, Patrick Rohr
This adds passing the relevant flow information as well as selected
nexthop into the source address selection code, to allow the RFC6724
rule 5.5 code to look at its details.
Signed-off-by: David Lamparter <equinox@diac24.net>
---
include/net/addrconf.h | 4 ++++
net/ipv6/addrconf.c | 45 +++++++++++++++++++++++++++++++-----------
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 78e8b877fb25..577debd34c11 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -141,6 +141,10 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
int ipv6_dev_get_saddr(struct net *net, const struct net_device *dev,
const struct in6_addr *daddr, unsigned int srcprefs,
struct in6_addr *saddr);
+int ipv6_fl_get_saddr(struct net *net, const struct dst_entry *dst,
+ const struct net_device *dst_dev,
+ const struct sock *sk, unsigned int srcprefs,
+ struct flowi6 *fl6);
int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
u32 banned_flags);
bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 40e9c336f6c5..f20367156062 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1533,7 +1533,9 @@ struct ipv6_saddr_score {
};
struct ipv6_saddr_dst {
- const struct in6_addr *addr;
+ const struct flowi6 *fl6;
+ const struct dst_entry *dst;
+ const struct sock *sk;
int ifindex;
int scope;
int label;
@@ -1610,7 +1612,7 @@ static int ipv6_get_saddr_eval(struct net *net,
break;
case IPV6_SADDR_RULE_LOCAL:
/* Rule 1: Prefer same address */
- ret = ipv6_addr_equal(&score->ifa->addr, dst->addr);
+ ret = ipv6_addr_equal(&score->ifa->addr, &dst->fl6->daddr);
break;
case IPV6_SADDR_RULE_SCOPE:
/* Rule 2: Prefer appropriate scope
@@ -1688,11 +1690,11 @@ static int ipv6_get_saddr_eval(struct net *net,
* non-ORCHID vs non-ORCHID
*/
ret = !(ipv6_addr_orchid(&score->ifa->addr) ^
- ipv6_addr_orchid(dst->addr));
+ ipv6_addr_orchid(&dst->fl6->daddr));
break;
case IPV6_SADDR_RULE_PREFIX:
/* Rule 8: Use longest matching prefix */
- ret = ipv6_addr_diff(&score->ifa->addr, dst->addr);
+ ret = ipv6_addr_diff(&score->ifa->addr, &dst->fl6->daddr);
if (ret > score->ifa->prefix_len)
ret = score->ifa->prefix_len;
score->matchlen = ret;
@@ -1810,9 +1812,10 @@ static int ipv6_get_saddr_master(struct net *net,
return hiscore_idx;
}
-int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
- const struct in6_addr *daddr, unsigned int prefs,
- struct in6_addr *saddr)
+int ipv6_fl_get_saddr(struct net *net, const struct dst_entry *dst_entry,
+ const struct net_device *dst_dev,
+ const struct sock *sk, unsigned int prefs,
+ struct flowi6 *fl6)
{
struct ipv6_saddr_score scores[2], *hiscore;
struct ipv6_saddr_dst dst;
@@ -1823,11 +1826,13 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
int hiscore_idx = 0;
int ret = 0;
- dst_type = __ipv6_addr_type(daddr);
- dst.addr = daddr;
+ dst_type = __ipv6_addr_type(&fl6->daddr);
+ dst.fl6 = fl6;
+ dst.sk = sk;
+ dst.dst = dst_entry;
dst.ifindex = dst_dev ? dst_dev->ifindex : 0;
dst.scope = __ipv6_addr_src_scope(dst_type);
- dst.label = ipv6_addr_label(net, daddr, dst_type, dst.ifindex);
+ dst.label = ipv6_addr_label(net, &fl6->daddr, dst_type, dst.ifindex);
dst.prefs = prefs;
scores[hiscore_idx].rule = -1;
@@ -1902,11 +1907,29 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
if (!hiscore->ifa)
ret = -EADDRNOTAVAIL;
else
- *saddr = hiscore->ifa->addr;
+ fl6->saddr = hiscore->ifa->addr;
rcu_read_unlock();
return ret;
}
+EXPORT_SYMBOL(ipv6_fl_get_saddr);
+
+int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
+ const struct in6_addr *daddr, unsigned int prefs,
+ struct in6_addr *saddr)
+{
+ struct flowi6 fl6;
+ int ret;
+
+ memset(&fl6, 0, sizeof(fl6));
+ fl6.daddr = *daddr;
+
+ ret = ipv6_fl_get_saddr(net, NULL, dst_dev, NULL, prefs, &fl6);
+ if (!ret)
+ *saddr = fl6.saddr;
+
+ return ret;
+}
EXPORT_SYMBOL(ipv6_dev_get_saddr);
static int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output
2025-11-04 14:48 [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr David Lamparter
@ 2025-11-04 14:48 ` David Lamparter
2025-11-04 17:52 ` Lorenzo Colitti
2025-11-11 9:56 ` Paolo Abeni
2025-11-04 14:48 ` [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr David Lamparter
3 siblings, 2 replies; 13+ messages in thread
From: David Lamparter @ 2025-11-04 14:48 UTC (permalink / raw)
To: netdev, Jakub Kicinski; +Cc: David Lamparter, Lorenzo Colitti, Patrick Rohr
Flatten ip6_route_get_saddr() into ip6_dst_lookup_tail (which really
just means handling fib6_prefsrc), and then replace ipv6_dev_get_saddr
with ipv6_fl_get_saddr to pass down the flow information.
Signed-off-by: David Lamparter <equinox@diac24.net>
---
net/ipv6/ip6_output.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f904739e99b9..28406ed5ddfb 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1126,27 +1126,40 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk,
int flags = 0;
/* The correct way to handle this would be to do
- * ip6_route_get_saddr, and then ip6_route_output; however,
+ * ipv6_fl_get_saddr, and then ip6_route_output; however,
* the route-specific preferred source forces the
- * ip6_route_output call _before_ ip6_route_get_saddr.
+ * ip6_route_output call _before_ ipv6_fl_get_saddr.
*
* In source specific routing (no src=any default route),
* ip6_route_output will fail given src=any saddr, though, so
* that's why we try it again later.
*/
if (ipv6_addr_any(&fl6->saddr)) {
+ struct net_device *l3mdev;
+ struct net_device *dev;
struct fib6_info *from;
struct rt6_info *rt;
+ bool same_vrf;
*dst = ip6_route_output(net, sk, fl6);
rt = (*dst)->error ? NULL : dst_rt6_info(*dst);
rcu_read_lock();
from = rt ? rcu_dereference(rt->from) : NULL;
- err = ip6_route_get_saddr(net, from, &fl6->daddr,
- sk ? READ_ONCE(inet6_sk(sk)->srcprefs) : 0,
- fl6->flowi6_l3mdev,
- &fl6->saddr);
+
+ l3mdev = dev_get_by_index_rcu(net, fl6->flowi6_l3mdev);
+ if (!from || !from->fib6_prefsrc.plen || l3mdev)
+ dev = from ? fib6_info_nh_dev(from) : NULL;
+ same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev;
+ if (from && from->fib6_prefsrc.plen && same_vrf) {
+ fl6->saddr = from->fib6_prefsrc.addr;
+ err = 0;
+ } else
+ err = ipv6_fl_get_saddr(net, *dst,
+ same_vrf ? dev : l3mdev, sk,
+ sk ? READ_ONCE(inet6_sk(sk)->srcprefs) : 0,
+ fl6);
+
rcu_read_unlock();
if (err)
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr
2025-11-04 14:48 [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations David Lamparter
` (2 preceding siblings ...)
2025-11-04 14:48 ` [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output David Lamparter
@ 2025-11-04 14:48 ` David Lamparter
2025-11-04 17:51 ` Lorenzo Colitti
3 siblings, 1 reply; 13+ messages in thread
From: David Lamparter @ 2025-11-04 14:48 UTC (permalink / raw)
To: netdev, Jakub Kicinski; +Cc: David Lamparter, Lorenzo Colitti, Patrick Rohr
It's no longer used anywhere.
Signed-off-by: David Lamparter <equinox@diac24.net>
---
include/net/ip6_route.h | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 7c5512baa4b2..3b64c30fd882 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -125,32 +125,6 @@ void rt6_flush_exceptions(struct fib6_info *f6i);
void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
unsigned long now);
-static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
- const struct in6_addr *daddr,
- unsigned int prefs, int l3mdev_index,
- struct in6_addr *saddr)
-{
- struct net_device *l3mdev;
- struct net_device *dev;
- bool same_vrf;
- int err = 0;
-
- rcu_read_lock();
-
- l3mdev = dev_get_by_index_rcu(net, l3mdev_index);
- if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev)
- dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
- same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev;
- if (f6i && f6i->fib6_prefsrc.plen && same_vrf)
- *saddr = f6i->fib6_prefsrc.addr;
- else
- err = ipv6_dev_get_saddr(net, same_vrf ? dev : l3mdev, daddr, prefs, saddr);
-
- rcu_read_unlock();
-
- return err;
-}
-
struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
const struct in6_addr *saddr, int oif,
const struct sk_buff *skb, int flags);
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr
2025-11-04 14:48 ` [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr David Lamparter
@ 2025-11-04 17:51 ` Lorenzo Colitti
2025-11-04 20:47 ` David Lamparter
2025-11-11 9:50 ` Paolo Abeni
1 sibling, 1 reply; 13+ messages in thread
From: Lorenzo Colitti @ 2025-11-04 17:51 UTC (permalink / raw)
To: David Lamparter; +Cc: netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 4, 2025 at 9:49 AM David Lamparter <equinox@diac24.net> wrote:
> This adds passing the relevant flow information as well as selected
> nexthop into the source address selection code, to allow the RFC6724
> rule 5.5 code to look at its details.
>
> [...]
> struct ipv6_saddr_dst {
> - const struct in6_addr *addr;
> + const struct flowi6 *fl6;
Do you need an entire flowi6? In this patch I see that you only use
saddr and daddr. But flowi6 has lots of information in it that
potentially duplicates other inputs to this function - for example,
the ifindex could also be in flowi6->oif. Should you pass in a
different object than flowi6? Or should, for example, flowi6->oif be
updated with dst->ifindex?
Similarly, do you need a sk? I don't think you use it in this patch.
Is it used in future patches?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr
2025-11-04 14:48 ` [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr David Lamparter
@ 2025-11-04 17:51 ` Lorenzo Colitti
0 siblings, 0 replies; 13+ messages in thread
From: Lorenzo Colitti @ 2025-11-04 17:51 UTC (permalink / raw)
To: David Lamparter; +Cc: netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 4, 2025 at 9:49 AM David Lamparter <equinox@diac24.net> wrote:
> It's no longer used anywhere.
Reviewed-By: Lorenzo Colitti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output
2025-11-04 14:48 ` [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output David Lamparter
@ 2025-11-04 17:52 ` Lorenzo Colitti
2025-11-11 9:56 ` Paolo Abeni
1 sibling, 0 replies; 13+ messages in thread
From: Lorenzo Colitti @ 2025-11-04 17:52 UTC (permalink / raw)
To: David Lamparter; +Cc: netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 4, 2025 at 9:48 AM David Lamparter <equinox@diac24.net> wrote:
> Flatten ip6_route_get_saddr() into ip6_dst_lookup_tail (which really
> just means handling fib6_prefsrc), and then replace ipv6_dev_get_saddr
> with ipv6_fl_get_saddr to pass down the flow information.
Reviewed-By: Lorenzo Colitti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr
2025-11-04 14:48 ` [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr David Lamparter
@ 2025-11-04 17:52 ` Lorenzo Colitti
0 siblings, 0 replies; 13+ messages in thread
From: Lorenzo Colitti @ 2025-11-04 17:52 UTC (permalink / raw)
To: David Lamparter; +Cc: netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 4, 2025 at 9:48 AM David Lamparter <equinox@diac24.net> wrote:
> Inline ip6_route_get_saddr()'s functionality in rt6_fill_node(), to
> prepare for replacing the former with a dst based function.
Reviewed-By: Lorenzo Coliti <lorenzo@google.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr
2025-11-04 17:51 ` Lorenzo Colitti
@ 2025-11-04 20:47 ` David Lamparter
2025-11-04 21:16 ` David Lamparter
0 siblings, 1 reply; 13+ messages in thread
From: David Lamparter @ 2025-11-04 20:47 UTC (permalink / raw)
To: Lorenzo Colitti; +Cc: netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 04, 2025 at 12:51:26PM -0500, Lorenzo Colitti wrote:
> On Tue, Nov 4, 2025 at 9:49 AM David Lamparter <equinox@diac24.net> wrote:
> > This adds passing the relevant flow information as well as selected
> > nexthop into the source address selection code, to allow the RFC6724
> > rule 5.5 code to look at its details.
> >
> > [...]
> > struct ipv6_saddr_dst {
> > - const struct in6_addr *addr;
> > + const struct flowi6 *fl6;
>
> Do you need an entire flowi6? In this patch I see that you only use
> saddr and daddr.
[quote reordered below]
> Similarly, do you need a sk? I don't think you use it in this patch.
> Is it used in future patches?
The answer is the same for both fields: the RFC6724 code (which I
haven't posted yet and really should) calls ip6_route_output() for
different source addresses, and that takes both the sk as well as the
fl6 as parameters.
> But flowi6 has lots of information in it that
> potentially duplicates other inputs to this function - for example,
> the ifindex could also be in flowi6->oif. Should you pass in a
> different object than flowi6? Or should, for example, flowi6->oif be
> updated with dst->ifindex?
The problem is that they're not subsets of each other; flowi6 doesn't
tell anything about the neighbor/router that has already been selected
(and is at the core of the 6724 r5.5 considerations) - that's in the
dst. But the dst is missing all the other bits ip6_route_output wants
to be able to look at for various policy things.
I agree there are a few bits that the function can get at in multiple
ways, but that's because we've already partially but not entirely
processed things at this point. The flowi6 with a whole bunch of raw
input data is "still" there but being halfway done kinda naturally means
we have some object pointers around at the same time.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr
2025-11-04 20:47 ` David Lamparter
@ 2025-11-04 21:16 ` David Lamparter
0 siblings, 0 replies; 13+ messages in thread
From: David Lamparter @ 2025-11-04 21:16 UTC (permalink / raw)
To: David Lamparter; +Cc: Lorenzo Colitti, netdev, Jakub Kicinski, Patrick Rohr
On Tue, Nov 04, 2025 at 09:47:18PM +0100, David Lamparter wrote:
> On Tue, Nov 04, 2025 at 12:51:26PM -0500, Lorenzo Colitti wrote:
> > On Tue, Nov 4, 2025 at 9:49 AM David Lamparter <equinox@diac24.net> wrote:
> > > This adds passing the relevant flow information as well as selected
> > > nexthop into the source address selection code, to allow the RFC6724
> > > rule 5.5 code to look at its details.
> > >
> > > [...]
> > > struct ipv6_saddr_dst {
> > > - const struct in6_addr *addr;
> > > + const struct flowi6 *fl6;
> >
> > Do you need an entire flowi6? In this patch I see that you only use
> > saddr and daddr.
> [quote reordered below]
> > Similarly, do you need a sk? I don't think you use it in this patch.
> > Is it used in future patches?
>
> The answer is the same for both fields: the RFC6724 code (which I
> haven't posted yet and really should)
I've thrown up this (unfinished) code at
https://github.com/eqvinox/linux/commits/rule-5-5-HEAD/
This is NOT a request for reviews of those changes; I'm still working
on things.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr
2025-11-04 14:48 ` [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr David Lamparter
2025-11-04 17:51 ` Lorenzo Colitti
@ 2025-11-11 9:50 ` Paolo Abeni
1 sibling, 0 replies; 13+ messages in thread
From: Paolo Abeni @ 2025-11-11 9:50 UTC (permalink / raw)
To: David Lamparter, netdev, Jakub Kicinski; +Cc: Lorenzo Colitti, Patrick Rohr
On 11/4/25 3:48 PM, David Lamparter wrote:
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 40e9c336f6c5..f20367156062 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1533,7 +1533,9 @@ struct ipv6_saddr_score {
> };
>
> struct ipv6_saddr_dst {
> - const struct in6_addr *addr;
> + const struct flowi6 *fl6;
> + const struct dst_entry *dst;
> + const struct sock *sk;
> int ifindex;
> int scope;
> int label;
Minor nit: please respect the reverse christmas tree above.
A much more relevant note: the code for the whole functionality would
help greatly to be able to properly review the patches.
Peaking over the shared git repo it looks like overall this work would
fit the 15 patches limit and would be manageable as a single series.
I suggest posting the whole work in the next iteration.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output
2025-11-04 14:48 ` [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output David Lamparter
2025-11-04 17:52 ` Lorenzo Colitti
@ 2025-11-11 9:56 ` Paolo Abeni
1 sibling, 0 replies; 13+ messages in thread
From: Paolo Abeni @ 2025-11-11 9:56 UTC (permalink / raw)
To: David Lamparter, netdev, Jakub Kicinski; +Cc: Lorenzo Colitti, Patrick Rohr
On 11/4/25 3:48 PM, David Lamparter wrote:
> Flatten ip6_route_get_saddr() into ip6_dst_lookup_tail (which really
> just means handling fib6_prefsrc), and then replace ipv6_dev_get_saddr
> with ipv6_fl_get_saddr to pass down the flow information.
What about replacing directly the call in ip6_route_get_saddr()? It
should make the patch (and series) smaller and more easily reviewable.
Since `daddr` is a always derived from `fl6` and `prefs` from `sk`, the
total number of argument will not increase.
/P
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-11-11 9:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 14:48 [RESEND PATCH net-next v2 0/4] net/ipv6: RFC6724 rule 5.5 preparations David Lamparter
2025-11-04 14:48 ` [RESEND PATCH net-next v2 1/4] net/ipv6: flatten ip6_route_get_saddr David Lamparter
2025-11-04 17:52 ` Lorenzo Colitti
2025-11-04 14:48 ` [RESEND PATCH net-next v2 2/4] net/ipv6: create ipv6_fl_get_saddr David Lamparter
2025-11-04 17:51 ` Lorenzo Colitti
2025-11-04 20:47 ` David Lamparter
2025-11-04 21:16 ` David Lamparter
2025-11-11 9:50 ` Paolo Abeni
2025-11-04 14:48 ` [RESEND PATCH net-next v2 3/4] net/ipv6: use ipv6_fl_get_saddr in output David Lamparter
2025-11-04 17:52 ` Lorenzo Colitti
2025-11-11 9:56 ` Paolo Abeni
2025-11-04 14:48 ` [RESEND PATCH net-next v2 4/4] net/ipv6: drop ip6_route_get_saddr David Lamparter
2025-11-04 17:51 ` Lorenzo Colitti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).