unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Guile Netlink 1.0 released
@ 2021-03-14 19:31 Julien Lepiller
  2021-03-14 20:40 ` Vincent Legoll
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julien Lepiller @ 2021-03-14 19:31 UTC (permalink / raw)
  To: guix-devel

Hi!

I'm proud to announce the first release of Guile Netlink!

  git clone https://git.lepiller.eu/git/guile-netlink
  cd guile-netlink
  git checkout 1.0 # or 29ff43368f1cc2d10a7e5f09dc9f80f85582d6ee
  git tag -v 1.0

The 'git tag -v' command check the authenticity of your checkout. You
may need to retrieve the signing key first:

  gpg --keyserver pool.sks-keyservers.net \
      --recv-keys 1EFB09091F17D28CCBF9B13A53D457B2D636EE82

Guile Netlink provides three components:

- A helper library for implementing netlink protocols
- An implementation of rtnetlink, one of the netlink protocols. It is
  used to query and alter the state of the network stack in Linux.
- A high-level API implemented on top of rtnetlink and inspired by
  iproute2's commands

Here are a few examples (most of which will only work as root and will
really modify your network), extracted from the manual:

  ;; same as "ip l add v0p0 type veth peer v0p1"
  (link-add "v0p0" "veth" #:type-args '((peer . "v0p1")))

  ;; same as "ip a add 192.0.2.15/24 dev enp1s0
  (addr-add "enp1s0" "192.0.2.15/24")
  (addr-add "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t)

  ;; removing the previous addresses, as in "ip a del 192.0.2.15/24 dev
  ;; enp1s0"
  (addr-del "enp1s0" "192.0.2.15/24")
  (addr-del "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t)

  ;; same as "ip a" or "ip addr show"
  (addr-show)

  ;; same as "ip r add default via 192.0.2.1 dev enp1s0"
  (route-add "default" #:device "enp1s0" #:via "192.0.2.1")
  ;; same as "ip r add 192.0.2.0/24 dev enp1s0 src 192.0.2.15"
  (route-add "192.0.2.0/24" #:device "enp1s0" #:src "192.0.2.15")

Hopefully, the high-level API can be used on Linux to replace our
current implementation of container networking and static networking
service type.

You will find the complete documentation online at
https://git.lepiller.eu/guile-netlink/manual, the code is available at
https://git.lepiller.eu/guile-netlink (note that the clone URL is
different, see above) and you can report any issue, patch and ideas to
me, by email.

Hope you'll enjoy!

Julien


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Guile Netlink 1.0 released
  2021-03-14 19:31 Guile Netlink 1.0 released Julien Lepiller
@ 2021-03-14 20:40 ` Vincent Legoll
  2021-03-14 23:12   ` Vladimir Sedach
  2021-03-15 10:17 ` Léo Le Bouter
  2021-03-15 17:12 ` Ludovic Courtès
  2 siblings, 1 reply; 6+ messages in thread
From: Vincent Legoll @ 2021-03-14 20:40 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Hello,

just a few questions about the API

On Sun, Mar 14, 2021 at 8:31 PM Julien Lepiller <julien@lepiller.eu> wrote:

>   ;; same as "ip a add 192.0.2.15/24 dev enp1s0
>   (addr-add "enp1s0" "192.0.2.15/24")

Why not separating the netmask from the address ?

It forces to do string manipulation, and prevent
the use of bitfield, or the dotted bytes representation
"255.255.255.0".

>   (addr-add "enp1s0" "2001:db8::1a4c/64" #:ipv6? #t)

what does the "ipv6?" parameter add ? This could be
deduced from the address length, no ?

>   ;; same as "ip r add default via 192.0.2.1 dev enp1s0"
>   (route-add "default" #:device "enp1s0" #:via "192.0.2.1")

"via" could also be called "gateway" (maybe that's an oldtimer
thing ;-) )

But that's all kind of bikesheddy...

-- 
Vincent Legoll


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Guile Netlink 1.0 released
  2021-03-14 20:40 ` Vincent Legoll
@ 2021-03-14 23:12   ` Vladimir Sedach
  2021-03-14 23:59     ` Julien Lepiller
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Sedach @ 2021-03-14 23:12 UTC (permalink / raw)
  To: Vincent Legoll; +Cc: guix-devel


Julien Lepiller <julien@lepiller.eu> 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 <vincent.legoll@gmail.com> 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").

--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Guile Netlink 1.0 released
  2021-03-14 23:12   ` Vladimir Sedach
@ 2021-03-14 23:59     ` Julien Lepiller
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Lepiller @ 2021-03-14 23:59 UTC (permalink / raw)
  To: Vladimir Sedach; +Cc: guix-devel

Thanks for the feedback Vincent and Vladimir!

Le Sun, 14 Mar 2021 16:12:05 -0700,
Vladimir Sedach <vas@oneofus.la> a écrit :

> Julien Lepiller <julien@lepiller.eu> 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 <vincent.legoll@gmail.com> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Guile Netlink 1.0 released
  2021-03-14 19:31 Guile Netlink 1.0 released Julien Lepiller
  2021-03-14 20:40 ` Vincent Legoll
@ 2021-03-15 10:17 ` Léo Le Bouter
  2021-03-15 17:12 ` Ludovic Courtès
  2 siblings, 0 replies; 6+ messages in thread
From: Léo Le Bouter @ 2021-03-15 10:17 UTC (permalink / raw)
  To: Julien Lepiller, guix-devel

[-- Attachment #1: Type: text/plain, Size: 41 bytes --]

Exciting new possibilities! Great work!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Guile Netlink 1.0 released
  2021-03-14 19:31 Guile Netlink 1.0 released Julien Lepiller
  2021-03-14 20:40 ` Vincent Legoll
  2021-03-15 10:17 ` Léo Le Bouter
@ 2021-03-15 17:12 ` Ludovic Courtès
  2 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2021-03-15 17:12 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: guix-devel

Hi Julien,

Julien Lepiller <julien@lepiller.eu> skribis:

> I'm proud to announce the first release of Guile Netlink!
>
>   git clone https://git.lepiller.eu/git/guile-netlink
>   cd guile-netlink
>   git checkout 1.0 # or 29ff43368f1cc2d10a7e5f09dc9f80f85582d6ee
>   git tag -v 1.0

Yay, awesome!

Sounds like Guix will soon have a much nicer ‘static-networking’
service.  :-)

Ludo’.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-15 17:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-14 19:31 Guile Netlink 1.0 released Julien Lepiller
2021-03-14 20:40 ` Vincent Legoll
2021-03-14 23:12   ` Vladimir Sedach
2021-03-14 23:59     ` Julien Lepiller
2021-03-15 10:17 ` Léo Le Bouter
2021-03-15 17:12 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).