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
This commit is contained in:
parent
6699ee32ca
commit
dd56500020
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)route.8 8.3 (Berkeley) 3/19/94
|
.\" @(#)route.8 8.3 (Berkeley) 3/19/94
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd November 11, 2014
|
.Dd February 16, 2018
|
||||||
.Dt ROUTE 8
|
.Dt ROUTE 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -164,15 +164,27 @@ option is specified, the operation will be applied to
|
|||||||
the specified FIB
|
the specified FIB
|
||||||
.Pq routing table .
|
.Pq routing table .
|
||||||
.Pp
|
.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
|
||||||
|
.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
|
.Pp
|
||||||
.Bd -ragged -offset indent -compact
|
.Bd -ragged -offset indent -compact
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl n
|
.Op Fl n
|
||||||
.Ar command
|
.Ar command
|
||||||
.Op Fl net No \&| Fl host
|
.Op Fl net No \&| Fl host
|
||||||
.Ar destination gateway
|
.Ar destination
|
||||||
.Op Ar netmask
|
.Op Ar gateway Op Ar netmask
|
||||||
.Op Fl fib Ar number
|
.Op Fl fib Ar number
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -674,12 +674,15 @@ route_output(struct mbuf *m, struct socket *so, ...)
|
|||||||
|
|
||||||
case RTM_ADD:
|
case RTM_ADD:
|
||||||
case RTM_CHANGE:
|
case RTM_CHANGE:
|
||||||
if (info.rti_info[RTAX_GATEWAY] == NULL)
|
if (rtm->rtm_type == RTM_ADD) {
|
||||||
senderr(EINVAL);
|
if (info.rti_info[RTAX_GATEWAY] == NULL)
|
||||||
|
senderr(EINVAL);
|
||||||
|
}
|
||||||
saved_nrt = NULL;
|
saved_nrt = NULL;
|
||||||
|
|
||||||
/* support for new ARP code */
|
/* 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) {
|
(rtm->rtm_flags & RTF_LLDATA) != 0) {
|
||||||
error = lla_rt_output(rtm, &info);
|
error = lla_rt_output(rtm, &info);
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user