summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-03 15:52:35 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-03 15:52:35 +0000
commit9cfa5a947ffa05d6a93437ddc4903fcb3ee684c1 (patch)
treeb1145edca2436d6020fd67e6096ac8b49beaba63
parentc4ae2032edc24522fac4bb6f91066b40028cc228 (diff)
no need to mh_align (while it's wrong), cleaner mtu setting; dhartmei@ ok
-rw-r--r--sys/net/if_pfsync.c34
-rw-r--r--sys/net/pf.c6
2 files changed, 19 insertions, 21 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index a2b8b25c8cf..cd5242571ec 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.1 2002/11/29 18:25:22 mickey Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.2 2002/12/03 15:52:34 mickey Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -57,8 +57,6 @@
#include <net/pfvar.h>
#include <net/if_pfsync.h>
-#define PFSYNCMTU \
- (sizeof(struct pfsync_header) + sizeof(struct pf_state) * 4)
#define PFSYNC_MINMTU \
(sizeof(struct pfsync_header) + sizeof(struct pf_state))
@@ -72,10 +70,10 @@ int pfsyncdebug;
struct pfsync_softc pfsyncif;
void pfsyncattach(int);
+void pfsync_setmtu(struct pfsync_softc *sc, int);
int pfsyncoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
int pfsyncioctl(struct ifnet *, u_long, caddr_t);
-void pfsyncrtrequest(int, struct rtentry *, struct sockaddr *);
void pfsyncstart(struct ifnet *);
struct mbuf *pfsync_get_mbuf(struct pfsync_softc *sc, u_int8_t action);
@@ -95,13 +93,14 @@ pfsyncattach(int npfsync)
ifp = &pfsyncif.sc_if;
strcpy(ifp->if_xname, "pfsync0");
ifp->if_softc = &pfsyncif;
- ifp->if_mtu = PFSYNCMTU;
ifp->if_ioctl = pfsyncioctl;
ifp->if_output = pfsyncoutput;
ifp->if_start = pfsyncstart;
ifp->if_type = IFT_PFSYNC;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
ifp->if_hdrlen = PFSYNC_HDRLEN;
+ ifp->if_baudrate = IF_Mbps(100);
+ pfsync_setmtu(&pfsyncif, MCLBYTES);
timeout_set(&pfsyncif.sc_tmo, pfsync_timeout, &pfsyncif);
if_attach(ifp);
if_alloc_sadl(ifp);
@@ -142,14 +141,6 @@ pfsyncoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
}
/* ARGSUSED */
-void
-pfsyncrtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa)
-{
- if (rt)
- rt->rt_rmx.rmx_mtu = PFSYNCMTU;
-}
-
-/* ARGSUSED */
int
pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
@@ -175,10 +166,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
s = splnet();
if (ifr->ifr_mtu < ifp->if_mtu)
pfsync_sendout(sc);
- sc->sc_count = (ifr->ifr_mtu - sizeof(struct pfsync_header)) /
- sizeof(struct pf_state);
- ifp->if_mtu = sizeof(struct pfsync_header) +
- sc->sc_count * sizeof(struct pf_state);
+ pfsync_setmtu(sc, ifr->ifr_mtu);
splx(s);
break;
default:
@@ -188,6 +176,17 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
return (0);
}
+void
+pfsync_setmtu(sc, mtu)
+ struct pfsync_softc *sc;
+ int mtu;
+{
+ sc->sc_count = (mtu - sizeof(struct pfsync_header)) /
+ sizeof(struct pf_state);
+ sc->sc_if.if_mtu = sizeof(struct pfsync_header) +
+ sc->sc_count * sizeof(struct pf_state);
+}
+
struct mbuf *
pfsync_get_mbuf(sc, action)
struct pfsync_softc *sc;
@@ -215,7 +214,6 @@ pfsync_get_mbuf(sc, action)
}
m->m_pkthdr.rcvif = NULL;
m->m_pkthdr.len = m->m_len = len;
- MH_ALIGN(m, m->m_len);
h = mtod(m, struct pfsync_header *);
h->version = PFSYNC_VERSION;
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 9a7073ed811..242a60c9871 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.267 2002/12/01 19:54:32 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.268 2002/12/03 15:52:33 mickey Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -447,7 +447,7 @@ pf_insert_state(struct pf_state *state)
pf_status.fcounters[FCNT_STATE_INSERT]++;
pf_status.states++;
#if NPFSYNC
- /* pfsync_insert_state(state); */
+ pfsync_insert_state(state);
#endif
return (0);
}
@@ -495,7 +495,7 @@ pf_purge_expired_states(void)
RB_REMOVE(pf_state_tree, &tree_lan_ext, peer);
#if NPFSYNC
- /* pfsync_delete_state(cur->state); */
+ pfsync_delete_state(cur->state);
#endif
if (cur->state->rule.ptr != NULL)
cur->state->rule.ptr->states--;