mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
carp: Fix checking IPv4 multicast address
An IPv4 address stored in `struct in_addr` is in network byte order but `IN_MULTICAST` wants host order. PR: 284872 Reported by: Steven Perreau Reported by: Brett Merrick <brett.merrick@itcollective.nz> Reviewed by: Franco Fichtner <franco@opnsense.org>, ae, kp, glebius Tested by: Steven Perreau Fixes:137818006dcarp: support unicast MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D49053 (cherry picked from commit1776633438)
This commit is contained in:
parent
2640600509
commit
accbbd1a64
1 changed files with 2 additions and 2 deletions
|
|
@ -722,7 +722,7 @@ carp_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af, int ttl)
|
|||
sc = ifa->ifa_carp;
|
||||
CARP_LOCK(sc);
|
||||
if (ifa->ifa_addr->sa_family == AF_INET) {
|
||||
multicast = IN_MULTICAST(sc->sc_carpaddr.s_addr);
|
||||
multicast = IN_MULTICAST(ntohl(sc->sc_carpaddr.s_addr));
|
||||
} else {
|
||||
multicast = IN6_IS_ADDR_MULTICAST(&sc->sc_carpaddr6);
|
||||
}
|
||||
|
|
@ -988,7 +988,7 @@ carp_send_ad_locked(struct carp_softc *sc)
|
|||
m->m_pkthdr.rcvif = NULL;
|
||||
m->m_len = len;
|
||||
M_ALIGN(m, m->m_len);
|
||||
if (IN_MULTICAST(sc->sc_carpaddr.s_addr))
|
||||
if (IN_MULTICAST(ntohl(sc->sc_carpaddr.s_addr)))
|
||||
m->m_flags |= M_MCAST;
|
||||
ip = mtod(m, struct ip *);
|
||||
ip->ip_v = IPVERSION;
|
||||
|
|
|
|||
Loading…
Reference in a new issue