Date: Tue, 6 Feb 2007 19:05:50 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114119 for review Message-ID: <200702061905.l16J5o2C041477@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114119 Change 114119 by piso@piso_newluxor on 2007/02/06 19:05:34 With mbuf support, came the ability to support arbitrary sized packets and thus, we can finally, fix the TSO and big MTU support: in case we pass 0 as maxpacketsize, libalias won't check any more size of packets. NB: actually, for the kernel side, i can completely #ifdef-out the maxpacketsize checks and simplify the API. Perhaps i'll do that later... Affected files ... .. //depot/projects/soc2005/libalias/sys/netgraph/ng_nat.c#10 edit .. //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#43 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#57 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_proxy.c#21 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netgraph/ng_nat.c#10 (text+ko) ==== @@ -226,14 +226,14 @@ ("ng_nat: ip_len != m_pkthdr.len")); if (hook == priv->in) { - rval = LibAliasIn(priv->lib, &m, MCLBYTES); + rval = LibAliasIn(priv->lib, &m, 0); if (rval != PKT_ALIAS_OK && rval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) { NG_FREE_ITEM(item); return (EINVAL); } } else if (hook == priv->out) { - rval = LibAliasOut(priv->lib, &m, MCLBYTES); + rval = LibAliasOut(priv->lib, &m, 0); if (rval != PKT_ALIAS_OK) { NG_FREE_ITEM(item); return (EINVAL); ==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#43 (text+ko) ==== @@ -3561,11 +3561,9 @@ ldt = 1; if (oif == NULL) - retval = LibAliasIn(t->lib, &m, - MCLBYTES); + retval = LibAliasIn(t->lib, &m, 0); else - retval = LibAliasOut(t->lib, &m, - MCLBYTES); + retval = LibAliasOut(t->lib, &m, 0); if (retval != PKT_ALIAS_OK) { /* XXX - should i add some logging? */ m_free(m); ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#57 (text+ko) ==== @@ -1304,9 +1304,11 @@ alias_addr = pip->ip_dst; /* Defense against mangled packets */ - if (ntohs(pip->ip_len) > maxpacketsize - || (pip->ip_hl << 2) > maxpacketsize) - goto getout; + if (maxpacketsize != 0) { + if (ntohs(pip->ip_len) > maxpacketsize + || (pip->ip_hl << 2) > maxpacketsize) + goto getout; + } if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0) { switch (pip->ip_p) { @@ -1436,10 +1438,12 @@ } /* Defense against mangled packets */ - if (ntohs(pip->ip_len) > maxpacketsize - || (pip->ip_hl << 2) > maxpacketsize) { - printf("mangled pkt\n"); - goto getout; + if (maxpacketsize != 0) { + if (ntohs(pip->ip_len) > maxpacketsize + || (pip->ip_hl << 2) > maxpacketsize) { + printf("mangled pkt\n"); + goto getout; + } } addr_save = GetDefaultAliasAddress(la); @@ -1526,9 +1530,11 @@ goto getout; /* Defense against mangled packets */ - if (ntohs(pip->ip_len) > maxpacketsize - || (pip->ip_hl << 2) > maxpacketsize) - goto getout; + if (maxpacketsize != 0) { + if (ntohs(pip->ip_len) > maxpacketsize + || (pip->ip_hl << 2) > maxpacketsize) + goto getout; + } /* Let's make enough space for any of the protocols header below */ PULLUP_ICMPHDR(pip, ptr); ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_proxy.c#21 (text+ko) ==== @@ -428,8 +428,11 @@ } /* Check for packet overflow */ - if ((int)(ntohs(pip->ip_len) + strlen(buffer)) > maxpacketsize) - return; + if (maxpacketsize != 0) { + if ((int)(ntohs(pip->ip_len) + strlen(buffer)) > + maxpacketsize) + return; + } /* Shift existing TCP data and insert destination string */ {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702061905.l16J5o2C041477>