From patchwork Thu Oct 19 05:45:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 828191 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHvG93N9nz9t3l for ; Fri, 20 Oct 2017 03:17:19 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 848AFBE1; Thu, 19 Oct 2017 16:17:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0B416B1E for ; Thu, 19 Oct 2017 16:17:14 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3BC0A488 for ; Thu, 19 Oct 2017 16:17:13 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id k4so17462702wmc.1 for ; Thu, 19 Oct 2017 09:17:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=pPmghP9PKs+5enKh9fD5ApLjFL6jiKcjQaDIkWEuOOA=; b=Xp8Baw7l9nHVkfD2cGcK6NkYvONNdluZQqnNT8Tm8dO0fr/MV6fWxxXeGndP3IMc6j FlXOL5E5YQcFLhdgXFschiNMy/iqG0Ke0rn7CRe2KoDaHmSd4JCb/kxzeCz4yn16CqZK xiUYBQiBSbfqjINA3l4Taq6F+qQCRDnOtGFcKQ5P1X66XpOtPui3i+SkGiSo9jrmPFVh H48epNURx1zpcPxZeTvbL3Lco4JbXKSKBuwFuR9+52HlRmQewPEZqlGaUuNgDKEG3xQa 0AiFGdCmk55mTm+ouUw7w6FFrlXn5C1xch9FRYRZUhnLMsVX4mN8AnhRXxk9qiwoQ579 GsWQ== X-Gm-Message-State: AMCzsaW0J4YnG3Y/oAFiRhlyb7paqj2q5PuPFosD3puqaogNNhY+hExr vHaXAjWEkJTJJ4KCN23Jqk3JXA== X-Google-Smtp-Source: ABhQp+S6PY9Zxw4JhM7sXw9dM2q8xcg90ftnI/6+oIh4dXVJj2YPMIJ2oePqevgeBHJi+bpKnmzzxg== X-Received: by 10.80.241.91 with SMTP id z27mr3082159edl.35.1508429831576; Thu, 19 Oct 2017 09:17:11 -0700 (PDT) Received: from ubuntu.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id c32sm414664eda.57.2017.10.19.09.17.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Oct 2017 09:17:10 -0700 (PDT) From: Gurucharan Shetty To: dev@openvswitch.org Date: Wed, 18 Oct 2017 22:45:01 -0700 Message-Id: <1508391901-1739-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Spam-Status: No, score=1.6 required=5.0 tests=DATE_IN_PAST_06_12, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovs-save: Handle different 'ip addr show' output. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org On RHEL 7.4 (with iproute-3.10.0-87), a DHCP provided ipv4 address has the "dynamic" keyword set. For e.g "ip addr show breth0 | grep inet" shows: inet 10.116.248.91/20 brd 10.116.255.255 scope global dynamic breth0 inet6 fe80::250:56ff:fea8:fdf0/64 scope link The keyword "dynamic" (according to 'man ip-address') is only used for ipv6, but in this case this is not true. Our current code will skip the ipv4 address restoration because of this. With this commit, we special case "dynamic" keyword to be valid in case of ipv4. VMware-BZ: #1982196 Signed-off-by: Gurucharan Shetty Acked-by: Yi-Hung Wei --- utilities/ovs-lib.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index 8665698..ac2da85 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -329,6 +329,14 @@ move_ip_address () { while test $# != 0; do case $1 in dynamic) + # XXX: According to 'man ip-address', "dynamic" is only + # used for ipv6 addresses. But, atleast on RHEL 7.4 + # (iproute-3.10.0-87), it is being used for ipv4 + # addresses assigned with dhcp. + if [ "$family" = "inet" ]; then + shift + continue + fi # Omit kernel-maintained route. continue 2 ;;