netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute PATCH] iproute: Remove useless check for nexthop keyword when setting RTA_OIF
@ 2017-06-07 13:23 Jakub Sitnicki
  2017-06-14 16:57 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Sitnicki @ 2017-06-07 13:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

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 <jkbs@redhat.com>
---
 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)) {
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iproute PATCH] iproute: Remove useless check for nexthop keyword when setting RTA_OIF
  2017-06-07 13:23 [iproute PATCH] iproute: Remove useless check for nexthop keyword when setting RTA_OIF Jakub Sitnicki
@ 2017-06-14 16:57 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2017-06-14 16:57 UTC (permalink / raw)
  To: Jakub Sitnicki; +Cc: netdev

On Wed,  7 Jun 2017 15:23:13 +0200
Jakub Sitnicki <jkbs@redhat.com> wrote:

> 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 <jkbs@redhat.com>

Makes sense, applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-14 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-07 13:23 [iproute PATCH] iproute: Remove useless check for nexthop keyword when setting RTA_OIF Jakub Sitnicki
2017-06-14 16:57 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).