[PATCH] services: nfs: Expose configuration options for TCP and UDP.

DoneSubmitted by maxim.cournoyer.
Details
2 participants
  • Brice Waegeneire via web
  • maxim.cournoyer
Owner
unassigned
Severity
normal
M
M
maxim.cournoyer wrote on 24 May 2020 21:28
(name . guix-patches)(address . guix-patches@gnu.org)
874ks56sjw.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me
Hello!

While attempting to NFS boot an embedded board, it discovered that
U-Boot expects the server to listen to UDP, which it doesn't by default.

This patch adds a switch to make it possible to configure to what kind
of sockets (TCP/UDP or both) the NFS server listens to.

Maxim
From 0fffe89255c313ff3b7993f95627377046312a27 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 24 May 2020 15:04:45 -0400
Subject: [PATCH] services: nfs: Expose configuration options for TCP and UDP.

* gnu/services/nfs.scm (<nfs-configuration>)[nfsd-tcp?, nfsd-udp?]: New
fields.
(nfs-shepherd-services)[rpc.nfsd]: Populate the --{no-,}tcp and --{no-,}udp
command line options based on the values of the nfsd-tcp? and nfsd-upd?
fields.
* doc/guix.texi (Network File System): Add doc.
---
doc/guix.texi | 6 ++++++
gnu/services/nfs.scm | 14 +++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)

Toggle diff (65 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 216422fe31..fb18fa5831 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22791,6 +22791,12 @@ The network port that the @command{nfsd} daemon should use.
 @item @code{nfsd-threads} (default: @code{8})
 The number of threads used by the @command{nfsd} daemon.
 
+@item @code{nfsd-tcp?} (default: @code{#t})
+Whether the @command{nfsd} daemon should listen on a TCP socket.
+
+@item @code{nfsd-udp?} (default: @code{#f})
+Whether the @command{nfsd} daemon should listen on a UDP socket.
+
 @item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
 The directory where the pipefs file system is mounted.
 
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 4e358197e2..859097e788 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -261,6 +262,10 @@
                        (default 2049))
   (nfsd-threads        nfs-configuration-nfsd-threads
                        (default 8))
+  (nfsd-tcp?           nfs-configuration-nfsd-tcp?
+                       (default #t))
+  (nfsd-udp?           nfs-configuration-nfsd-udp?
+                       (default #f))
   (pipefs-directory    nfs-configuration-pipefs-directory
                        (default default-pipefs-directory))
   ;; List of modules to debug; any of nfsd, nfs, rpc, idmap, statd, or mountd.
@@ -272,6 +277,7 @@
   (match-record config <nfs-configuration>
     (nfs-utils nfs-versions exports
                rpcmountd-port rpcstatd-port nfsd-port nfsd-threads
+               nfsd-tcp? nfsd-udp?
                pipefs-directory debug)
     (list (shepherd-service
            (documentation "Mount the nfsd pseudo file system.")
@@ -332,7 +338,13 @@
                                #$@(map (lambda (version)
                                          (string-append "--nfs-version=" version))
                                        nfs-versions)
-                               #$(number->string nfsd-threads))))))
+                               #$(number->string nfsd-threads)
+                               #$(if nfsd-tcp?
+                                     "--tcp"
+                                     "--no-tcp")
+                               #$(if nfsd-udp?
+                                     "--udp"
+                                     "--no-udp"))))))
            (stop
             #~(lambda _
                 (zero?
-- 
2.26.2
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJ9WGpPiQCFQyn/CfEmDkZILmNWIFAl7KyvQACgkQEmDkZILm
NWKdoA/9FKPMhUaWIT1p5azLbJ1Aea9vvSYnB5L5xxYf8VDgJTV1C27ASO9zYWVA
5UvA7bA2sCSXiRhe09BYIhJzP61LWYNeqpBoVKL7oU96GHmWnY79DklDBkqTuV3q
Tm3ngmiGEy0YRqHCj0SVZgePZe7aCYidGVj7glptgfR9kkkyfIqZkUott3ube4Ml
JfdPOalfRF27bIG8QUPQXYgXPRh/C02BY5OQadxwsaMtGh7fal5UuPZquWsgq5n5
KmByOpOhqrEndbLZ3EejO32/UyqYunR3sFhKEvZSckjDJHjKcF1WPfxbujGeR4DK
tUPxilW4udHo1csLmcfQ6Ew3xEKRUGDWIDkduwHIgb+Qcg09Ld3miB42qAx1nI58
09P04QXf02gx8H1+g3zt/egTwiP+uo1abD3F8byeIZzVHBIYAC8zTUv8VriOK8C8
e+w0h1bk3FizYQ5yUN7tOO3TNS8LPWqGUhT29vP4U+VqvyK7KJfiLl6nnfhcC/Tn
ZQnf0z43fj6TmwP5rHyIvPK6k3e6mcvXBk6zV3S+imtWe/brJfrwB97wYuenXraW
+ukuP7BchbLNg5vNFBPHAOdGkW9xAhnVU4NeT4JMWnCLSoyKtw1J+rxrfotp3uKW
g2yiGX0ll7JlbOI6MutiB8ACV+zXLNiLllrdDTK1NSbDTO/5yQE=
=jGmJ
-----END PGP SIGNATURE-----

B
B
Brice Waegeneire via web wrote on 24 May 2020 21:47
(address . 41515@debbugs.gnu.org)
7f41efe91f60.887c6322cf6f173@guile.gnu.org
maxim.cournoyer wrote:
Toggle quote (6 lines)
> * gnu/services/nfs.scm (<nfs-configuration>)[nfsd-tcp?, nfsd-udp?]: Newfields.(nfs-shepherd-services)[rpc.nfsd]: Populate the --{no-,}tcp and --{no-,}udpcommand line options based on the values of the nfsd-tcp? and nfsd-upd?fields.
> * doc/guix.texi (Network File System): Add doc.
> ---
> doc/guix.texi | 6 ++++++
> gnu/services/nfs.scm | 14 +++++++++++++-

LGTM!
M
M
Maxim Cournoyer wrote on 30 May 2020 06:57
(name . Brice Waegeneire via web)(address . issues.guix.gnu.org@elephly.net)(address . 41515-done@debbugs.gnu.org)
87h7vyxbnl.fsf@gmail.com
Hello Brice!

Brice Waegeneire via web <issues.guix.gnu.org@elephly.net> writes:

Toggle quote (12 lines)
> maxim.cournoyer wrote:
>> * gnu/services/nfs.scm (<nfs-configuration>)[nfsd-tcp?, nfsd-udp?]:
>> Newfields.(nfs-shepherd-services)[rpc.nfsd]: Populate the
>> --{no-,}tcp and --{no-,}udpcommand line options based on the values
>> of the nfsd-tcp? and nfsd-upd?fields.
>> * doc/guix.texi (Network File System): Add doc.
>> ---
>> doc/guix.texi | 6 ++++++
>> gnu/services/nfs.scm | 14 +++++++++++++-
>
> LGTM!

That was quick! For some reason I didn't get your reply, because only
emails addressed directly to me reach my inbox (others are refiled to
groups). That's usually fine as when people send wide replies it sends a
copy to the original poster, not just to the debbugs email.

Perhaps we could improve issues.guix.gnu.org to send wide replies to all
participants if it has their email address available.

Anyway, pushed as commit c08fac0f7d :-).

Thank you!

Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 41515@debbugs.gnu.org