From patchwork Fri Dec 13 04:08:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Haigh X-Patchwork-Id: 11289785 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FD4D1593 for ; Fri, 13 Dec 2019 04:10:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E073A2253D for ; Fri, 13 Dec 2019 04:10:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crc.id.au header.i=@crc.id.au header.b="CYIFGXUV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E073A2253D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crc.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifcG9-0007S8-TN; Fri, 13 Dec 2019 04:08:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifcG8-0007Rw-02 for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 04:08:56 +0000 X-Inumbo-ID: 3f93e3fa-1d5e-11ea-a914-bc764e2007e4 Received: from mail.crc.id.au (unknown [203.56.246.92]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3f93e3fa-1d5e-11ea-a914-bc764e2007e4; Fri, 13 Dec 2019 04:08:43 +0000 (UTC) Received: from ws19.umd.com.au (2407-e400-b000-202-0-0-0-3-cpe.spintel.net.au [IPv6:2407:e400:b000:202::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.crc.id.au (Postfix) with ESMTPSA id 121B42006D3; Fri, 13 Dec 2019 15:08:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crc.id.au; s=default; t=1576210121; bh=NeajN4Im7OlnIgZgRJj7CI217KxQZYwgROlhdXd+3cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CYIFGXUVXNTX2xFmVxaVLxHdpasTBOcmDhs3vPXGOGyFoBD+P75RSFpkwBN2qNPdw JkT3iM7R3EJFWXrw/IKJvcAfWx7OvwEUiU5yD9hRKI6zca/pmpsbBnfuaLImkzpVZQ Xk6QRKFpl93hDQaIUv8+DLIJU4jNIhMGoUG5TJIw= From: Steven Haigh To: xen-devel@lists.xenproject.org Date: Fri, 13 Dec 2019 15:08:34 +1100 Message-Id: X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/2] Tidy up whitespace and formatting in file to be consistent. X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , Steven Haigh , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Signed-off-by: Steven Haigh Acked-by: Wei Liu --- tools/hotplug/Linux/xen-network-common.sh | 144 +++++++++++----------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/tools/hotplug/Linux/xen-network-common.sh b/tools/hotplug/Linux/xen-network-common.sh index 92ffa603f7..ab76827a64 100644 --- a/tools/hotplug/Linux/xen-network-common.sh +++ b/tools/hotplug/Linux/xen-network-common.sh @@ -26,118 +26,114 @@ # that the virtual device will take once the physical device has # been renamed. -if ! which ifup >/dev/null 2>/dev/null -then - preiftransfer() - { - true - } - ifup() - { - false - } - ifdown() - { - false - } +if ! which ifup >/dev/null 2>/dev/null; then + preiftransfer() + { + true + } + ifup() + { + false + } + ifdown() + { + false + } else - preiftransfer() - { - true - } + preiftransfer() + { + true + } fi first_file() { - t="$1" - shift - for file in $@ - do - if [ "$t" "$file" ] - then - echo "$file" - return - fi - done + t="$1" + shift + for file in $@; do + if [ "$t" "$file" ]; then + echo "$file" + return + fi + done } find_dhcpd_conf_file() { - first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf + first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf } find_dhcpd_init_file() { - first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd} + first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd} } find_dhcpd_arg_file() { - first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server + first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server } # configure interfaces which act as pure bridge ports: _setup_bridge_port() { - local dev="$1" - local virtual="$2" - - # take interface down ... - ip link set dev ${dev} down - - if [ $virtual -ne 0 ] ; then - # Initialise a dummy MAC address. We choose the numerically - # largest non-broadcast address to prevent the address getting - # stolen by an Ethernet bridge for STP purposes. - # (FE:FF:FF:FF:FF:FF) - ip link set dev ${dev} address fe:ff:ff:ff:ff:ff || true - fi - - # ... and configure it - ip address flush dev ${dev} + local dev="$1" + local virtual="$2" + + # take interface down ... + ip link set dev ${dev} down + + if [ $virtual -ne 0 ]; then + # Initialise a dummy MAC address. We choose the numerically + # largest non-broadcast address to prevent the address getting + # stolen by an Ethernet bridge for STP purposes. + # (FE:FF:FF:FF:FF:FF) + ip link set dev ${dev} address fe:ff:ff:ff:ff:ff || true + fi + + # ... and configure it + ip address flush dev ${dev} } setup_physical_bridge_port() { - _setup_bridge_port $1 0 + _setup_bridge_port $1 0 } setup_virtual_bridge_port() { - _setup_bridge_port $1 1 + _setup_bridge_port $1 1 } # Usage: create_bridge bridge create_bridge () { - local bridge=$1 - - # Don't create the bridge if it already exists. - if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then - brctl addbr ${bridge} - brctl stp ${bridge} off - brctl setfd ${bridge} 0 - fi + local bridge=$1 + + # Don't create the bridge if it already exists. + if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then + brctl addbr ${bridge} + brctl stp ${bridge} off + brctl setfd ${bridge} 0 + fi } # Usage: add_to_bridge bridge dev add_to_bridge () { - local bridge=$1 - local dev=$2 - - # Don't add $dev to $bridge if it's already on a bridge. - if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then - ip link set dev ${dev} up || true - return - fi - brctl addif ${bridge} ${dev} - ip link set dev ${dev} up + local bridge=$1 + local dev=$2 + + # Don't add $dev to $bridge if it's already on a bridge. + if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then + ip link set dev ${dev} up || true + return + fi + brctl addif ${bridge} ${dev} + ip link set dev ${dev} up } # Usage: set_mtu bridge dev set_mtu () { - local bridge=$1 - local dev=$2 - mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`" - if [ -n "$mtu" ] && [ "$mtu" -gt 0 ] - then - ip link set dev ${dev} mtu $mtu || : - fi + local bridge=$1 + local dev=$2 + mtu="`ip link show dev ${bridge}| awk '/mtu/ { print $5 }'`" + if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]; then + ip link set dev ${dev} mtu $mtu || : + fi }