| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_pfsync.c,v 1.21 2021/03/10 15:21:11 christos Exp $ */ | | 1 | /* $NetBSD: if_pfsync.c,v 1.22 2021/03/10 22:18:17 christos Exp $ */ |
2 | /* $OpenBSD: if_pfsync.c,v 1.83 2007/06/26 14:44:12 mcbride Exp $ */ | | 2 | /* $OpenBSD: if_pfsync.c,v 1.83 2007/06/26 14:44:12 mcbride Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2002 Michael Shalayeff | | 5 | * Copyright (c) 2002 Michael Shalayeff |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, | | 20 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, |
21 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 21 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
23 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 23 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
27 | * THE POSSIBILITY OF SUCH DAMAGE. | | 27 | * THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | | 28 | */ |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | __KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.21 2021/03/10 15:21:11 christos Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: if_pfsync.c,v 1.22 2021/03/10 22:18:17 christos Exp $"); |
32 | | | 32 | |
33 | #ifdef _KERNEL_OPT | | 33 | #ifdef _KERNEL_OPT |
34 | #include "opt_inet.h" | | 34 | #include "opt_inet.h" |
35 | #include "opt_inet6.h" | | 35 | #include "opt_inet6.h" |
36 | #endif | | 36 | #endif |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/proc.h> | | 39 | #include <sys/proc.h> |
40 | #include <sys/systm.h> | | 40 | #include <sys/systm.h> |
41 | #include <sys/time.h> | | 41 | #include <sys/time.h> |
42 | #include <sys/mbuf.h> | | 42 | #include <sys/mbuf.h> |
43 | #include <sys/socket.h> | | 43 | #include <sys/socket.h> |
44 | #include <sys/ioctl.h> | | 44 | #include <sys/ioctl.h> |
| @@ -1577,27 +1577,27 @@ pfsync_sendout_mbuf(struct pfsync_softc | | | @@ -1577,27 +1577,27 @@ pfsync_sendout_mbuf(struct pfsync_softc |
1577 | | | 1577 | |
1578 | if (sc->sc_sync_ifp || | | 1578 | if (sc->sc_sync_ifp || |
1579 | sc->sc_sync_peer.s_addr != INADDR_PFSYNC_GROUP) { | | 1579 | sc->sc_sync_peer.s_addr != INADDR_PFSYNC_GROUP) { |
1580 | M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); | | 1580 | M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); |
1581 | if (m == NULL) { | | 1581 | if (m == NULL) { |
1582 | PFSYNC_STATINC(PFSYNC_STAT_ONOMEM); | | 1582 | PFSYNC_STATINC(PFSYNC_STAT_ONOMEM); |
1583 | return (0); | | 1583 | return (0); |
1584 | } | | 1584 | } |
1585 | ip = mtod(m, struct ip *); | | 1585 | ip = mtod(m, struct ip *); |
1586 | ip->ip_v = IPVERSION; | | 1586 | ip->ip_v = IPVERSION; |
1587 | ip->ip_hl = sizeof(*ip) >> 2; | | 1587 | ip->ip_hl = sizeof(*ip) >> 2; |
1588 | ip->ip_tos = IPTOS_LOWDELAY; | | 1588 | ip->ip_tos = IPTOS_LOWDELAY; |
1589 | ip->ip_len = htons(m->m_pkthdr.len); | | 1589 | ip->ip_len = htons(m->m_pkthdr.len); |
1590 | ip->ip_id = htons(ip_randomid()); | | 1590 | ip->ip_id = ip_randomid(); |
1591 | ip->ip_off = htons(IP_DF); | | 1591 | ip->ip_off = htons(IP_DF); |
1592 | ip->ip_ttl = PFSYNC_DFLTTL; | | 1592 | ip->ip_ttl = PFSYNC_DFLTTL; |
1593 | ip->ip_p = IPPROTO_PFSYNC; | | 1593 | ip->ip_p = IPPROTO_PFSYNC; |
1594 | ip->ip_sum = 0; | | 1594 | ip->ip_sum = 0; |
1595 | | | 1595 | |
1596 | memset(&sa, 0, sizeof(sa)); | | 1596 | memset(&sa, 0, sizeof(sa)); |
1597 | ip->ip_src.s_addr = INADDR_ANY; | | 1597 | ip->ip_src.s_addr = INADDR_ANY; |
1598 | | | 1598 | |
1599 | if (sc->sc_sendaddr.s_addr == INADDR_PFSYNC_GROUP) | | 1599 | if (sc->sc_sendaddr.s_addr == INADDR_PFSYNC_GROUP) |
1600 | m->m_flags |= M_MCAST; | | 1600 | m->m_flags |= M_MCAST; |
1601 | ip->ip_dst = sc->sc_sendaddr; | | 1601 | ip->ip_dst = sc->sc_sendaddr; |
1602 | sc->sc_sendaddr.s_addr = sc->sc_sync_peer.s_addr; | | 1602 | sc->sc_sendaddr.s_addr = sc->sc_sync_peer.s_addr; |
1603 | | | 1603 | |