From patchwork Wed Jun 7 13:23:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 772421 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wjTlC5shMz9sDG for ; Wed, 7 Jun 2017 23:23:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbdFGNXR (ORCPT ); Wed, 7 Jun 2017 09:23:17 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:33060 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbdFGNXQ (ORCPT ); Wed, 7 Jun 2017 09:23:16 -0400 Received: by mail-wm0-f47.google.com with SMTP id m7so33207880wmg.0 for ; Wed, 07 Jun 2017 06:23:15 -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:cc:subject:date:message-id; bh=h7Efh58q2o6m8moeAl9nZd1oMwhr4PrutmdVGhhSeOE=; b=JfDH5AW0eP5sJ5M82uxynQ16UkZujRFkB0KFC6lp1sTmBQtva2s60ngOoLeLHy3ams FGxcbND8pcxawggOwlHePnQn+YSOyyMD4KQLVM6MMphVLe0SYn4NFI3QlgZhWzqtAdrh YgSqOUkUs1SheKdj+sfl3amJjKeP+uWpzAYt+IEh9t7uo3V5a+17ErB8vNatfotokQR5 27dz0ZrqPQY/c6zKX3xdiKiZIxLRlD17H5XaYRlSBQDQQYBVUuj2pvXLyqkHDX55n5sh 6cb5jERuDZn5rhRwTG9bnFl2cUH3sC4zs9khc0Ogsx39pU/E48vk6OHvU7CXgK6hd21A YMRA== X-Gm-Message-State: AODbwcBKUvKEi56hdqTt3peKDamIxEr7zOI+6MCBuwNvgOktU6xkuhyP mQzXjWZTAaHykAiwl8iB3w== X-Received: by 10.28.236.71 with SMTP id k68mr2304641wmh.107.1496841794849; Wed, 07 Jun 2017 06:23:14 -0700 (PDT) Received: from redhat.com ([149.14.101.162]) by smtp.gmail.com with ESMTPSA id h73sm3520397wma.10.2017.06.07.06.23.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Jun 2017 06:23:13 -0700 (PDT) From: Jakub Sitnicki To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH] iproute: Remove useless check for nexthop keyword when setting RTA_OIF Date: Wed, 7 Jun 2017 15:23:13 +0200 Message-Id: <20170607132313.5290-1-jkbs@redhat.com> X-Mailer: git-send-email 2.9.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When modifying a route we set the RTA_OIF attribute only if a device was specified with "dev" or "oif" keyword. But for some unknown reason we earlier alternatively check also for the presence of "nexthop" keyword, even though it has no effect. So remove the pointless check. Signed-off-by: Jakub Sitnicki --- ip/iproute.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index b4ca291..4fd36a1 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -1241,16 +1241,14 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv) if (!dst_ok) usage(); - if (d || nhs_ok) { + if (d) { int idx; - if (d) { - if ((idx = ll_name_to_index(d)) == 0) { - fprintf(stderr, "Cannot find device \"%s\"\n", d); - return -1; - } - addattr32(&req.n, sizeof(req), RTA_OIF, idx); + if ((idx = ll_name_to_index(d)) == 0) { + fprintf(stderr, "Cannot find device \"%s\"\n", d); + return -1; } + addattr32(&req.n, sizeof(req), RTA_OIF, idx); } if (mxrta->rta_len > RTA_LENGTH(0)) {