Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jan 2012 14:39:45 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r229777 - head/sys/contrib/pf/net
Message-ID:  <201201071439.q07EdjZu043789@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Sat Jan  7 14:39:45 2012
New Revision: 229777
URL: http://svn.freebsd.org/changeset/base/229777

Log:
  Merge from OpenBSD:
    revision 1.170
    date: 2011/10/30 23:04:38;  author: mikeb;  state: Exp;  lines: +6 -7
    Allow setting big MTU values on the pfsync interface but not larger
    than the syncdev MTU.  Prompted by the discussion with and tested
    by Maxim Bourmistrov;  ok dlg, mpf
  
  Consistently use sc_ifp->if_mtu in the MTU check throughout the
  module. This backs out r228813.

Modified:
  head/sys/contrib/pf/net/if_pfsync.c

Modified: head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- head/sys/contrib/pf/net/if_pfsync.c	Sat Jan  7 14:35:37 2012	(r229776)
+++ head/sys/contrib/pf/net/if_pfsync.c	Sat Jan  7 14:39:45 2012	(r229777)
@@ -47,6 +47,7 @@
  * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates
  * 1.120, 1.175 - use monotonic time_uptime
  * 1.122 - reduce number of updates for non-TCP sessions
+ * 1.170 - SIOCSIFMTU checks
  */
 
 #ifdef __FreeBSD__
@@ -492,13 +493,12 @@ pfsync_clone_create(struct if_clone *ifc
 	ifp->if_type = IFT_PFSYNC;
 	ifp->if_snd.ifq_maxlen = ifqmaxlen;
 	ifp->if_hdrlen = sizeof(struct pfsync_header);
-	ifp->if_mtu = 1500; /* XXX */
+	ifp->if_mtu = ETHERMTU;
 #ifdef __FreeBSD__
 	callout_init(&sc->sc_tmo, CALLOUT_MPSAFE);
 	callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0);
 	callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE);
 #else
-	ifp->if_hardmtu = MCLBYTES; /* XXX */
 	timeout_set(&sc->sc_tmo, pfsync_timeout, sc);
 	timeout_set(&sc->sc_bulk_tmo, pfsync_bulk_update, sc);
 	timeout_set(&sc->sc_bulkfail_tmo, pfsync_bulk_fail, sc);
@@ -1614,7 +1614,7 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st
 #ifdef __FreeBSD__
 		callout_reset(&sc->sc_bulkfail_tmo, 4 * hz +
 		    V_pf_pool_limits[PF_LIMIT_STATES].limit /
-		    ((sc->sc_sync_if->if_mtu - PFSYNC_MINPKT) /
+		    ((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) /
 		    sizeof(struct pfsync_state)),
 		    pfsync_bulk_fail, V_pfsyncif);
 #else
@@ -1821,10 +1821,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cm
 #endif
 		break;
 	case SIOCSIFMTU:
-		if (ifr->ifr_mtu <= PFSYNC_MINPKT)
+		if (!sc->sc_sync_if ||
+		    ifr->ifr_mtu <= PFSYNC_MINPKT ||
+		    ifr->ifr_mtu > sc->sc_sync_if->if_mtu)
 			return (EINVAL);
-		if (ifr->ifr_mtu > MCLBYTES) /* XXX could be bigger */
-			ifr->ifr_mtu = MCLBYTES;
 		if (ifr->ifr_mtu < ifp->if_mtu) {
 			s = splnet();
 #ifdef __FreeBSD__
@@ -2667,7 +2667,7 @@ pfsync_request_update(u_int32_t creatori
 		nlen += sizeof(struct pfsync_subheader);
 
 #ifdef __FreeBSD__
-	if (sc->sc_len + nlen > sc->sc_sync_if->if_mtu) {
+	if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) {
 #else
 	if (sc->sc_len + nlen > sc->sc_if.if_mtu) {
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201071439.q07EdjZu043789>