+ register int error, type, code;
+ struct mbuf *mopt, *mcopy;
+
+ if (ipprintfs)
+ printf("forward: src %x dst %x ttl %x\n", ip->ip_src,
+ ip->ip_dst, ip->ip_ttl);
+ if (ipforwarding == 0) {
+ /* can't tell difference between net and host */
+ type = ICMP_UNREACH, code = ICMP_UNREACH_NET;
+ goto sendicmp;
+ }
+ if (ip->ip_ttl < IPTTLDEC) {
+ type = ICMP_TIMXCEED, code = ICMP_TIMXCEED_INTRANS;
+ goto sendicmp;
+ }
+ ip->ip_ttl -= IPTTLDEC;
+ mopt = m_get(M_DONTWAIT);
+ if (mopt == 0) {
+ m_freem(dtom(ip));
+ return;
+ }