1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 254523 2013-08-19 13:27:32Z andre $");
34
35#include "opt_ipfw.h"
36#include "opt_ipsec.h"
37#include "opt_route.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_sctp.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/malloc.h>
46#include <sys/mbuf.h>
47#include <sys/priv.h>
48#include <sys/proc.h>
49#include <sys/protosw.h>
50#include <sys/socket.h>
51#include <sys/socketvar.h>
52#include <sys/sysctl.h>
53#include <sys/ucred.h>
54
55#include <net/if.h>
56#include <net/if_llatbl.h>
57#include <net/netisr.h>
58#include <net/pfil.h>
59#include <net/route.h>
60#include <net/flowtable.h>
61#ifdef RADIX_MPATH
62#include <net/radix_mpath.h>
63#endif
64#include <net/vnet.h>
65
66#include <netinet/in.h>
67#include <netinet/in_systm.h>
68#include <netinet/ip.h>
69#include <netinet/in_pcb.h>
70#include <netinet/in_var.h>
71#include <netinet/ip_var.h>
72#include <netinet/ip_options.h>
73#ifdef SCTP
74#include <netinet/sctp.h>
--- 542 unchanged lines hidden (view full) ---
617 if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size)
618 m = m_fragment(m, M_NOWAIT, mbuf_frag_size);
619#endif
620 /*
621 * Reset layer specific mbuf flags
622 * to avoid confusing lower layers.
623 */
624 m_clrprotoflags(m);
625 error = (*ifp->if_output)(ifp, m,
626 (const struct sockaddr *)gw, ro);
627 goto done;
628 }
629
630 /* Balk when DF bit is set or the interface didn't support TSO. */
631 if ((ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) {
632 error = EMSGSIZE;
--- 18 unchanged lines hidden (view full) ---
651 ia->ia_ifa.if_obytes += m->m_pkthdr.len;
652 }
653 /*
654 * Reset layer specific mbuf flags
655 * to avoid confusing upper layers.
656 */
657 m_clrprotoflags(m);
658
659 error = (*ifp->if_output)(ifp, m,
660 (const struct sockaddr *)gw, ro);
661 } else
662 m_freem(m);
663 }
664
665 if (error == 0)
666 IPSTAT_INC(ips_fragmented);
--- 640 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 16 unchanged lines hidden (view full) ---
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 254523 2013-08-19 13:27:32Z andre $");
34
35#include "opt_ipfw.h"
36#include "opt_ipsec.h"
37#include "opt_route.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_sctp.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/malloc.h>
46#include <sys/mbuf.h>
47#include <sys/priv.h>
48#include <sys/proc.h>
49#include <sys/protosw.h>
50#include <sys/socket.h>
51#include <sys/socketvar.h>
52#include <sys/sysctl.h>
53#include <sys/ucred.h>
54
55#include <net/if.h>
56#include <net/if_llatbl.h>
57#include <net/netisr.h>
58#include <net/pfil.h>
59#include <net/route.h>
60#include <net/flowtable.h>
61#ifdef RADIX_MPATH
62#include <net/radix_mpath.h>
63#endif
64#include <net/vnet.h>
65
66#include <netinet/in.h>
67#include <netinet/in_systm.h>
68#include <netinet/ip.h>
69#include <netinet/in_pcb.h>
70#include <netinet/in_var.h>
71#include <netinet/ip_var.h>
72#include <netinet/ip_options.h>
73#ifdef SCTP
74#include <netinet/sctp.h>
--- 542 unchanged lines hidden (view full) ---
617 if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size)
618 m = m_fragment(m, M_NOWAIT, mbuf_frag_size);
619#endif
620 /*
621 * Reset layer specific mbuf flags
622 * to avoid confusing lower layers.
623 */
624 m_clrprotoflags(m);
625 error = (*ifp->if_output)(ifp, m,
626 (const struct sockaddr *)gw, ro);
627 goto done;
628 }
629
630 /* Balk when DF bit is set or the interface didn't support TSO. */
631 if ((ip_off & IP_DF) || (m->m_pkthdr.csum_flags & CSUM_TSO)) {
632 error = EMSGSIZE;
--- 18 unchanged lines hidden (view full) ---
651 ia->ia_ifa.if_obytes += m->m_pkthdr.len;
652 }
653 /*
654 * Reset layer specific mbuf flags
655 * to avoid confusing upper layers.
656 */
657 m_clrprotoflags(m);
658
659 error = (*ifp->if_output)(ifp, m,
660 (const struct sockaddr *)gw, ro);
661 } else
662 m_freem(m);
663 }
664
665 if (error == 0)
666 IPSTAT_INC(ips_fragmented);
--- 640 unchanged lines hidden ---