From nobody Thu Mar 28 16:01:55 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1573145980; cv=none; d=zoho.com; s=zohoarc; b=nw8V31vjPUm4sre3ARlxHtc/7wwPKMl9ibb1haKGefZeaPUF9NRkoyN3ouNR6ipKIpbGlQ+BzNALvc1AjkwGZZHvYrTh8RVFpjp89VD2YmLTwVf6QSdtu3X27+k2tW24UD3K2ZDBOstlz9flmUs/SHHUlrNbLLJj7xnfWjhSLQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573145980; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DRVEC6iRHOMdxSIvDAhizlYHASYoXSFhs0QYOza7z/c=; b=EEN2ZGXCWPConiMsE1NAmszF/WNkOyRKm7BwiJz0cUPWPwys93SUVU3EtPaj5xXRtIPGF2VzLgEFNxSPjxTDZoiCAVOamJz4hZo8C3VvjNeF+sNhrunr6Y/TF9cbQgKuZg7fg9VKv/Ary9Hpl/Qpqg16AkFEt1/pXsMSTt05K9c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1573145980825934.5286247260058; Thu, 7 Nov 2019 08:59:40 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iSl7B-0007ng-J6; Thu, 07 Nov 2019 16:58:33 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iSl7A-0007nb-QD for xen-devel@lists.xenproject.org; Thu, 07 Nov 2019 16:58:32 +0000 Received: from smtp-fw-4101.amazon.com (unknown [72.21.198.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d4644b0a-017f-11ea-a1ca-12813bfff9fa; Thu, 07 Nov 2019 16:58:32 +0000 (UTC) Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1e-27fb8269.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 07 Nov 2019 16:58:25 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1e-27fb8269.us-east-1.amazon.com (Postfix) with ESMTPS id 2930AA27F8; Thu, 7 Nov 2019 16:58:24 +0000 (UTC) Received: from EX13D32EUB003.ant.amazon.com (10.43.166.165) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 16:58:23 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D32EUB003.ant.amazon.com (10.43.166.165) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 16:58:22 +0000 Received: from u55d8f79c258451.ant.amazon.com (10.125.106.130) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 16:58:20 +0000 X-Inumbo-ID: d4644b0a-017f-11ea-a1ca-12813bfff9fa IronPort-SDR: I7uB3tDteLS/Q3I/5I7ytLetmQ5r+HzfAq12xHdJtwfaoB1aC5H/3hrRw4qwcuCCmRf5YmwKdT ilocNNNJC+tg== X-IronPort-AV: E=Sophos;i="5.68,278,1569283200"; d="scan'208";a="2694206" From: To: Date: Thu, 7 Nov 2019 16:58:14 +0000 Message-ID: <1573145894-13305-1-git-send-email-paul@xen.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v2] tools/hotpug: only attempt to call 'ip route' if there is valid command X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Paul Durrant , Ian Jackson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Paul Durrant The vif-route script should only call 'ip route' when 'ipcmd' has been set, otherwise it will fail due to an incorrect command string. This patch also adds routes for 'tap' (i.e. emulated) devices as well as 'vif' (i.e. PV) devices by making use of the route metric. Emulated devices are used by HVM guests until they are unplugged, at which point the PV device becomes active. Thus 'tap' devices should get a higher priority (i.e. lower numbered) metric than 'vif' devices. There is also one small whitespace fix. NOTE: Empirically offline/online commands relate to 'vif' devices, and add/remove commands relate to 'tap' devices. However, this patch treats them equally and uses ${type_if} to distinguish. Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu --- tools/hotplug/Linux/vif-route | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) mode change 100644 =3D> 100755 tools/hotplug/Linux/vif-route diff --git a/tools/hotplug/Linux/vif-route b/tools/hotplug/Linux/vif-route old mode 100644 new mode 100755 index c149ffc..e71acae --- a/tools/hotplug/Linux/vif-route +++ b/tools/hotplug/Linux/vif-route @@ -22,12 +22,16 @@ dir=3D$(dirname "$0") main_ip=3D$(dom0_ip) =20 case "${command}" in + add) + ;& online) ifconfig ${dev} ${main_ip} netmask 255.255.255.255 up echo 1 >/proc/sys/net/ipv4/conf/${dev}/proxy_arp ipcmd=3D'add' cmdprefix=3D'' ;; + remove) + ;& offline) do_without_error ifdown ${dev} ipcmd=3D'del' @@ -35,11 +39,23 @@ case "${command}" in ;; esac =20 -if [ "${ip}" ] ; then +case "${type_if}" in + tap) + metric=3D1 + ;; + vif) + metric=3D2 + ;; + *) + fatal "Unrecognised interface type ${type_if}" + ;; +esac + +if [ "${ipcmd}" ] ; then # If we've been given a list of IP addresses, then add routes from dom= 0 to # the guest using those addresses. for addr in ${ip} ; do - ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip} + ${cmdprefix} ip route ${ipcmd} ${addr} dev ${dev} src ${main_ip} met= ric ${metric} done fi =20 @@ -50,5 +66,5 @@ call_hooks vif post log debug "Successful vif-route ${command} for ${dev}." if [ "${command}" =3D "online" ] then - success + success fi --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel