diff options
-rw-r--r-- | sys/conf/options | 1 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sys/conf/options b/sys/conf/options index 1024a5d..82f2fce 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -360,6 +360,7 @@ SLIP_IFF_OPTS opt_slip.h TCPDEBUG TCP_DROP_SYNFIN opt_tcp_input.h XBONEHACK +MBUF_FRAG_TEST opt_mbuf_frag_test.h # Netgraph(4). Use option NETGRAPH to enable the base netgraph code. # Each netgraph node type can be either be compiled into the kernel diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 9877964..02fb2d3 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -42,6 +42,7 @@ #include "opt_mac.h" #include "opt_pfil_hooks.h" #include "opt_random_ip_id.h" +#include "opt_mbuf_frag_test.h" #include <sys/param.h> #include <sys/systm.h> @@ -52,6 +53,7 @@ #include <sys/protosw.h> #include <sys/socket.h> #include <sys/socketvar.h> +#include <sys/sysctl.h> #include <net/if.h> #include <net/route.h> @@ -94,6 +96,12 @@ static MALLOC_DEFINE(M_IPMOPTS, "ip_moptions", "internet multicast options"); u_short ip_id; +#ifdef MBUF_FRAG_TEST +int mbuf_frag_size = 0; +SYSCTL_INT(_net_inet_ip, OID_AUTO, mbuf_frag_size, CTLFLAG_RW, + &mbuf_frag_size, 0, "Fragment outgoing mbufs to this size"); +#endif + static struct mbuf *ip_insertoptions(struct mbuf *, struct mbuf *, int *); static struct ifnet *ip_multicast_if(struct in_addr *, int *); static void ip_mloopback @@ -1012,6 +1020,28 @@ pass: ipsec_delaux(m); #endif +#ifdef MBUF_FRAG_TEST + if (mbuf_frag_size) { + struct mbuf *m1, *m2; + int length; + + length = m->m_len; + + while (1) { + length -= mbuf_frag_size; + if (length < 1) + break; + m1 = m_split(m, length, M_DONTWAIT); + m2 = m; + while (1) { + if (m2->m_next == NULL) + break; + m2 = m2->m_next; + } + m2->m_next = m1; + } + } +#endif error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, ro->ro_rt); goto done; |