From: Marius Bakke <mbakke@fastmail.com>
To: 35652@debbugs.gnu.org
Subject: [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces.
Date: Thu, 09 May 2019 17:30:17 +0200 [thread overview]
Message-ID: <87d0krd4s6.fsf@fastmail.com> (raw)
[-- 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 --]
next reply other threads:[~2019-05-09 15:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 15:30 Marius Bakke [this message]
2019-05-09 15:39 ` [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces Ludovic Courtès
2019-05-09 18:12 ` bug#35652: " Marius Bakke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d0krd4s6.fsf@fastmail.com \
--to=mbakke@fastmail.com \
--cc=35652@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.