diff mbox series

[bug#51565] PATCH: Update Yggdrasil to new protocol (important breaking changes)

Message ID 20211102065917.082a2e55@riseup.net
State Accepted
Headers show
Series [bug#51565] PATCH: Update Yggdrasil to new protocol (important breaking changes) | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Csepp Nov. 2, 2021, 6:59 a.m. UTC
This is way overdue.

Credit for the packaging work:
https://github.com/bqv/rc/blob/live/rc/packages/yggdrasil.scm

It did need some more work though. The Go importer leaves a few things
to be desired, but that's for another thread.

Anyways, I tested it and it works. System service could be restarted
after a reconfigure without any issues.

Please apply this soon, because nodes running the outdated versions
can't connect to ones running this new version, due to breaking
protocol changes.

Comments

pukkamustard Nov. 15, 2021, 2:10 p.m. UTC | #1
Thanks for this!

Some minor changes may be needed to make the linter happy:

raingloom <raingloom@riseup.net> writes:

[..]

> [3. text/x-patch; 0002-gnu-Add-go-github-com-rivo-uniseg.patch]...

Linter complains that a line is too long:

gnu/packages/golang.scm:8885:0: go-github-com-rivo-uniseg@0.2.0: line 8885 is way too long (93 characters)

>
> [4. text/x-patch; 0003-gnu-Add-go-github-com-mattn-go-runewidth.patch]...

Linter complains about the synopsis. Maybe: "Go functions for getting
fixed width of characters or strings"?

Does seem like a bit of a duplication of the description...

> [5. text/x-patch; 0004-gnu-go-github-com-cheggaaa-pb-Update-to-3.0.8.patch]...
>
> [6. text/x-patch; 0005-gnu-Rename-go-github-com-cheggaaa-pb-to-go-github-co.patch]...
>
> [7. text/x-patch; 0006-gnu-Add-go-github-com-arceliar-ironwood.patch]...

Lines in descriptions are too long and should be wrapped.

A synopsis is required. Maybe: "Ironwood is a Go network routing library
using cryptographic keys as addresses"?
Ricardo Wurmus Dec. 1, 2021, 4:04 p.m. UTC | #2
Ludo’s review overlapped my review.  I’ve already made all the 
changes that Ludo requested.

+ changed the descriptions
+ recorded all changes in the commit
+ added a deprecated-package in the rename commit
+ fixed indentation

Commit d9956e938343c7637647ad10b977fdb0f3b8b138 updates yggdrasil 
to 0.4.1.
Ludovic Courtès Dec. 2, 2021, 9:16 a.m. UTC | #3
Hi,

Ricardo Wurmus <rekado@elephly.net> skribis:

> Ludo’s review overlapped my review.  I’ve already made all the changes
> that Ludo requested.
>
> + changed the descriptions
> + recorded all changes in the commit
> + added a deprecated-package in the rename commit
> + fixed indentation
>
> Commit d9956e938343c7637647ad10b977fdb0f3b8b138 updates yggdrasil to
> 0.4.1.

Ah wonderful, thank you!

Ludo’.
diff mbox series

Patch

From 73c240e5bb2310a1c66978a0f1b08fc5450b7b3c Mon Sep 17 00:00:00 2001
From: raingloom <raingloom@riseup.net>
Date: Tue, 2 Nov 2021 06:51:10 +0000
Subject: [PATCH 7/7] gnu: yggdrasil: Update to 0.4.0.

* gnu/packages/patches/yggdrasil-extra-config.patch: Update patch.
* gnu/packages/networking.scm (yggdrasil): Update to 0.4.0.
[propagated-inputs]: Remove go-github-com-cheggaaa-pb; add go-golang-org-x-sys,
go-github-com-mattn-go-runewidth, go-github-com-mattn-go-isatty,
go-github-com-fatih-color, go-github-com-cheggaaa-pb-v3,
go-github-com-vividcortex-ewma, and go-github-com-arceliar-ironwood.
---
 gnu/packages/networking.scm                   | 55 +++++++++++++------
 .../patches/yggdrasil-extra-config.patch      | 53 ++++++++++--------
 2 files changed, 69 insertions(+), 39 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 8ac3b0095e..d1a437e177 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -4086,7 +4086,7 @@  (define-public nbd
 (define-public yggdrasil
   (package
     (name "yggdrasil")
-    (version "0.3.16")
+    (version "0.4.0")
     (source
      (origin
        (method git-fetch)
@@ -4097,7 +4097,7 @@  (define-public yggdrasil
          (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0vyd7a333hwn6j1lv1g9sicw74a4qk982bsi3cfdhjlv6hsjwmil"))
+        (base32 "0mmqw6w5a6ph49xd1yzb7i70xg466k9pi5sdvplhb66x68wipixh"))
        (patches (search-patches "yggdrasil-extra-config.patch"))))
     (build-system go-build-system)
     (arguments
@@ -4114,7 +4114,7 @@  (define-public yggdrasil
                           "go" "build" "-v" "-ldflags=-s -w"
                           (string-append
                            "github.com/yggdrasil-network/yggdrasil-go/cmd/" c)))
-                       (list "yggdrasil" "yggdrasilctl"))
+                       (list "yggdrasil" "yggdrasilctl" "genkeys"))
                       #t))
                   (replace 'install
                     (lambda* (#:key outputs #:allow-other-keys)
@@ -4125,7 +4125,7 @@  (define-public yggdrasil
                         (for-each
                          (lambda (f)
                            (install-file f bin))
-                         (list "yggdrasil" "yggdrasilctl"))
+                         (list "yggdrasil" "yggdrasilctl" "genkeys"))
                         (mkdir-p doc)
                         (copy-recursively
                          (string-append
@@ -4135,20 +4135,43 @@  (define-public yggdrasil
                       #t)))))
     ;; https://github.com/kardianos/minwinsvc is windows only
     (propagated-inputs
-     `(("go-github-com-arceliar-phony" ,go-github-com-arceliar-phony)
-       ("go-github-com-cheggaaa-pb" ,go-github-com-cheggaaa-pb)
-       ("go-github-com-gologme-log" ,go-github-com-gologme-log)
-       ("go-github-com-hashicorp-go-syslog" ,go-github-com-hashicorp-go-syslog)
-       ("go-github-com-hjson-hjson-go" ,go-github-com-hjson-hjson-go)
-       ("go-github-com-kardianos-minwinsvc" ,go-github-com-kardianos-minwinsvc)
+     `(;;("go-golang-zx2c4-com-wireguard-windows"
+       ;; ,go-golang-zx2c4-com-wireguard-windows)
+       ("go-golang-zx2c4-com-wireguard"
+        ,go-golang-zx2c4-com-wireguard)
+       ("go-golang-org-x-text" ,go-golang-org-x-text)
+       ("go-golang-org-x-sys" ,go-golang-org-x-sys)
+       ("go-golang-org-x-net" ,go-golang-org-x-net)
+       ("go-golang-org-x-crypto"
+        ,go-golang-org-x-crypto)
+       ("go-netns"
+        ,go-netns)
+       ("go-netlink"
+        ,go-netlink)
        ("go-github-com-mitchellh-mapstructure"
         ,go-github-com-mitchellh-mapstructure)
-       ("go-golang-org-x-crypto" ,go-golang-org-x-crypto)
-       ("go-golang-org-x-net" ,go-golang-org-x-net)
-       ("go-golang-org-x-text" ,go-golang-org-x-text)
-       ("go-golang-zx2c4-com-wireguard" ,go-golang-zx2c4-com-wireguard)
-       ("go-netlink" ,go-netlink)
-       ("go-netns" ,go-netns)))
+       ("go-github-com-mattn-go-runewidth"
+        ,go-github-com-mattn-go-runewidth)
+       ("go-github-com-mattn-go-isatty"
+        ,go-github-com-mattn-go-isatty)
+       ("go-github-com-kardianos-minwinsvc"
+        ,go-github-com-kardianos-minwinsvc)
+       ("go-github-com-hjson-hjson-go"
+        ,go-github-com-hjson-hjson-go)
+       ("go-github-com-hashicorp-go-syslog"
+        ,go-github-com-hashicorp-go-syslog)
+       ("go-github-com-gologme-log"
+        ,go-github-com-gologme-log)
+       ("go-github-com-fatih-color"
+        ,go-github-com-fatih-color)
+       ("go-github-com-cheggaaa-pb-v3"
+        ,go-github-com-cheggaaa-pb-v3)
+       ("go-github-com-vividcortex-ewma"
+        ,go-github-com-vividcortex-ewma)
+       ("go-github-com-arceliar-phony"
+        ,go-github-com-arceliar-phony)
+       ("go-github-com-arceliar-ironwood"
+        ,go-github-com-arceliar-ironwood)))
     (home-page "https://yggdrasil-network.github.io/blog.html")
     (synopsis
      "Experiment in scalable routing as an encrypted IPv6 overlay network")
diff --git a/gnu/packages/patches/yggdrasil-extra-config.patch b/gnu/packages/patches/yggdrasil-extra-config.patch
index c21ca29a84..46fd3f15fc 100644
--- a/gnu/packages/patches/yggdrasil-extra-config.patch
+++ b/gnu/packages/patches/yggdrasil-extra-config.patch
@@ -3,25 +3,25 @@  index 813e950..08d35cc 100644
 --- a/cmd/yggdrasil/main.go
 +++ b/cmd/yggdrasil/main.go
 @@ -40,11 +40,12 @@ type node struct {
- 	admin     module.Module // admin.AdminSocket
+ 	admin     *admin.AdminSocket
  }
  
--func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config.NodeConfig {
-+func readConfig(useconf *bool, useconffile *string, extraconffile *string, normaliseconf *bool) *config.NodeConfig {
+-func readConfig(log *log.Logger, useconf bool, useconffile string, normaliseconf bool) *config.NodeConfig {
++func readConfig(log *log.Logger, useconf bool, useconffile string, extraconffile string, normaliseconf bool) *config.NodeConfig {
  	// Use a configuration file. If -useconf, the configuration will be read
  	// from stdin. If -useconffile, the configuration will be read from the
  	// filesystem.
  	var conf []byte
 +	var extraconf []byte
  	var err error
- 	if *useconffile != "" {
+ 	if useconffile != "" {
  		// Read the file from the filesystem
 @@ -56,6 +57,21 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
  	if err != nil {
  		panic(err)
  	}
-+	if *extraconffile != "" {
-+		extraconf, err = ioutil.ReadFile(*extraconffile);
++	if extraconffile != "" {
++		extraconf, err = ioutil.ReadFile(extraconffile);
 +	}
 +	if err != nil {
 +		panic(err)
@@ -30,7 +30,7 @@  index 813e950..08d35cc 100644
 +	// then parse the configuration we loaded above on top of it. The effect
 +	// of this is that any configuration item that is missing from the provided
 +	// configuration will use a sane default.
-+	cfg := config.GenerateConfig()
++	cfg := defaults.GenerateConfig()
 +	var confs [2][]byte
 +	confs[0]=conf
 +	confs[1]=extraconf
@@ -38,7 +38,7 @@  index 813e950..08d35cc 100644
  	// If there's a byte order mark - which Windows 10 is now incredibly fond of
  	// throwing everywhere when it's converting things into UTF-16 for the hell
  	// of it - remove it and decode back down into UTF-8. This is necessary
-@@ -69,11 +85,6 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
+@@ -69,11 +85,6 @@ func readConfig(log *log.Logger, useconf bool, useconffile string, normaliseconf bool) *config
  			panic(err)
  		}
  	}
@@ -46,11 +46,11 @@  index 813e950..08d35cc 100644
 -	// then parse the configuration we loaded above on top of it. The effect
 -	// of this is that any configuration item that is missing from the provided
 -	// configuration will use a sane default.
--	cfg := config.GenerateConfig()
+-	cfg := defaults.GenerateConfig()
  	var dat map[string]interface{}
  	if err := hjson.Unmarshal(conf, &dat); err != nil {
  		panic(err)
-@@ -112,6 +123,7 @@ func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config
+@@ -112,6 +123,7 @@ func readConfig(log *log.Logger, useconf *bool, useconffile *string, normaliseconf *bool) *config
  	if err = mapstructure.Decode(dat, &cfg); err != nil {
  		panic(err)
  	}
@@ -58,6 +58,14 @@  index 813e950..08d35cc 100644
  	return cfg
  }
  
+@@ -185,6 +197,7 @@ func main() {
+ 	genconf       bool
+ 	useconf       bool
+ 	useconffile   string
++	extraconffile string
+ 	normaliseconf bool
+ 	confjson      bool
+ 	autoconf      bool
 @@ -164,6 +176,7 @@ func main() {
  	genconf := flag.Bool("genconf", false, "print a new config to stdout")
  	useconf := flag.Bool("useconf", false, "read HJSON/JSON config from stdin")
@@ -66,21 +74,20 @@  index 813e950..08d35cc 100644
  	normaliseconf := flag.Bool("normaliseconf", false, "use in combination with either -useconf or -useconffile, outputs your configuration normalised")
  	confjson := flag.Bool("json", false, "print configuration from -genconf or -normaliseconf as JSON instead of HJSON")
  	autoconf := flag.Bool("autoconf", false, "automatic mode (dynamic IP, peer with IPv6 neighbors)")
+@@ -212,6 +225,7 @@ func main() {
+ 		genconf:       *genconf,
+ 		useconf:       *useconf,
+ 		useconffile:   *useconffile,
++		extraconffile: *extraconffile,
+ 		normaliseconf: *normaliseconf,
+ 		confjson:      *confjson,
+ 		autoconf:      *autoconf,
 @@ -187,7 +200,7 @@ func main() {
- 		cfg = config.GenerateConfig()
- 	case *useconffile != "" || *useconf:
+ 		cfg = defaults.GenerateConfig()
+ 	case args.useconffile != "" || args.useconf:
  		// Read the configuration from either stdin or from the filesystem
--		cfg = readConfig(useconf, useconffile, normaliseconf)
-+		cfg = readConfig(useconf, useconffile, extraconffile, normaliseconf)
+-		cfg = readConfig(logger, args.useconf, args.useconffile, args.normaliseconf)
++		cfg = readConfig(logger, args.useconf, args.useconffile, args.extraconffile, args.normaliseconf)
  		// If the -normaliseconf option was specified then remarshal the above
  		// configuration and print it back to stdout. This lets the user update
  		// their configuration file with newly mapped names (like above) or to
-@@ -332,7 +345,7 @@ func main() {
- 			goto exit
- 		case _ = <-r:
- 			if *useconffile != "" {
--				cfg = readConfig(useconf, useconffile, normaliseconf)
-+				cfg = readConfig(useconf, useconffile, extraconffile, normaliseconf)
- 				logger.Infoln("Reloading configuration from", *useconffile)
- 				n.core.UpdateConfig(cfg)
- 				n.tuntap.UpdateConfig(cfg)
-- 
2.33.1