From patchwork Wed May 8 21:11:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 2243 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id A563E85D3F0 for ; Wed, 8 May 2019 22:18:22 +0100 (BST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 44zq8F4rdlz51Mh2; Wed, 8 May 2019 22:18:21 +0100 (BST) Received: from localhost.localdomain (unknown [88.215.19.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 44zq8621Ncz5KK8h; Wed, 8 May 2019 22:18:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904rsa; t=1557350294; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:openpgp:autocrypt; bh=1K3sRF31n2m5se0wGQyLSpx22ufHmz+6RvQtuFpYzrw=; b=Khhyx8VgBDAQqAB9qKfDxLWRkqEiAWczACEyj5znue4NvOimGZNQy2hZA8XY7ckv2Qnl2m UKzeFe97IiT0TlXj5zvtyzRliMTe90io1WfFdsBZy9oSqOz1FqRjfVonEVOddsT8EBpMrX x3cQKR+1/C/PWfnHmgX3b+Gpow3GZIxpUDE8UAgCesoZKe+DdK3rKvXbrbRpVxkaHHpGUL O+zbakvuce5thRxs+AhuFZgf22gdjezrHQxSwxlb9wBjwR9lvbdZtR+pHi87QewRC00uXS MMQdgXJDzSQNjXoAgZnBIbboDMInvQfzROI9hlqOBy+sMBXTTLXcvxJ9ZIfTVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904ed25519; t=1557350294; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:openpgp:autocrypt; bh=1K3sRF31n2m5se0wGQyLSpx22ufHmz+6RvQtuFpYzrw=; b=8fdB9ePYjebKtL23tvfD8x0+q63DpVI+QGHgY1PB2xcDJpv001O3rsys12RjeUW9jXAh8B av+KPW3sbra/YVAA== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 1/2] udev: Accept MAC addresses for PARENT_DEV Date: Wed, 8 May 2019 12:11:07 +0100 Message-Id: <1557313868-10327-1-git-send-email-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.6.3 MIME-Version: 1.0 Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=ms smtp.mailfrom=michael.tremer@ipfire.org Cc: Michael Tremer , =?utf-8?q?Florian_B=C3=BCh?= =?utf-8?q?rle?= X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" From: Florian Bührle This allows us to create VLAN interfaces even when the name of the parent interface might vary. This patch also appends the VLAN tag to interfaces when the zone is in bridge mode. Signed-off-by: Michael Tremer --- config/udev/network-hotplug-vlan | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/config/udev/network-hotplug-vlan b/config/udev/network-hotplug-vlan index f7b6a9d..178e1a6 100644 --- a/config/udev/network-hotplug-vlan +++ b/config/udev/network-hotplug-vlan @@ -23,40 +23,51 @@ [ -n "${INTERFACE}" ] || exit 2 -CONFIG_FILE="/var/ipfire/ethernet/vlans" +VLAN_CONFIG_FILE="/var/ipfire/ethernet/vlans" +MAIN_CONFIG_FILE="/var/ipfire/ethernet/settings" -# Skip immediately if no configuration file has been found. -[ -e "${CONFIG_FILE}" ] || exit 0 +# Skip immediately if a configuration file is missing. +[ -e "${VLAN_CONFIG_FILE}" ] && [ -e "${MAIN_CONFIG_FILE}" ] || exit 0 -eval $(/usr/local/bin/readhash ${CONFIG_FILE}) +eval $(/usr/local/bin/readhash ${VLAN_CONFIG_FILE}) +eval $(/usr/local/bin/readhash ${MAIN_CONFIG_FILE}) for interface in green0 red0 blue0 orange0; do case "${interface}" in green*) + ZONE_MODE=${GREEN_MODE} PARENT_DEV=${GREEN_PARENT_DEV} VLAN_ID=${GREEN_VLAN_ID} MAC_ADDRESS=${GREEN_MAC_ADDRESS} ;; red*) + ZONE_MODE=${RED_MODE} PARENT_DEV=${RED_PARENT_DEV} VLAN_ID=${RED_VLAN_ID} MAC_ADDRESS=${RED_MAC_ADDRESS} ;; blue*) + ZONE_MODE=${BLUE_MODE} PARENT_DEV=${BLUE_PARENT_DEV} VLAN_ID=${BLUE_VLAN_ID} MAC_ADDRESS=${BLUE_MAC_ADDRESS} ;; orange*) + ZONE_MODE=${ORANGE_MODE} PARENT_DEV=${ORANGE_PARENT_DEV} VLAN_ID=${ORANGE_VLAN_ID} MAC_ADDRESS=${ORANGE_MAC_ADDRESS} ;; esac - # If the parent device does not match the interface that + # If the parent device (MAC or name) does not match the interface that # has just come up, we will go on for the next one. - [ "${PARENT_DEV}" = "${INTERFACE}" ] || continue + [ "${PARENT_DEV}" = "${INTERFACE}" ] || [ "${PARENT_DEV}" = "$(