* [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces.
@ 2019-05-09 15:30 Marius Bakke
2019-05-09 15:39 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Marius Bakke @ 2019-05-09 15:30 UTC (permalink / raw)
To: 35652
[-- Attachment #1.1: Type: text/plain, Size: 436 bytes --]
Guix,
While testing #35563, I found that "dhcp-client" does not work on a
kernel that has CONFIG_IPV6_SIT=y.
The reason is that the system has a virtual "sit0" interface that is not
capable of ARP traffic, which dhclient does not approve of:
May 9 16:18:37 localhost dhclient: Unsupported device type 776 for "sit0"
You can `modprobe sit` on your system if you want to reproduce the
failure.
The attached patch solves it for me.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-services-dhcp-client-Ignore-interfaces-that-are-not-.patch --]
[-- Type: text/x-patch, Size: 2811 bytes --]
From 7724f24443392fdfc2c075909d9b64350f6578b2 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 9 May 2019 17:03:03 +0200
Subject: [PATCH] services: dhcp-client: Ignore interfaces that are not ARP
capable.
* guix/build/syscalls.scm (IFF_NOARP): New variable.
(arp-network-interface?): New public variable.
* gnu/services/networking.scm (dhcp-client-service-type): Filter interfaces
that do not support the ARP protocol.
---
gnu/services/networking.scm | 4 +++-
guix/build/syscalls.scm | 9 +++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 03b2c6e1ec..082a85f63d 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -190,7 +190,9 @@ fe80::1%lo0 apps.facebook.com\n")
;; interfaces are typically down at this point. Thus we perform
;; our own interface discovery here.
(define valid?
- (negate loopback-network-interface?))
+ (lambda (interface)
+ (and (arp-network-interface? interface)
+ (not (loopback-network-interface? interface)))))
(define ifaces
(filter valid? (all-network-interface-names)))
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 749616ceb1..74428dbf56 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -104,6 +104,7 @@
network-interface-netmask
network-interface-running?
loopback-network-interface?
+ arp-network-interface?
network-interface-address
set-network-interface-netmask
set-network-interface-up
@@ -1160,6 +1161,7 @@ bytes."
(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-as-needed IFF_NOARP #x80) ;no ARP protocol
(define IF_NAMESIZE 16) ;maximum interface name size
@@ -1341,6 +1343,13 @@ interface NAME."
(close-port sock)
(not (zero? (logand flags IFF_RUNNING)))))
+(define (arp-network-interface? name)
+ "Return true if NAME supports the ARP protocol."
+ (let* ((sock (socket SOCK_STREAM AF_INET 0))
+ (flags (network-interface-flags sock name)))
+ (close-port sock)
+ (zero? (logand flags IFF_NOARP))))
+
(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)))
--
2.21.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces.
2019-05-09 15:30 [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces Marius Bakke
@ 2019-05-09 15:39 ` Ludovic Courtès
2019-05-09 18:12 ` bug#35652: " Marius Bakke
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2019-05-09 15:39 UTC (permalink / raw)
To: Marius Bakke; +Cc: 35652
Hi Marius,
Good catch!
Marius Bakke <mbakke@fastmail.com> skribis:
> From 7724f24443392fdfc2c075909d9b64350f6578b2 Mon Sep 17 00:00:00 2001
> From: Marius Bakke <mbakke@fastmail.com>
> Date: Thu, 9 May 2019 17:03:03 +0200
> Subject: [PATCH] services: dhcp-client: Ignore interfaces that are not ARP
> capable.
>
> * guix/build/syscalls.scm (IFF_NOARP): New variable.
> (arp-network-interface?): New public variable.
> * gnu/services/networking.scm (dhcp-client-service-type): Filter interfaces
> that do not support the ARP protocol.
Could you make it two patches (one for syscalls.scm, and another one for
the rest)?
Otherwise LGTM, thank you!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#35652: [PATCH] services: dhcp-client: Ignore non-ARP network interfaces.
2019-05-09 15:39 ` Ludovic Courtès
@ 2019-05-09 18:12 ` Marius Bakke
0 siblings, 0 replies; 3+ messages in thread
From: Marius Bakke @ 2019-05-09 18:12 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 35652-done
[-- Attachment #1: Type: text/plain, Size: 819 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> Hi Marius,
>
> Good catch!
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> From 7724f24443392fdfc2c075909d9b64350f6578b2 Mon Sep 17 00:00:00 2001
>> From: Marius Bakke <mbakke@fastmail.com>
>> Date: Thu, 9 May 2019 17:03:03 +0200
>> Subject: [PATCH] services: dhcp-client: Ignore interfaces that are not ARP
>> capable.
>>
>> * guix/build/syscalls.scm (IFF_NOARP): New variable.
>> (arp-network-interface?): New public variable.
>> * gnu/services/networking.scm (dhcp-client-service-type): Filter interfaces
>> that do not support the ARP protocol.
>
> Could you make it two patches (one for syscalls.scm, and another one for
> the rest)?
>
> Otherwise LGTM, thank you!
Thanks for the amazingly fast review :-)
Pushed in a0dc97a5..6c2180f5.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-09 18:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 15:30 [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces Marius Bakke
2019-05-09 15:39 ` Ludovic Courtès
2019-05-09 18:12 ` bug#35652: " Marius Bakke
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.