diff options
author | mlaier <mlaier@FreeBSD.org> | 2006-06-14 11:11:54 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2006-06-14 11:11:54 +0000 |
commit | 1092903e053d6bca1cb8448e6f1e34839c574128 (patch) | |
tree | 2285ae32397c485949b8b7471475950edd7d59db /sys/contrib/pf | |
parent | 7dfc8c73aac5271394bd211587735039810dcd90 (diff) | |
download | FreeBSD-src-1092903e053d6bca1cb8448e6f1e34839c574128.zip FreeBSD-src-1092903e053d6bca1cb8448e6f1e34839c574128.tar.gz |
Fix byteorder of syncpeer and make it actually work.
Submitted by: glebius
MFC after: 1 week
Diffstat (limited to 'sys/contrib/pf')
-rw-r--r-- | sys/contrib/pf/net/if_pfsync.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c index 2c7f10c..8c8b3f4 100644 --- a/sys/contrib/pf/net/if_pfsync.c +++ b/sys/contrib/pf/net/if_pfsync.c @@ -221,6 +221,7 @@ pfsync_clone_create(struct if_clone *ifc, int unit) sc->sc_statep.s = NULL; sc->sc_statep_net.s = NULL; sc->sc_maxupdates = 128; + sc->sc_sync_peer.s_addr = htonl(INADDR_PFSYNC_GROUP); sc->sc_sendaddr.s_addr = htonl(INADDR_PFSYNC_GROUP); sc->sc_ureq_received = 0; sc->sc_ureq_sent = 0; @@ -1054,7 +1055,11 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); if (pfsyncr.pfsyncr_syncpeer.s_addr == 0) +#ifdef __FreeBSD__ + sc->sc_sync_peer.s_addr = htonl(INADDR_PFSYNC_GROUP); +#else sc->sc_sync_peer.s_addr = INADDR_PFSYNC_GROUP; +#endif else sc->sc_sync_peer.s_addr = pfsyncr.pfsyncr_syncpeer.s_addr; @@ -1118,7 +1123,11 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } if (sc->sc_sync_ifp && +#ifdef __FreeBSD__ + sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) { +#else sc->sc_sync_peer.s_addr == INADDR_PFSYNC_GROUP) { +#endif struct in_addr addr; if (!(sc->sc_sync_ifp->if_flags & IFF_MULTICAST)) { @@ -1152,7 +1161,11 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } if (sc->sc_sync_ifp || +#ifdef __FreeBSD__ + sc->sc_sendaddr.s_addr != htonl(INADDR_PFSYNC_GROUP)) { +#else sc->sc_sendaddr.s_addr != INADDR_PFSYNC_GROUP) { +#endif /* Request a full state table update. */ sc->sc_ureq_sent = time_uptime; #if NCARP > 0 @@ -1321,7 +1334,11 @@ pfsync_pack_state(u_int8_t action, struct pf_state *st, int flags) * hear, does it make a sound? */ if (ifp->if_bpf == NULL && sc->sc_sync_ifp == NULL && +#ifdef __FreeBSD__ + sc->sc_sync_peer.s_addr == htonl(INADDR_PFSYNC_GROUP)) { +#else sc->sc_sync_peer.s_addr == INADDR_PFSYNC_GROUP) { +#endif /* Don't leave any stale pfsync packets hanging around. */ if (sc->sc_mbuf != NULL) { m_freem(sc->sc_mbuf); @@ -1773,7 +1790,12 @@ pfsync_sendout(sc) sc->sc_statep_net.s = NULL; } - if (sc->sc_sync_ifp || sc->sc_sync_peer.s_addr != INADDR_PFSYNC_GROUP) { +#ifdef __FreeBSD__ + if (sc->sc_sync_ifp || + sc->sc_sync_peer.s_addr != htonl(INADDR_PFSYNC_GROUP)) { +#else + if (sc->sc_sync_ifp ||sc->sc_sync_peer.s_addr != INADDR_PFSYNC_GROUP) { +#endif struct ip *ip; struct sockaddr sa; @@ -1811,12 +1833,7 @@ pfsync_sendout(sc) #endif m->m_flags |= M_MCAST; ip->ip_dst = sc->sc_sendaddr; -#ifdef __FreeBSD__ - /* XXX_IMPORT */ - sc->sc_sendaddr.s_addr = htonl(sc->sc_sync_peer.s_addr); -#else sc->sc_sendaddr.s_addr = sc->sc_sync_peer.s_addr; -#endif pfsyncstats.pfsyncs_opackets++; #ifdef __FreeBSD__ |