summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1996-09-02 02:49:40 +0000
committerfenner <fenner@FreeBSD.org>1996-09-02 02:49:40 +0000
commitbea26e19eddd870618d175dc7edc05d2c2bd1c49 (patch)
tree1947b7ccf76391ee3a489589ef0694d865bccd07 /sys/net/route.c
parentc1757b861bacc3a55d045c41fd748ce8d7cbb3ea (diff)
downloadFreeBSD-src-bea26e19eddd870618d175dc7edc05d2c2bd1c49.zip
FreeBSD-src-bea26e19eddd870618d175dc7edc05d2c2bd1c49.tar.gz
Bugfix and simplification for rev 1.34: make sure that the route
is non-null before trying to delete it in rt_setgate(), which then allows removal of the special-case code from the RTM_ADD case. This should fix the panics that joerg and Phil Karn have been seeing.
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index df276ea..ad7fa62 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)route.c 8.2 (Berkeley) 11/15/93
- * $Id: route.c,v 1.34 1996/07/10 01:34:35 fenner Exp $
+ * $Id: route.c,v 1.35 1996/08/24 03:11:13 peter Exp $
*/
#include "opt_mrouting.h"
@@ -445,17 +445,6 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
if ((flags & RTF_GATEWAY) && !gateway)
panic("rtrequest: GATEWAY but no gateway");
- /*
- * A host route with the destination equal to the gateway
- * will interfere with keeping LLINFO in the routing
- * table, so disallow it.
- */
- if (((flags & (RTF_HOST|RTF_GATEWAY|RTF_LLINFO)) ==
- (RTF_HOST|RTF_GATEWAY)) &&
- (dst->sa_len == gateway->sa_len) &&
- (bcmp(dst, gateway, dst->sa_len) == 0))
- senderr(EADDRNOTAVAIL);
-
if ((ifa = ifa_ifwithroute(flags, dst, gateway)) == 0)
senderr(ENETUNREACH);
@@ -465,9 +454,9 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
senderr(ENOBUFS);
Bzero(rt, sizeof(*rt));
rt->rt_flags = RTF_UP | flags;
- if (rt_setgate(rt, dst, gateway)) {
+ if (error = rt_setgate(rt, dst, gateway)) {
Free(rt);
- senderr(ENOBUFS);
+ senderr(error);
}
ndst = rt_key(rt);
if (netmask) {
@@ -679,8 +668,9 @@ rt_setgate(rt0, dst, gate)
* The route might already exist if this is an RTM_CHANGE
* or a routing redirect, so try to delete it.
*/
- rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt0),
- rt0->rt_gateway, rt_mask(rt0), rt0->rt_flags, 0);
+ if (rt_key(rt0))
+ rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt0),
+ rt0->rt_gateway, rt_mask(rt0), rt0->rt_flags, 0);
return EADDRNOTAVAIL;
}
OpenPOWER on IntegriCloud