From 34fbf967d4f5440620db8615f519d70a167ac764 Mon Sep 17 00:00:00 2001 From: henning Date: Mon, 5 Feb 2018 05:06:51 +0000 Subject: [PATCH] bcmp -> memcmp; kinda req'd / not-just-kinda ok'd by claudio --- sys/net/bridgectl.c | 24 ++++++++++++++---------- sys/net/if_bridge.c | 10 +++++----- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/net/bridgectl.c b/sys/net/bridgectl.c index 5e431fe5f03..f4b1bb130f0 100644 --- a/sys/net/bridgectl.c +++ b/sys/net/bridgectl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgectl.c,v 1.7 2018/02/05 03:51:53 henning Exp $ */ +/* $OpenBSD: bridgectl.c,v 1.8 2018/02/05 05:06:51 henning Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -406,7 +406,7 @@ bridge_rtdaddr(struct bridge_softc *sc, struct ether_addr *ea) h = bridge_hash(sc, ea); LIST_FOREACH(p, &sc->sc_rts[h], brt_next) { - if (bcmp(ea, &p->brt_addr, sizeof(p->brt_addr)) == 0) { + if (memcmp(ea, &p->brt_addr, sizeof(p->brt_addr)) == 0) { LIST_REMOVE(p, brt_next); sc->sc_brtcnt--; free(p, M_DEVBUF, sizeof *p); @@ -646,16 +646,16 @@ bridge_arpfilter(struct brl_node *n, struct ether_header *eh, struct mbuf *m) if (n->brl_arpf.brla_op && ntohs(ea.arp_op) != n->brl_arpf.brla_op) return (0); if (n->brl_arpf.brla_flags & BRLA_SHA && - bcmp(ea.arp_sha, &n->brl_arpf.brla_sha, ETHER_ADDR_LEN)) + memcmp(ea.arp_sha, &n->brl_arpf.brla_sha, ETHER_ADDR_LEN)) return (0); if (n->brl_arpf.brla_flags & BRLA_THA && - bcmp(ea.arp_tha, &n->brl_arpf.brla_tha, ETHER_ADDR_LEN)) + memcmp(ea.arp_tha, &n->brl_arpf.brla_tha, ETHER_ADDR_LEN)) return (0); if (n->brl_arpf.brla_flags & BRLA_SPA && - bcmp(ea.arp_spa, &n->brl_arpf.brla_spa, sizeof(struct in_addr))) + memcmp(ea.arp_spa, &n->brl_arpf.brla_spa, sizeof(struct in_addr))) return (0); if (n->brl_arpf.brla_flags & BRLA_TPA && - bcmp(ea.arp_tpa, &n->brl_arpf.brla_tpa, sizeof(struct in_addr))) + memcmp(ea.arp_tpa, &n->brl_arpf.brla_tpa, sizeof(struct in_addr))) return (0); return (1); @@ -674,19 +674,23 @@ bridge_filterrule(struct brl_head *h, struct ether_header *eh, struct mbuf *m) if (flags == 0) goto return_action; if (flags == (BRL_FLAG_SRCVALID|BRL_FLAG_DSTVALID)) { - if (bcmp(eh->ether_shost, &n->brl_src, ETHER_ADDR_LEN)) + if (memcmp(eh->ether_shost, &n->brl_src, + ETHER_ADDR_LEN)) continue; - if (bcmp(eh->ether_dhost, &n->brl_dst, ETHER_ADDR_LEN)) + if (memcmp(eh->ether_dhost, &n->brl_dst, + ETHER_ADDR_LEN)) continue; goto return_action; } if (flags == BRL_FLAG_SRCVALID) { - if (bcmp(eh->ether_shost, &n->brl_src, ETHER_ADDR_LEN)) + if (memcmp(eh->ether_shost, &n->brl_src, + ETHER_ADDR_LEN)) continue; goto return_action; } if (flags == BRL_FLAG_DSTVALID) { - if (bcmp(eh->ether_dhost, &n->brl_dst, ETHER_ADDR_LEN)) + if (memcmp(eh->ether_dhost, &n->brl_dst, + ETHER_ADDR_LEN)) continue; goto return_action; } diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index a54f5babd5d..bb63fa55a43 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.302 2018/02/05 03:51:53 henning Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.303 2018/02/05 05:06:51 henning Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1068,8 +1068,8 @@ bridge_process(struct ifnet *ifp, struct mbuf *m) * STP destination address (as stored in bstp_etheraddr) * is the first of these. */ - if (bcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN - 1) - == 0) { + if (memcmp(eh->ether_dhost, bstp_etheraddr, + ETHER_ADDR_LEN - 1) == 0) { if (eh->ether_dhost[ETHER_ADDR_LEN - 1] == 0) { /* STP traffic */ if ((m = bstp_input(sc->sc_stp, ifl->bif_stp, @@ -1113,7 +1113,7 @@ bridge_process(struct ifnet *ifp, struct mbuf *m) if (ifl->ifp->if_type != IFT_ETHER) continue; ac = (struct arpcom *)ifl->ifp; - if (bcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) == 0 + if (memcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) == 0 #if NCARP > 0 || (!SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) && !carp_ourether(ifl->ifp, eh->ether_dhost)) @@ -1136,7 +1136,7 @@ bridge_process(struct ifnet *ifp, struct mbuf *m) bridge_ifinput(ifl->ifp, m); return; } - if (bcmp(ac->ac_enaddr, eh->ether_shost, ETHER_ADDR_LEN) == 0 + if (memcmp(ac->ac_enaddr, eh->ether_shost, ETHER_ADDR_LEN) == 0 #if NCARP > 0 || (!SRPL_EMPTY_LOCKED(&ifl->ifp->if_carp) && !carp_ourether(ifl->ifp, eh->ether_shost)) -- 2.20.1