From patchwork Thu May 9 15:30:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Bakke X-Patchwork-Id: 13936 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BE8FE16FD1; Thu, 9 May 2019 16:31:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id E2E0716F7B for ; Thu, 9 May 2019 16:31:10 +0100 (BST) Received: from localhost ([127.0.0.1]:56558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOl0l-0001dv-VF for patchwork@mira.cbaines.net; Thu, 09 May 2019 11:31:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOl0h-0001dg-Cj for guix-patches@gnu.org; Thu, 09 May 2019 11:31:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOl0g-0005J1-Af for guix-patches@gnu.org; Thu, 09 May 2019 11:31:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOl0g-0005Ix-7E for guix-patches@gnu.org; Thu, 09 May 2019 11:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hOl0g-0006ZP-3G for guix-patches@gnu.org; Thu, 09 May 2019 11:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35652] [PATCH] services: dhcp-client: Ignore non-ARP network interfaces. Resent-From: Marius Bakke Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 09 May 2019 15:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35652 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35652@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155741584824343 (code B ref -1); Thu, 09 May 2019 15:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 May 2019 15:30:48 +0000 Received: from localhost ([127.0.0.1]:36088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOl0R-0006K6-8u for submit@debbugs.gnu.org; Thu, 09 May 2019 11:30:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOl0O-0006Ci-V9 for submit@debbugs.gnu.org; Thu, 09 May 2019 11:30:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:57764) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOl0J-000511-JF for submit@debbugs.gnu.org; Thu, 09 May 2019 11:30:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOl0C-0001Z0-0T for guix-patches@gnu.org; Thu, 09 May 2019 11:30:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOl0A-0004qJ-61 for guix-patches@gnu.org; Thu, 09 May 2019 11:30:31 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:53763) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOl09-0004hj-1j for guix-patches@gnu.org; Thu, 09 May 2019 11:30:29 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id E214E25E26 for ; Thu, 9 May 2019 11:30:19 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 09 May 2019 11:30:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= from:to:subject:date:message-id:mime-version:content-type; s= fm2; bh=6SZkpD5XAZ4eFa5UZ7mxLWK6cZWyquvB3PtIyku/rpY=; b=dQD+o9f+ qPPD3dDihsKjr/UhMY4E2WfpfOukHMQRWkxkMwHtpFoJaF3DNBu9zM9Huj7H4tf4 t0FXB3MugAot9UWBcg7R2MNhfsOCCCHi78dwtsg4Y2z8bEGAttnxqiqJRWUfJBil HTHJUaTaHJvZ+SPweYjxFy1f6DvuW33B5rIaLvYBhTMHmoGhNLRAJUxnZBbppq4L 3cEhuLj/LqDpfWtOSMHk7yxI46ft8MAAeVTZ6EgpiOXSAfIVi9xr8XBPPUKsbXAq hKgssyn1d4oo6nX6nJlvpxSgcInvHwlM5+Y/JIKRzdZr0vj9iuA8mAjXN840Wi/z B+fe+kqG7JTI2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=6SZkpD5XAZ4eFa5UZ7mxLWK6cZWyq uvB3PtIyku/rpY=; b=5V4dmk+38GaQETSRpCHy/lt5ABja2soumfy2CYPHWaD2B A0CR+ZRPJnCwKyVTTjF3hifx0NRVLt4R6D3qthtSK/AHGGmAzE2tRwgH5mnO0BYi 9MwPOrNI7Ry1kltbARAkbRILM3EGPw04Vgeqop/yOGO/sSWZqfZp3VlAB/yTbuan rqAubRdBQD88lfNxhVf4rZKihKc3RHlzC4d4ejO9f4jh5bLi6h9J62gj53vbctbJ F6EfgZwoOufmJk5iXsX/uzYPMyrUHcNcMozR4W+mv+HTmzRkAfbGt6AFmg2H3902 Xd+kjYxlbB4z1Y29yjqcOYM6M3SIwfUCaLBtJfdvQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrkeeigddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgffffkgggtsehgtderredtre dtnecuhfhrohhmpeforghrihhushcuuegrkhhkvgcuoehmsggrkhhkvgesfhgrshhtmhgr ihhlrdgtohhmqeenucfkphepiedvrdduiedrvddviedrudegtdenucfrrghrrghmpehmrg hilhhfrhhomhepmhgsrghkkhgvsehfrghsthhmrghilhdrtghomhenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 2916080069 for ; Thu, 9 May 2019 11:30:19 -0400 (EDT) From: Marius Bakke User-Agent: Notmuch/0.28.3 (https://notmuchmail.org) Emacs/26.2 (x86_64-pc-linux-gnu) Date: Thu, 09 May 2019 17:30:17 +0200 Message-ID: <87d0krd4s6.fsf@fastmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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. From 7724f24443392fdfc2c075909d9b64350f6578b2 Mon Sep 17 00:00:00 2001 From: Marius Bakke 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