aboutsummaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-11-20 23:35:25 +0100
committerLudovic Courtès <ludo@gnu.org>2016-11-21 00:34:48 +0100
commit9e38e3cf527d907b499f8fc909aac5d0e25a5af7 (patch)
tree653453a33f7a077748da962d07237100d71d45f8 /tests/syscalls.scm
parent8eb790f368be5d7beac728e55093b6a3ea22328b (diff)
downloadguix-9e38e3cf527d907b499f8fc909aac5d0e25a5af7.tar
guix-9e38e3cf527d907b499f8fc909aac5d0e25a5af7.tar.gz
syscalls: Add 'add-network-route/gateway' and 'delete-network-route'.
* guix/build/syscalls.scm (SIOCADDRT, SIOCDELRT): New variables. (%rtentry): New C struct. (RTF_UP, RTF_GATEWAY, %sockaddr-any): New variables. (add-network-route/gateway, delete-network-route): New procedures. * tests/syscalls.scm ("add-network-route/gateway") ("delete-network-route"): New tests.
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index fd177265f0..e4ef32c522 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -374,6 +374,30 @@
(#f #f)
(lo (interface-address lo)))))))
+(test-skip (if (zero? (getuid)) 1 0))
+(test-assert "add-network-route/gateway"
+ (let ((sock (socket AF_INET SOCK_STREAM 0))
+ (gateway (make-socket-address AF_INET
+ (inet-pton AF_INET "192.168.0.1")
+ 0)))
+ (catch 'system-error
+ (lambda ()
+ (add-network-route/gateway sock gateway))
+ (lambda args
+ (close-port sock)
+ (memv (system-error-errno args) (list EPERM EACCES))))))
+
+(test-skip (if (zero? (getuid)) 1 0))
+(test-assert "delete-network-route"
+ (let ((sock (socket AF_INET SOCK_STREAM 0))
+ (destination (make-socket-address AF_INET INADDR_ANY 0)))
+ (catch 'system-error
+ (lambda ()
+ (delete-network-route sock destination))
+ (lambda args
+ (close-port sock)
+ (memv (system-error-errno args) (list EPERM EACCES))))))
+
(test-equal "tcgetattr ENOTTY"
ENOTTY
(catch 'system-error