aboutsummaryrefslogtreecommitdiff
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1994-10-11 23:16:38 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1994-10-11 23:16:38 +0000
commit5df7296441e98a1e91f8f41633f05bc7a6a74ed6 (patch)
tree97b87aa06a9afc8f78538511844af7ad899b7c92 /sys/net/rtsock.c
parentfabbd9b7ce59820f7285c7cbcf6a1992bec4fe03 (diff)
downloadsrc-5df7296441e98a1e91f8f41633f05bc7a6a74ed6.tar.gz
src-5df7296441e98a1e91f8f41633f05bc7a6a74ed6.zip
Fix a bug which caused panics when attempting to change just the flags of
a route. (This still doesn't work, but it doesn't panic now.) It looks like there may be a number of incipient bugs in this code. Also, get ready for the time when all IP gateway routes are cloning, which is necessary to keep proper TCP statistics.
Notes
Notes: svn path=/head/; revision=3514
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 3341a42c4310..d482a9796ee0 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.3 (Berkeley) 1/4/94
- * $Id: rtsock.c,v 1.5 1994/10/05 20:11:28 wollman Exp $
+ * $Id: rtsock.c,v 1.6 1994/10/08 22:38:26 phk Exp $
*/
#include <sys/param.h>
@@ -253,6 +253,17 @@ route_output(m, so)
case RTM_CHANGE:
if (gate && rt_setgate(rt, rt_key(rt), gate))
senderr(EDQUOT);
+
+ /*
+ * If they tried to change things but didn't specify
+ * the required gateway, then just use the old one.
+ * This can happen if the user tries to change the
+ * flags on the default route without changing the
+ * default gateway. Changing flags still doesn't work.
+ */
+ if ((rt->rt_flags & RTF_GATEWAY) && !gate)
+ gate = rt->rt_gateway;
+
/* new gateway could require new ifaddr, ifp;
flags may also be different; ifp may be specified
by ll sockaddr when protocol address is ambiguous */