ip_fastfwd.c revision 254889
128021Sjoerg/*-
228021Sjoerg * Copyright (c) 2003 Andre Oppermann, Internet Business Solutions AG
328021Sjoerg * All rights reserved.
428021Sjoerg *
528021Sjoerg * Redistribution and use in source and binary forms, with or without
628021Sjoerg * modification, are permitted provided that the following conditions
728021Sjoerg * are met:
828021Sjoerg * 1. Redistributions of source code must retain the above copyright
928021Sjoerg *    notice, this list of conditions and the following disclaimer.
1028021Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1128021Sjoerg *    notice, this list of conditions and the following disclaimer in the
1228021Sjoerg *    documentation and/or other materials provided with the distribution.
1328021Sjoerg * 3. The name of the author may not be used to endorse or promote
1428021Sjoerg *    products derived from this software without specific prior written
1528021Sjoerg *    permission.
1628021Sjoerg *
1728021Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1828021Sjoerg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1928021Sjoerg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2028021Sjoerg * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2128021Sjoerg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2228021Sjoerg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2328021Sjoerg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2428021Sjoerg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2528021Sjoerg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2650476Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2728021Sjoerg * SUCH DAMAGE.
28272758Spfg */
2928021Sjoerg
3028021Sjoerg/*
3128021Sjoerg * ip_fastforward gets its speed from processing the forwarded packet to
3228021Sjoerg * completion (if_output on the other side) without any queues or netisr's.
3328021Sjoerg * The receiving interface DMAs the packet into memory, the upper half of
3459460Sphantom * driver calls ip_fastforward, we do our routing table lookup and directly
3559460Sphantom * send it off to the outgoing interface, which DMAs the packet to the
3628021Sjoerg * network card. The only part of the packet we touch with the CPU is the
3784306Sru * IP header (unless there are complex firewall rules touching other parts
3839113Sdt * of the packet, but that is up to you). We are essentially limited by bus
39101936Srobert * bandwidth and how fast the network card/driver can set up receives and
40103012Stjr * transmits.
41103012Stjr *
42103012Stjr * We handle basic errors, IP header errors, checksum errors,
43101936Srobert * destination unreachable, fragmentation and fragmentation needed and
44237573Sissyl0 * report them via ICMP to the sender.
45237573Sissyl0 *
46237573Sissyl0 * Else if something is not pure IPv4 unicast forwarding we fall back to
47237573Sissyl0 * the normal ip_input processing path. We should only be called from
4828021Sjoerg * interfaces connected to the outside world.
4928021Sjoerg *
5028021Sjoerg * Firewalling is fully supported including divert, ipfw fwd and ipfilter
5128021Sjoerg * ipnat and address rewrite.
5228021Sjoerg *
5328021Sjoerg * IPSEC is not supported if this host is a tunnel broker. IPSEC is
5428021Sjoerg * supported for connections to/from local host.
5528021Sjoerg *
5628021Sjoerg * We try to do the least expensive (in CPU ops) checks and operations
5748550Sobrien * first to catch junk with as little overhead as possible.
5828021Sjoerg *
5928021Sjoerg * We take full advantage of hardware support for IP checksum and
60237573Sissyl0 * fragmentation offloading.
61237573Sissyl0 *
62237573Sissyl0 * We don't do ICMP redirect in the fast forwarding path. I have had my own
63237573Sissyl0 * cases where two core routers with Zebra routing suite would send millions
64237573Sissyl0 * ICMP redirects to connected hosts if the destination router was not the
6528021Sjoerg * default gateway. In one case it was filling the routing table of a host
6628021Sjoerg * with approximately 300.000 cloned redirect entries until it ran out of
6728021Sjoerg * kernel memory. However the networking code proved very robust and it didn't
6828021Sjoerg * crash or fail in other ways.
6928021Sjoerg */
7028021Sjoerg
7128021Sjoerg/*
7228021Sjoerg * Many thanks to Matt Thomas of NetBSD for basic structure of ip_flow.c which
7328021Sjoerg * is being followed here.
7428021Sjoerg */
7546042Swes
7646042Swes#include <sys/cdefs.h>
7746051Swes__FBSDID("$FreeBSD: head/sys/netinet/ip_fastfwd.c 254889 2013-08-25 21:54:41Z markj $");
7879754Sdd
7970481Sru#include "opt_ipfw.h"
8046051Swes#include "opt_ipstealth.h"
8146051Swes#include "opt_kdtrace.h"
8246051Swes
83272758Spfg#include <sys/param.h>
84272758Spfg#include <sys/systm.h>
85272758Spfg#include <sys/kernel.h>
86272758Spfg#include <sys/malloc.h>
87272758Spfg#include <sys/mbuf.h>
88108013Stjr#include <sys/protosw.h>
89108013Stjr#include <sys/sdt.h>
90108013Stjr#include <sys/socket.h>
91108013Stjr#include <sys/sysctl.h>
92108013Stjr
93108013Stjr#include <net/pfil.h>
94108013Stjr#include <net/if.h>
95108013Stjr#include <net/if_types.h>
96108013Stjr#include <net/if_var.h>
97108013Stjr#include <net/if_dl.h>
98108013Stjr#include <net/route.h>
99108013Stjr#include <net/vnet.h>
100108083Sru
101108013Stjr#include <netinet/in.h>
102108013Stjr#include <netinet/in_kdtrace.h>
103108013Stjr#include <netinet/in_systm.h>
104108013Stjr#include <netinet/in_var.h>
105108013Stjr#include <netinet/ip.h>
106108013Stjr#include <netinet/ip_var.h>
107108013Stjr#include <netinet/ip_icmp.h>
108108013Stjr#include <netinet/ip_options.h>
109108013Stjr
110108013Stjr#include <machine/in_cksum.h>
11128021Sjoerg
11228021Sjoergstatic VNET_DEFINE(int, ipfastforward_active);
11328021Sjoerg#define	V_ipfastforward_active		VNET(ipfastforward_active)
11428021Sjoerg
11528021SjoergSYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fastforwarding, CTLFLAG_RW,
11628021Sjoerg    &VNET_NAME(ipfastforward_active), 0, "Enable fast IP forwarding");
11728021Sjoerg
11828021Sjoergstatic struct sockaddr_in *
11928021Sjoergip_findroute(struct route *ro, struct in_addr dest, struct mbuf *m)
12028021Sjoerg{
121237573Sissyl0	struct sockaddr_in *dst;
122237573Sissyl0	struct rtentry *rt;
123237573Sissyl0
12428021Sjoerg	/*
12528021Sjoerg	 * Find route to destination.
12628021Sjoerg	 */
12728021Sjoerg	bzero(ro, sizeof(*ro));
128140505Sru	dst = (struct sockaddr_in *)&ro->ro_dst;
129140505Sru	dst->sin_family = AF_INET;
130140505Sru	dst->sin_len = sizeof(*dst);
131140505Sru	dst->sin_addr.s_addr = dest.s_addr;
132140505Sru	in_rtalloc_ign(ro, 0, M_GETFIB(m));
13328021Sjoerg
13428021Sjoerg	/*
13528021Sjoerg	 * Route there and interface still up?
13628021Sjoerg	 */
13728021Sjoerg	rt = ro->ro_rt;
13828021Sjoerg	if (rt && (rt->rt_flags & RTF_UP) &&
13968575Sru	    (rt->rt_ifp->if_flags & IFF_UP) &&
14048550Sobrien	    (rt->rt_ifp->if_drv_flags & IFF_DRV_RUNNING)) {
14154316Ssheldonh		if (rt->rt_flags & RTF_GATEWAY)
14254316Ssheldonh			dst = (struct sockaddr_in *)rt->rt_gateway;
14354316Ssheldonh	} else {
14454316Ssheldonh		IPSTAT_INC(ips_noroute);
14554316Ssheldonh		IPSTAT_INC(ips_cantforward);
14654316Ssheldonh		if (rt)
14754316Ssheldonh			RTFREE(rt);
14854316Ssheldonh		icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
14954316Ssheldonh		return NULL;
15054316Ssheldonh	}
15154316Ssheldonh	return dst;
15254316Ssheldonh}
15354316Ssheldonh
15454316Ssheldonh/*
15554316Ssheldonh * Try to forward a packet based on the destination address.
15654316Ssheldonh * This is a fast path optimized for the plain forwarding case.
15754316Ssheldonh * If the packet is handled (and consumed) here then we return NULL;
15854316Ssheldonh * otherwise mbuf is returned and the packet should be delivered
15954316Ssheldonh * to ip_input for full processing.
16054316Ssheldonh */
16154316Ssheldonhstruct mbuf *
16281251Sruip_fastforward(struct mbuf *m)
16354316Ssheldonh{
16454316Ssheldonh	struct ip *ip;
16581251Sru	struct mbuf *m0 = NULL;
16654316Ssheldonh	struct route ro;
16754316Ssheldonh	struct sockaddr_in *dst = NULL;
16854316Ssheldonh	struct ifnet *ifp;
16948550Sobrien	struct in_addr odest, dest;
17048550Sobrien	uint16_t sum, ip_len, ip_off;
17148550Sobrien	int error = 0;
17248550Sobrien	int hlen, mtu;
173131504Sru	struct m_tag *fwd_tag = NULL;
174131504Sru
17548550Sobrien	/*
17648550Sobrien	 * Are we active and forwarding packets?
177108653Stjr	 */
178108653Stjr	if (!V_ipfastforward_active || !V_ipforwarding)
179108653Stjr		return m;
180108653Stjr
181108653Stjr	M_ASSERTVALID(m);
182108653Stjr	M_ASSERTPKTHDR(m);
183
184	bzero(&ro, sizeof(ro));
185
186	/*
187	 * Step 1: check for packet drop conditions (and sanity checks)
188	 */
189
190	/*
191	 * Is entire packet big enough?
192	 */
193	if (m->m_pkthdr.len < sizeof(struct ip)) {
194		IPSTAT_INC(ips_tooshort);
195		goto drop;
196	}
197
198	/*
199	 * Is first mbuf large enough for ip header and is header present?
200	 */
201	if (m->m_len < sizeof (struct ip) &&
202	   (m = m_pullup(m, sizeof (struct ip))) == NULL) {
203		IPSTAT_INC(ips_toosmall);
204		return NULL;	/* mbuf already free'd */
205	}
206
207	ip = mtod(m, struct ip *);
208
209	/*
210	 * Is it IPv4?
211	 */
212	if (ip->ip_v != IPVERSION) {
213		IPSTAT_INC(ips_badvers);
214		goto drop;
215	}
216
217	/*
218	 * Is IP header length correct and is it in first mbuf?
219	 */
220	hlen = ip->ip_hl << 2;
221	if (hlen < sizeof(struct ip)) {	/* minimum header length */
222		IPSTAT_INC(ips_badhlen);
223		goto drop;
224	}
225	if (hlen > m->m_len) {
226		if ((m = m_pullup(m, hlen)) == NULL) {
227			IPSTAT_INC(ips_badhlen);
228			return NULL;	/* mbuf already free'd */
229		}
230		ip = mtod(m, struct ip *);
231	}
232
233	/*
234	 * Checksum correct?
235	 */
236	if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED)
237		sum = !(m->m_pkthdr.csum_flags & CSUM_IP_VALID);
238	else {
239		if (hlen == sizeof(struct ip))
240			sum = in_cksum_hdr(ip);
241		else
242			sum = in_cksum(m, hlen);
243	}
244	if (sum) {
245		IPSTAT_INC(ips_badsum);
246		goto drop;
247	}
248
249	/*
250	 * Remember that we have checked the IP header and found it valid.
251	 */
252	m->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID);
253
254	ip_len = ntohs(ip->ip_len);
255
256	/*
257	 * Is IP length longer than packet we have got?
258	 */
259	if (m->m_pkthdr.len < ip_len) {
260		IPSTAT_INC(ips_tooshort);
261		goto drop;
262	}
263
264	/*
265	 * Is packet longer than IP header tells us? If yes, truncate packet.
266	 */
267	if (m->m_pkthdr.len > ip_len) {
268		if (m->m_len == m->m_pkthdr.len) {
269			m->m_len = ip_len;
270			m->m_pkthdr.len = ip_len;
271		} else
272			m_adj(m, ip_len - m->m_pkthdr.len);
273	}
274
275	/*
276	 * Is packet from or to 127/8?
277	 */
278	if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
279	    (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
280		IPSTAT_INC(ips_badaddr);
281		goto drop;
282	}
283
284#ifdef ALTQ
285	/*
286	 * Is packet dropped by traffic conditioner?
287	 */
288	if (altq_input != NULL && (*altq_input)(m, AF_INET) == 0)
289		goto drop;
290#endif
291
292	/*
293	 * Step 2: fallback conditions to normal ip_input path processing
294	 */
295
296	/*
297	 * Only IP packets without options
298	 */
299	if (ip->ip_hl != (sizeof(struct ip) >> 2)) {
300		if (ip_doopts == 1)
301			return m;
302		else if (ip_doopts == 2) {
303			icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_FILTER_PROHIB,
304				0, 0);
305			return NULL;	/* mbuf already free'd */
306		}
307		/* else ignore IP options and continue */
308	}
309
310	/*
311	 * Only unicast IP, not from loopback, no L2 or IP broadcast,
312	 * no multicast, no INADDR_ANY
313	 *
314	 * XXX: Probably some of these checks could be direct drop
315	 * conditions.  However it is not clear whether there are some
316	 * hacks or obscure behaviours which make it neccessary to
317	 * let ip_input handle it.  We play safe here and let ip_input
318	 * deal with it until it is proven that we can directly drop it.
319	 */
320	if ((m->m_flags & (M_BCAST|M_MCAST)) ||
321	    (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) ||
322	    ntohl(ip->ip_src.s_addr) == (u_long)INADDR_BROADCAST ||
323	    ntohl(ip->ip_dst.s_addr) == (u_long)INADDR_BROADCAST ||
324	    IN_MULTICAST(ntohl(ip->ip_src.s_addr)) ||
325	    IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) ||
326	    IN_LINKLOCAL(ntohl(ip->ip_src.s_addr)) ||
327	    IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr)) ||
328	    ip->ip_src.s_addr == INADDR_ANY ||
329	    ip->ip_dst.s_addr == INADDR_ANY )
330		return m;
331
332	/*
333	 * Is it for a local address on this host?
334	 */
335	if (in_localip(ip->ip_dst))
336		return m;
337
338	IPSTAT_INC(ips_total);
339
340	/*
341	 * Step 3: incoming packet firewall processing
342	 */
343
344	odest.s_addr = dest.s_addr = ip->ip_dst.s_addr;
345
346	/*
347	 * Run through list of ipfilter hooks for input packets
348	 */
349	if (!PFIL_HOOKED(&V_inet_pfil_hook))
350		goto passin;
351
352	if (pfil_run_hooks(
353	    &V_inet_pfil_hook, &m, m->m_pkthdr.rcvif, PFIL_IN, NULL) ||
354	    m == NULL)
355		goto drop;
356
357	M_ASSERTVALID(m);
358	M_ASSERTPKTHDR(m);
359
360	ip = mtod(m, struct ip *);	/* m may have changed by pfil hook */
361	dest.s_addr = ip->ip_dst.s_addr;
362
363	/*
364	 * Destination address changed?
365	 */
366	if (odest.s_addr != dest.s_addr) {
367		/*
368		 * Is it now for a local address on this host?
369		 */
370		if (in_localip(dest))
371			goto forwardlocal;
372		/*
373		 * Go on with new destination address
374		 */
375	}
376
377	if (m->m_flags & M_FASTFWD_OURS) {
378		/*
379		 * ipfw changed it for a local address on this host.
380		 */
381		goto forwardlocal;
382	}
383
384passin:
385	/*
386	 * Step 4: decrement TTL and look up route
387	 */
388
389	/*
390	 * Check TTL
391	 */
392#ifdef IPSTEALTH
393	if (!V_ipstealth) {
394#endif
395	if (ip->ip_ttl <= IPTTLDEC) {
396		icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, 0);
397		return NULL;	/* mbuf already free'd */
398	}
399
400	/*
401	 * Decrement the TTL and incrementally change the IP header checksum.
402	 * Don't bother doing this with hw checksum offloading, it's faster
403	 * doing it right here.
404	 */
405	ip->ip_ttl -= IPTTLDEC;
406	if (ip->ip_sum >= (u_int16_t) ~htons(IPTTLDEC << 8))
407		ip->ip_sum -= ~htons(IPTTLDEC << 8);
408	else
409		ip->ip_sum += htons(IPTTLDEC << 8);
410#ifdef IPSTEALTH
411	}
412#endif
413
414	/*
415	 * Find route to destination.
416	 */
417	if ((dst = ip_findroute(&ro, dest, m)) == NULL)
418		return NULL;	/* icmp unreach already sent */
419	ifp = ro.ro_rt->rt_ifp;
420
421	/*
422	 * Immediately drop blackholed traffic, and directed broadcasts
423	 * for either the all-ones or all-zero subnet addresses on
424	 * locally attached networks.
425	 */
426	if ((ro.ro_rt->rt_flags & (RTF_BLACKHOLE|RTF_BROADCAST)) != 0)
427		goto drop;
428
429	/*
430	 * Step 5: outgoing firewall packet processing
431	 */
432
433	/*
434	 * Run through list of hooks for output packets.
435	 */
436	if (!PFIL_HOOKED(&V_inet_pfil_hook))
437		goto passout;
438
439	if (pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, NULL) || m == NULL) {
440		goto drop;
441	}
442
443	M_ASSERTVALID(m);
444	M_ASSERTPKTHDR(m);
445
446	ip = mtod(m, struct ip *);
447	dest.s_addr = ip->ip_dst.s_addr;
448
449	/*
450	 * Destination address changed?
451	 */
452	if (m->m_flags & M_IP_NEXTHOP)
453		fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL);
454	if (odest.s_addr != dest.s_addr || fwd_tag != NULL) {
455		/*
456		 * Is it now for a local address on this host?
457		 */
458		if (m->m_flags & M_FASTFWD_OURS || in_localip(dest)) {
459forwardlocal:
460			/*
461			 * Return packet for processing by ip_input().
462			 */
463			m->m_flags |= M_FASTFWD_OURS;
464			if (ro.ro_rt)
465				RTFREE(ro.ro_rt);
466			return m;
467		}
468		/*
469		 * Redo route lookup with new destination address
470		 */
471		if (fwd_tag) {
472			dest.s_addr = ((struct sockaddr_in *)
473				    (fwd_tag + 1))->sin_addr.s_addr;
474			m_tag_delete(m, fwd_tag);
475			m->m_flags &= ~M_IP_NEXTHOP;
476		}
477		RTFREE(ro.ro_rt);
478		if ((dst = ip_findroute(&ro, dest, m)) == NULL)
479			return NULL;	/* icmp unreach already sent */
480		ifp = ro.ro_rt->rt_ifp;
481	}
482
483passout:
484	/*
485	 * Step 6: send off the packet
486	 */
487	ip_len = ntohs(ip->ip_len);
488	ip_off = ntohs(ip->ip_off);
489
490	/*
491	 * Check if route is dampned (when ARP is unable to resolve)
492	 */
493	if ((ro.ro_rt->rt_flags & RTF_REJECT) &&
494	    (ro.ro_rt->rt_rmx.rmx_expire == 0 ||
495	    time_uptime < ro.ro_rt->rt_rmx.rmx_expire)) {
496		icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
497		goto consumed;
498	}
499
500#ifndef ALTQ
501	/*
502	 * Check if there is enough space in the interface queue
503	 */
504	if ((ifp->if_snd.ifq_len + ip_len / ifp->if_mtu + 1) >=
505	    ifp->if_snd.ifq_maxlen) {
506		IPSTAT_INC(ips_odropped);
507		/* would send source quench here but that is depreciated */
508		goto drop;
509	}
510#endif
511
512	/*
513	 * Check if media link state of interface is not down
514	 */
515	if (ifp->if_link_state == LINK_STATE_DOWN) {
516		icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
517		goto consumed;
518	}
519
520	/*
521	 * Check if packet fits MTU or if hardware will fragment for us
522	 */
523	if (ro.ro_rt->rt_rmx.rmx_mtu)
524		mtu = min(ro.ro_rt->rt_rmx.rmx_mtu, ifp->if_mtu);
525	else
526		mtu = ifp->if_mtu;
527
528	if (ip_len <= mtu ||
529	    (ifp->if_hwassist & CSUM_FRAGMENT && (ip_off & IP_DF) == 0)) {
530		/*
531		 * Avoid confusing lower layers.
532		 */
533		m_clrprotoflags(m);
534		/*
535		 * Send off the packet via outgoing interface
536		 */
537		IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
538		error = (*ifp->if_output)(ifp, m,
539				(struct sockaddr *)dst, &ro);
540	} else {
541		/*
542		 * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery
543		 */
544		if (ip_off & IP_DF) {
545			IPSTAT_INC(ips_cantfrag);
546			icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG,
547				0, mtu);
548			goto consumed;
549		} else {
550			/*
551			 * We have to fragment the packet
552			 */
553			m->m_pkthdr.csum_flags |= CSUM_IP;
554			if (ip_fragment(ip, &m, mtu, ifp->if_hwassist))
555				goto drop;
556			KASSERT(m != NULL, ("null mbuf and no error"));
557			/*
558			 * Send off the fragments via outgoing interface
559			 */
560			error = 0;
561			do {
562				m0 = m->m_nextpkt;
563				m->m_nextpkt = NULL;
564				/*
565				 * Avoid confusing lower layers.
566				 */
567				m_clrprotoflags(m);
568
569				IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
570				error = (*ifp->if_output)(ifp, m,
571					(struct sockaddr *)dst, &ro);
572				if (error)
573					break;
574			} while ((m = m0) != NULL);
575			if (error) {
576				/* Reclaim remaining fragments */
577				for (m = m0; m; m = m0) {
578					m0 = m->m_nextpkt;
579					m_freem(m);
580				}
581			} else
582				IPSTAT_INC(ips_fragmented);
583		}
584	}
585
586	if (error != 0)
587		IPSTAT_INC(ips_odropped);
588	else {
589		ro.ro_rt->rt_rmx.rmx_pksent++;
590		IPSTAT_INC(ips_forward);
591		IPSTAT_INC(ips_fastforward);
592	}
593consumed:
594	RTFREE(ro.ro_rt);
595	return NULL;
596drop:
597	if (m)
598		m_freem(m);
599	if (ro.ro_rt)
600		RTFREE(ro.ro_rt);
601	return NULL;
602}
603