aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorW. Kosior <koszko@koszko.org>2025-02-17 12:25:32 +0100
committerW. Kosior <koszko@koszko.org>2025-03-21 13:59:34 +0100
commit7978f390867bb597eb671ce77dcda58fbf09534b (patch)
treef139cdbd1078bf43e139ebc1fd486b69326342e5
parent14fb5d85e8c4b80c19cd0d1acfe44c5f6f2149da (diff)
downloadguix-7978f390867bb597eb671ce77dcda58fbf09534b.tar.gz
guix-7978f390867bb597eb671ce77dcda58fbf09534b.zip
services: openvpn: Allow OpenVPN client to dictate route(s) it sets.
* gnu/services/vpn.scm (maybe-ip-mask?): New variable. (serialize-maybe-ip-mask): New variable. (pull-route?): New variable. (serialize-pull-route): New variable. (openvpn-client-configuration)[pull-route?]: New field. (openvpn-client-configuration)[route]: New field. Change-Id: Ief6390e905612420ad249c9ecd80a46caad2e378
-rw-r--r--gnu/services/vpn.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index c91133f5ec..92f17cf5ff 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -13,6 +13,9 @@
;;; Copyright © 2022 Timo Wilken <guix@twilken.net>
;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
+;;; Copyright © 2024-2025 Wojtek Kosior <koszko@koszko.org>
+;;; Additions and modifications by Wojtek Kosior are additionally
+;;; dual-licensed under the Creative Commons Zero v1.0.
;;; Copyright © 2025 Carlo Zancanaro <carlo@zancanaro.id.au>
;;;
;;; This file is part of GNU Guix.
@@ -140,6 +143,12 @@
#f)))
(define serialize-ip-mask serialize-string)
+(define (maybe-ip-mask? value)
+ (or (not value) (ip-mask? value)))
+(define (serialize-maybe-ip-mask field-name value)
+ (when value
+ (serialize-ip-mask field-name value)))
+
(define-syntax define-enumerated-field-type
(lambda (x)
(define (id-append ctx . parts)
@@ -175,6 +184,10 @@
(format #t "resolv-retry infinite\n")
#f))
+(define pull-route? boolean?)
+(define (serialize-pull-route field-name value)
+ (format #t "~:[route-nopull~%~;~]" value))
+
(define use-up-down-scripts? boolean?)
(define serialize-use-up-down-scripts empty-serializer)
@@ -429,6 +442,14 @@ would be added to the store and readable by any user.")
(openvpn-remote-list '())
"A list of remote servers to connect to.")
+ (pull-route?
+ (pull-route #t)
+ "Respect IP routing rules and DHCP options sent by the server.")
+
+ (route
+ (maybe-ip-mask #f)
+ "Network routed through the VPN.")
+
(use-up-down-scripts?
(use-up-down-scripts #f)
"Run client.up and client.down scripts included with OpenVPN."))