From owner-freebsd-net@freebsd.org Mon Sep 14 19:47:54 2015 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17D33A04502 for ; Mon, 14 Sep 2015 19:47:54 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB4DD1F4D for ; Mon, 14 Sep 2015 19:47:53 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by igbni9 with SMTP id ni9so89879323igb.0 for ; Mon, 14 Sep 2015 12:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Q9sd2T9o7c/XxxTdvmepsHv4lKDYrLRUGoYvMYrBJO4=; b=Q0FFl7OxvwsW641FR6XFvS2UNDe4dlilp8GKIHL/+WkJAO8h2x4dm7JbF48U6Y8jZw yUtWgwoXgwVXVUPxSAfBa1p2xY2hCJfFoHunou8ZuXlcrZnMP4rFn9Ga2yXcR8Wxuu4Y 9bAQNHpb3G7hYfR69WS3FGH8B3DQIT8U08vIeel8P4yHzcu/Pk7z+XsUEOumL36tJJNP cyNuazXhMu2gDakGz8GKg+karN2PnAYsRbkIBKhJzogRiMNizBXkJFusTDtXHS5N//tN OZ8drCWkq3zgm821IIweM9We/r9PEFy9TlzZzher9GStn7ja6j90jVMf4IaS98iSRpqg 7M0A== MIME-Version: 1.0 X-Received: by 10.50.124.4 with SMTP id me4mr21736405igb.34.1442260073171; Mon, 14 Sep 2015 12:47:53 -0700 (PDT) Received: by 10.107.178.67 with HTTP; Mon, 14 Sep 2015 12:47:53 -0700 (PDT) Date: Mon, 14 Sep 2015 15:47:53 -0400 Message-ID: Subject: route command will perform DNS lookup of invalid interface name From: Ryan Stone To: freebsd-net Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 19:47:54 -0000 At $WORK, we have observed that if you attempt to add a route with the -iface flag, but you specify an incorrect interface name, the route command will perform a DNS lookup of the interface name. It appears that if the DNS lookup succeeds that it will treat the parameter to -iface as if it were a gateway for the route and not an interface. This appears to be a simple bug. This patch resolves the issue for me, but I'm a bit worried that the fallback to a DNS lookup might actually be desired behaviour in some case. Does anybody have any ideas? diff --git a/sbin/route/route.c b/sbin/route/route.c index 1bce41e..a447a45 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1222,6 +1222,9 @@ getaddr(int idx, char *str, struct hostent **hpp, int nrflags) freeifaddrs(ifap); if (sdl != NULL) return(1); + else + errx(EX_DATAERR, + "inferface '%s' does not exist", str); } break; case RTAX_IFP: