+ /*
+ * Save at most 42 bytes of the packet in case
+ * we need to generate an NS error message to the src.
+ */
+ mcopy = m_copy(m, 0, imin((int)ntohs(idp->idp_len), 42));
+
+ if ((ok_there = idp_do_route(&idp->idp_dna,&idp_droute))==0) {
+ type = NS_ERR_UNREACH_HOST, code = 0;
+ goto senderror;
+ }
+ /*
+ * Here we think about forwarding broadcast packets,
+ * so we try to insure that it doesn't go back out
+ * on the interface it came in on. Also, if we
+ * are going to physically broadcast this, let us
+ * age the packet so we can eat it safely the second time around.
+ */
+ if (idp->idp_dna.x_host.c_host[0] & 0x1) {
+ struct ns_ifaddr *ia = ns_iaonnetof(&idp->idp_dna);
+ struct ifnet *ifp;
+ if (ia) {
+ /* I'm gonna hafta eat this packet */
+ agedelta += NS_MAXHOPS - idp->idp_tc;
+ idp->idp_tc = NS_MAXHOPS;
+ }
+ if ((ok_back = idp_do_route(&idp->idp_sna,&idp_sroute))==0) {
+ /* error = ENETUNREACH; He'll never get it! */
+ m_freem(m);
+ goto cleanup;
+ }
+ if (idp_droute.ro_rt &&
+ (ifp=idp_droute.ro_rt->rt_ifp) &&
+ idp_sroute.ro_rt &&
+ (ifp!=idp_sroute.ro_rt->rt_ifp)) {
+ flags |= NS_ALLOWBROADCAST;
+ } else {
+ type = NS_ERR_UNREACH_HOST, code = 0;
+ goto senderror;
+ }
+ }