NetBSD Problem Report #55649

From www@netbsd.org  Wed Sep  9 19:36:19 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CF6DA1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  9 Sep 2020 19:36:19 +0000 (UTC)
Message-Id: <20200909193618.4B7051A923A@mollari.NetBSD.org>
Date: Wed,  9 Sep 2020 19:36:18 +0000 (UTC)
From: dogan@tesmer.org.tr
Reply-To: dogan@tesmer.org.tr
To: gnats-bugs@NetBSD.org
Subject: /sbin/route add doesn't accept with -interface parameter
X-Send-Pr-Version: www-1.0

>Number:         55649
>Category:       bin
>Synopsis:       /sbin/route add doesn't accept with -interface parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 09 19:40:00 +0000 2020
>Last-Modified:  Wed Sep 09 21:15:01 +0000 2020
>Originator:     Mustafa Dogan
>Release:        NetBSD 9.0_STABLE amd64
>Organization:
TESMER Temel Egitim ve Staj Merkezi
>Environment:
NetBSD localhost 9.0_STABLE NetBSD 9.0_STABLE (GENERIC) #0: Fri Sep  4 09:09:14 +03 2020  root@localhost:/root/OBJ/sys/arch/amd64/compile/GENERIC amd64

>Description:
When I was setting a route for openfortivpn ppp interface, I encountered
/sbin/route -n add -net 172.16.16.0 -netmask 255.255.254.0 -interface ppp0
route: ppp0: bad value
lines on the console. Then I tried route (8) command with several network adapters (re0, iwm0, etc) several times, but every time I got the same response: route: netadapter: bad value.  

However, in the route(8) man page says that:
"If the destination is directly reachable via an interface requiring no     intermediary system to act as a gateway, the -interface modifier should be specified; the gateway given is the address of this host on the common network, indicating the interface to be used for transmission."

I used route (8) like this:
route -n add -net 172.16.16.0 -netmask 255.255.254.0 10.0.0.1
(10.0.0.1 is IP address of ppp0 interface) and it worked as expected.
Is there a problem, or am I missing something?
>How-To-Repeat:
Use route(8) with -interface parameter.
/sbin/route -n add -net x.y.z.0 -netmask 255.255.255.0 -interface $intf
x.y.z.0 is destination network address and $intf is network adapter (re0, wm1, bge2, etc).
>Fix:

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: dogan@tesmer.org.tr, netbsd-bugs@netbsd.org
Subject: Re: bin/55649: /sbin/route add doesn't accept with -interface parameter
Date: Thu, 10 Sep 2020 04:11:48 +0700

 This is not a bug, please read the manual page of route(8)
 again ...

      If the destination is directly reachable via an interface requiring no
      intermediary system to act as a gateway, the -interface modifier should
      be specified; the gateway given is the address of this host on the common
      network, indicating the interface to be used for transmission.

 After "-interface" you need to specify the local (ie: this host's)
 address on that interface, not the name of the interface.

 A little odd, but it has been that way from the distant past when there
 was no easy way for most applications to do anything useful with an
 interface name.  On the other hand, address parsing etc has always been
 relatively easy.  So ...

 kre

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.