Thanks for the feedback Vincent and Vladimir! Le Sun, 14 Mar 2021 16:12:05 -0700, Vladimir Sedach <[email protected]> a écrit :
> Julien Lepiller <[email protected]> writes: > > I'm proud to announce the first release of Guile Netlink! > > This is great! I have been wishing for this for Guile ever since I > started using Guix. Thank you. > > Vincent Legoll <[email protected]> writes: > >> (addr-add "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t) > > > > what does the "ipv6?" parameter add ? This could be > > deduced from the address length, no ? > > IPv6 configuration is so different from IPv4 configuration that I > think it should have its own functions, not just a keyword parameter. > > For example, right now you cannot assign multiple static IPv6 > addresses to the same interface (a basic IPv6 task) with > static-networking-service. Putting the conditional logic for IPv4 > versus IPv6 rules inside the same functions is an invitation for more > similar bugs. Trying to dispatch based on parsing the provided string > makes it even more confusing. Dispatching based on a keyword > parameter is not much better, and introduces the possibility of user > error ("I forgot the #:ipv6 keyword"). The high-level API is just a wrapper around the low-level API, and in rtnetlink, the only different between IPv4 and IPv6 is a family parameter in message, namely AF_INET or AF_INET6. Basically, the messages are exactly the same, except that in the IPv6 case, you use IPv6 addresses which obviously take a little bit more space, so I expect the wrappers to work the same. If you want multiple addresses on the same interface, you can simply call addr-add multiple times, one per address, and that has nothing to do with whether it is IPv6 or IPv4 (you can have multiple IPv4 addresses on the same interface). I don't think there's any reason why the procedures should be separate between IPv4 and IPv6. I like the idea of deducing IPv4 vs IPv6 from address format (not length though, as that may vary and overlap. After all, 1.1 and ::1 are valid IPv4 and IPv6 addresses of the same length ;)). But simply detecting a dot vs a colon should work well. I've always been bothered by "ip" vs "ip -6". I don't really like the idea of having to separate the address and prefix len, simply because this is the notation used by iproute2. It's also easier for consumers of the API: you pass a string that contains all the information, and don't really have to care. > > -- > Vladimir Sedach > Software engineering services in Los Angeles https://oneofus.la
