From owner-svn-src-head@freebsd.org Wed Feb 21 19:13:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A8B7F2188E; Wed, 21 Feb 2018 19:13:24 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC28A6D250; Wed, 21 Feb 2018 19:13:23 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B4A41C9D6; Wed, 21 Feb 2018 19:13:23 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1LJDNK0048119; Wed, 21 Feb 2018 19:13:23 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1LJDNGh048117; Wed, 21 Feb 2018 19:13:23 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201802211913.w1LJDNGh048117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Wed, 21 Feb 2018 19:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329743 - in head: sbin/route sys/net X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: in head: sbin/route sys/net X-SVN-Commit-Revision: 329743 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 19:13:24 -0000 Author: rstone Date: Wed Feb 21 19:13:23 2018 New Revision: 329743 URL: https://svnweb.freebsd.org/changeset/base/329743 Log: Allow route change requests to not specify the gateway. Only require a gateway to be specified on a route add request. On a route change request that does not specify the gateway, the gateway will remain the same. This allows changing other route parameters without having to re-specifying the gateway, like in "route change 10.0.0.0/8 -mtu 9000". Update the route(8) manpage to explicitly call out this usage as being supported. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Reviewed By: eugen (rtsock.c change), rgrimes Differential Revision: https://reviews.freebsd.org/D14291 Modified: head/sbin/route/route.8 head/sys/net/rtsock.c Modified: head/sbin/route/route.8 ============================================================================== --- head/sbin/route/route.8 Wed Feb 21 18:57:00 2018 (r329742) +++ head/sbin/route/route.8 Wed Feb 21 19:13:23 2018 (r329743) @@ -28,7 +28,7 @@ .\" @(#)route.8 8.3 (Berkeley) 3/19/94 .\" $FreeBSD$ .\" -.Dd November 11, 2014 +.Dd February 16, 2018 .Dt ROUTE 8 .Os .Sh NAME @@ -164,15 +164,27 @@ option is specified, the operation will be applied to the specified FIB .Pq routing table . .Pp -The other commands have the following syntax: +The add command has the following syntax: .Pp .Bd -ragged -offset indent -compact .Nm .Op Fl n -.Ar command +.Cm add .Op Fl net No \&| Fl host .Ar destination gateway .Op Ar netmask +.Op Fl fib Ar number +.Ed +.Pp +and the other commands have the following syntax: +.Pp +.Bd -ragged -offset indent -compact +.Nm +.Op Fl n +.Ar command +.Op Fl net No \&| Fl host +.Ar destination +.Op Ar gateway Op Ar netmask .Op Fl fib Ar number .Ed .Pp Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Wed Feb 21 18:57:00 2018 (r329742) +++ head/sys/net/rtsock.c Wed Feb 21 19:13:23 2018 (r329743) @@ -674,12 +674,15 @@ route_output(struct mbuf *m, struct socket *so, ...) case RTM_ADD: case RTM_CHANGE: - if (info.rti_info[RTAX_GATEWAY] == NULL) - senderr(EINVAL); + if (rtm->rtm_type == RTM_ADD) { + if (info.rti_info[RTAX_GATEWAY] == NULL) + senderr(EINVAL); + } saved_nrt = NULL; /* support for new ARP code */ - if (info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK && + if (info.rti_info[RTAX_GATEWAY] != NULL && + info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK && (rtm->rtm_flags & RTF_LLDATA) != 0) { error = lla_rt_output(rtm, &info); #ifdef INET6