summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1996-03-27 14:44:14 +0000
committerchristos <christos@NetBSD.org>1996-03-27 14:44:14 +0000
commit4dd67bbcd4ed8eb19012bb70f69700e2fbd7649c (patch)
tree82e8099af679263d9e94122b05bfa6878149ed84
parent6d6bb851aedd21eb4b617358891b4bbfa2f27ee1 (diff)
Fix(?) (I have no way to test this) netns crash when receiving PRC_REDIRECT's
I handled them in a similar way with other protocols, by calling: ns_pcbnotify(..., ns_rtchange, ...) I hope it works. Fixes PR/2266
-rw-r--r--sys/netns/ns_pcb.c4
-rw-r--r--sys/netns/ns_var.h4
-rw-r--r--sys/netns/spp_usrreq.c22
3 files changed, 24 insertions, 6 deletions
diff --git a/sys/netns/ns_pcb.c b/sys/netns/ns_pcb.c
index b24c64c37e5..e2dfa978386 100644
--- a/sys/netns/ns_pcb.c
+++ b/sys/netns/ns_pcb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_pcb.c,v 1.9 1996/02/13 22:14:02 christos Exp $ */
+/* $NetBSD: ns_pcb.c,v 1.10 1996/03/27 14:44:14 christos Exp $ */
/*
* Copyright (c) 1984, 1985, 1986, 1987, 1993
@@ -311,7 +311,6 @@ ns_pcbnotify(dst, errno, notify, param)
splx(s);
}
-#ifdef notdef
/*
* After a routing change, flush old routing
* and allocate a (hopefully) better one.
@@ -330,7 +329,6 @@ ns_rtchange(nsp)
}
/* SHOULD NOTIFY HIGHER-LEVEL PROTOCOLS */
}
-#endif
struct nspcb *
ns_pcblookup(faddr, lport, wildp)
diff --git a/sys/netns/ns_var.h b/sys/netns/ns_var.h
index 7b3d5ec8d9b..f6ff4140b10 100644
--- a/sys/netns/ns_var.h
+++ b/sys/netns/ns_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ns_var.h,v 1.2 1996/03/14 18:44:42 christos Exp $ */
+/* $NetBSD: ns_var.h,v 1.3 1996/03/27 14:44:16 christos Exp $ */
/*
* Copyright (c) 1995 Christos Zoulas. All rights reserved.
@@ -92,7 +92,7 @@ void ns_pcbdetach __P((struct nspcb *));
void ns_setsockaddr __P((struct nspcb *, struct mbuf *));
void ns_setpeeraddr __P((struct nspcb *, struct mbuf *));
void ns_pcbnotify __P((struct ns_addr *, int, void (*)(struct nspcb *), long));
-int ns_rtchange __P((struct nspcb *));
+void ns_rtchange __P((struct nspcb *));
struct nspcb *ns_pcblookup __P((struct ns_addr *, u_short, int));
#endif
diff --git a/sys/netns/spp_usrreq.c b/sys/netns/spp_usrreq.c
index a56d5fa71cd..359f773fd13 100644
--- a/sys/netns/spp_usrreq.c
+++ b/sys/netns/spp_usrreq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spp_usrreq.c,v 1.10 1996/02/18 05:43:03 christos Exp $ */
+/* $NetBSD: spp_usrreq.c,v 1.11 1996/03/27 14:44:17 christos Exp $ */
/*
* Copyright (c) 1984, 1985, 1986, 1987, 1993
@@ -609,6 +609,7 @@ spp_ctlinput(cmd, sa, arg)
return NULL;
type = NS_ERR_UNREACH_HOST;
+
switch (cmd) {
case PRC_ROUTEDEAD:
@@ -623,12 +624,31 @@ spp_ctlinput(cmd, sa, arg)
na = &sns->sns_addr;
break;
+ case PRC_REDIRECT_NET:
+ case PRC_REDIRECT_HOST:
+ case PRC_REDIRECT_TOSNET:
+ case PRC_REDIRECT_TOSHOST:
+ /*
+ * PRC_IS_REDIRECT: Call ns_rtchange to flush the route, so
+ * that the next time we attempt output we try a new one
+ * XXX: Is this the right way? ns_rtchange has a comment
+ * that needs to be fixed.
+ */
+ sns = (struct sockaddr_ns *) sa;
+ if (sns->sns_family != AF_NS)
+ return NULL;
+ na = &sns->sns_addr;
+ ns_pcbnotify(na, (int)nsctlerrmap[cmd], ns_rtchange, (long) 0);
+ return NULL;
+
default:
errp = arg;
na = &errp->ns_err_idp.idp_dna;
type = errp->ns_err_num;
type = ntohs((u_short)type);
+ break;
}
+
switch (type) {
case NS_ERR_UNREACH_HOST: