* [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING.
@ 2017-07-04 0:39 Danny Milosavljevic
2017-07-04 0:46 ` [bug#27570] [PATCH] syscalls: Export " Danny Milosavljevic
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Danny Milosavljevic @ 2017-07-04 0:39 UTC (permalink / raw)
To: 27570
* guix/build/syscalls.scm (IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING):
New variables. Export them.
---
guix/build/syscalls.scm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 9c082b435..7dfa41691 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -88,6 +88,10 @@
PF_PACKET
AF_PACKET
+ IFF_UP
+ IFF_BROADCAST
+ IFF_LOOPBACK
+ IFF_RUNNING
all-network-interface-names
network-interface-names
network-interface-netmask
@@ -1109,6 +1113,11 @@ bytes."
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
+(define IFF_UP #x1) ;Interface is up
+(define IFF_BROADCAST #x2) ;Broadcast address valid.
+(define IFF_LOOPBACK #x8) ;Is a loopback net.
+(define IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
+
(define IF_NAMESIZE 16) ;maximum interface name size
(define-c-struct %ifconf-struct
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#27570] [PATCH] syscalls: Export IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING.
2017-07-04 0:39 [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Danny Milosavljevic
@ 2017-07-04 0:46 ` Danny Milosavljevic
2017-07-04 0:56 ` [bug#27570] [PATCH v3] syscalls: Add network-interface-running? Danny Milosavljevic
2017-07-10 10:15 ` [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Ludovic Courtès
2 siblings, 0 replies; 6+ messages in thread
From: Danny Milosavljevic @ 2017-07-04 0:46 UTC (permalink / raw)
To: 27570
* guix/build/syscalls.scm (IFF_RUNNING): New variable.
(IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING): Export.
---
guix/build/syscalls.scm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 9c082b435..9e2b7a0ca 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -88,6 +88,10 @@
PF_PACKET
AF_PACKET
+ IFF_UP
+ IFF_BROADCAST
+ IFF_LOOPBACK
+ IFF_RUNNING
all-network-interface-names
network-interface-names
network-interface-netmask
@@ -1108,6 +1112,7 @@ bytes."
(define-as-needed IFF_UP #x1) ;Interface is up
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
+(define-as-needed IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
(define IF_NAMESIZE 16) ;maximum interface name size
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#27570] [PATCH v3] syscalls: Add network-interface-running?
2017-07-04 0:39 [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Danny Milosavljevic
2017-07-04 0:46 ` [bug#27570] [PATCH] syscalls: Export " Danny Milosavljevic
@ 2017-07-04 0:56 ` Danny Milosavljevic
2017-07-10 10:18 ` Ludovic Courtès
2017-07-10 10:15 ` [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Ludovic Courtès
2 siblings, 1 reply; 6+ messages in thread
From: Danny Milosavljevic @ 2017-07-04 0:56 UTC (permalink / raw)
To: 27570
* guix/build/syscalls.scm (network-interface-running?): New variable.
Export it.
---
guix/build/syscalls.scm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 9c082b435..5a6662afe 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -88,6 +88,7 @@
PF_PACKET
AF_PACKET
+ network-interface-running?
all-network-interface-names
network-interface-names
network-interface-netmask
@@ -1108,6 +1109,7 @@ bytes."
(define-as-needed IFF_UP #x1) ;Interface is up
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
+(define-as-needed IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
(define IF_NAMESIZE 16) ;maximum interface name size
@@ -1282,6 +1284,13 @@ interface NAME."
(close-port sock)
(not (zero? (logand flags IFF_LOOPBACK)))))
+(define (network-interface-running? name)
+ "Return true if NAME designates a running network interface."
+ (let* ((sock (socket SOCK_STREAM AF_INET 0))
+ (flags (network-interface-flags sock name)))
+ (close-port sock)
+ (not (zero? (logand flags IFF_RUNNING)))))
+
(define-as-needed (set-network-interface-flags socket name flags)
"Set the flag of network interface NAME to FLAGS."
(let ((req (make-bytevector ifreq-struct-size)))
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING.
2017-07-04 0:39 [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Danny Milosavljevic
2017-07-04 0:46 ` [bug#27570] [PATCH] syscalls: Export " Danny Milosavljevic
2017-07-04 0:56 ` [bug#27570] [PATCH v3] syscalls: Add network-interface-running? Danny Milosavljevic
@ 2017-07-10 10:15 ` Ludovic Courtès
2 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2017-07-10 10:15 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 27570
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> * guix/build/syscalls.scm (IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING):
> New variables. Export them.
> ---
> guix/build/syscalls.scm | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
> index 9c082b435..7dfa41691 100644
> --- a/guix/build/syscalls.scm
> +++ b/guix/build/syscalls.scm
> @@ -88,6 +88,10 @@
>
> PF_PACKET
> AF_PACKET
> + IFF_UP
> + IFF_BROADCAST
> + IFF_LOOPBACK
> + IFF_RUNNING
> all-network-interface-names
> network-interface-names
> network-interface-netmask
> @@ -1109,6 +1113,11 @@ bytes."
> (define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
> (define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
>
> +(define IFF_UP #x1) ;Interface is up
> +(define IFF_BROADCAST #x2) ;Broadcast address valid.
> +(define IFF_LOOPBACK #x8) ;Is a loopback net.
> +(define IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
Please use ‘define-as-needed’ here. OK with this change, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#27570] [PATCH v3] syscalls: Add network-interface-running?
2017-07-04 0:56 ` [bug#27570] [PATCH v3] syscalls: Add network-interface-running? Danny Milosavljevic
@ 2017-07-10 10:18 ` Ludovic Courtès
2017-07-10 14:30 ` Danny Milosavljevic
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2017-07-10 10:18 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: 27570
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> * guix/build/syscalls.scm (network-interface-running?): New variable.
> Export it.
> ---
> guix/build/syscalls.scm | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
> index 9c082b435..5a6662afe 100644
> --- a/guix/build/syscalls.scm
> +++ b/guix/build/syscalls.scm
> @@ -88,6 +88,7 @@
>
> PF_PACKET
> AF_PACKET
> + network-interface-running?
> all-network-interface-names
> network-interface-names
> network-interface-netmask
> @@ -1108,6 +1109,7 @@ bytes."
> (define-as-needed IFF_UP #x1) ;Interface is up
> (define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
> (define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
> +(define-as-needed IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
>
> (define IF_NAMESIZE 16) ;maximum interface name size
>
> @@ -1282,6 +1284,13 @@ interface NAME."
> (close-port sock)
> (not (zero? (logand flags IFF_LOOPBACK)))))
>
> +(define (network-interface-running? name)
> + "Return true if NAME designates a running network interface."
> + (let* ((sock (socket SOCK_STREAM AF_INET 0))
> + (flags (network-interface-flags sock name)))
> + (close-port sock)
> + (not (zero? (logand flags IFF_RUNNING)))))
Could you also add a test in tests/syscalls.scm along the lines of the
‘loopback-network-interface?’ test that’s there? (I think the test can
assume that “lo” is running.)
OK with this change.
(And you can disregard the reply I sent just before.)
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#27570] [PATCH v3] syscalls: Add network-interface-running?
2017-07-10 10:18 ` Ludovic Courtès
@ 2017-07-10 14:30 ` Danny Milosavljevic
0 siblings, 0 replies; 6+ messages in thread
From: Danny Milosavljevic @ 2017-07-10 14:30 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 27570
> Could you also add a test in tests/syscalls.scm along the lines of the
> ‘loopback-network-interface?’ test that’s there? (I think the test can
> assume that “lo” is running.)
I did that now, however "make check" seems to be skipping the syscall tests. How do I run them?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-10 14:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-04 0:39 [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Danny Milosavljevic
2017-07-04 0:46 ` [bug#27570] [PATCH] syscalls: Export " Danny Milosavljevic
2017-07-04 0:56 ` [bug#27570] [PATCH v3] syscalls: Add network-interface-running? Danny Milosavljevic
2017-07-10 10:18 ` Ludovic Courtès
2017-07-10 14:30 ` Danny Milosavljevic
2017-07-10 10:15 ` [bug#27570] [PATCH] syscalls: Add IFF_UP, IFF_BROADCAST, IFF_LOOPBACK, IFF_RUNNING Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.