summaryrefslogtreecommitdiff
path: root/sys/net/if_pfsync.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-10-30 23:04:39 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-10-30 23:04:39 +0000
commit8ab0fd9b71c3bbc2e01fb58ebc431565e016ffb8 (patch)
tree71ab0c4ddc44377288b28b251afbac9bd91753f9 /sys/net/if_pfsync.c
parent88e7b9700fba17868e6f3a26525f705b8d72b31b (diff)
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
Diffstat (limited to 'sys/net/if_pfsync.c')
-rw-r--r--sys/net/if_pfsync.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 0c1fe94cd98..1a255947cf6 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.169 2011/10/20 08:57:26 mikeb Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.170 2011/10/30 23:04:38 mikeb Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -319,8 +319,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit)
ifp->if_type = IFT_PFSYNC;
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
ifp->if_hdrlen = sizeof(struct pfsync_header);
- ifp->if_mtu = 1500; /* XXX */
- ifp->if_hardmtu = MCLBYTES; /* XXX */
+ ifp->if_mtu = ETHERMTU;
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);
@@ -1291,11 +1290,11 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
splx(s);
break;
case SIOCSIFMTU:
- s = splnet();
- 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;
+ s = splnet();
if (ifr->ifr_mtu < ifp->if_mtu)
pfsync_sendout();
ifp->if_mtu = ifr->ifr_mtu;