Hi Tristan,

On Sat, Mar 09, 2024 at 04:20:21PM +0000, Tristan wrote:
> To be honest, I don't think this is unfixable. It's just a matter of how
> much code change we think is acceptable for it.

I don't mind about the amount of changes. "we've always done it like this"
is never a valid excuse to keep code as it is, especially when it's wrong
and causes difficulties to add new features. Of course I prefer invasive
changes early in the dev cycle than late but we're still OK and I don't
expect that many changes for this anyway.

> If push comes to shove, one
> can always add an extra field somewhere, or an extra arg in get_addr_len,
> even if it'd be a little ugly.

Actually you're totally right and you make me realize that there's an
addrcmp field in the address families, and it's inconsistent to have
get_addr_len() being family-agnostic. So most likely we should first
change get_addr_len() to be per-family and appear in the proto_fam
struct. The few places where get_addr_len() is used should instead
rely on the protocol family for this. And due to this new address
having a variable length, we should support passing a pointer to the
address (like the current get_addr_len() does) in addition to the
protocol pointer.

Doing so would cleanly unlock all the problem. The new abns2 family
would just bring its own get_addr_len() variant that uses strlen().

This just shows how important it is to discuss about design ;-)

Cheers,
Willy

Reply via email to