- if (ro->ro_rt &&
- ((*(long *)&nsp->nsp_lastnet)!=ns_netof(idp->idp_dna)) &&
- !(ns_hosteq(satons_addr(ro->ro_dst), idp->idp_dna))) {
- RTFREE(ro->ro_rt);
- ro->ro_rt = (struct rtentry *)0;
- nsp->nsp_lastnet = idp->idp_dna.x_net;
+#ifdef ancient_history
+ /*
+ * I think that this will all be handled in ns_pcbconnect!
+ */
+ if (ro->ro_rt) {
+ if(ns_neteq(nsp->nsp_lastdst, idp->idp_dna)) {
+ /*
+ * This assumes we have no GH type routes
+ */
+ if (ro->ro_rt->rt_flags & RTF_HOST) {
+ if (!ns_hosteq(nsp->nsp_lastdst, idp->idp_dna))
+ goto re_route;
+
+ }
+ if ((ro->ro_rt->rt_flags & RTF_GATEWAY) == 0) {
+ register struct ns_addr *dst =
+ &satons_addr(ro->ro_dst);
+ dst->x_host = idp->idp_dna.x_host;
+ }
+ /*
+ * Otherwise, we go through the same gateway
+ * and dst is already set up.
+ */
+ } else {
+ re_route:
+ RTFREE(ro->ro_rt);
+ ro->ro_rt = (struct rtentry *)0;
+ }