From: dhill Date: Thu, 6 Apr 2017 14:25:18 +0000 (+0000) Subject: Replace bcopy with a simple assignment where both variables are X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d9c935f848f6761d61b6e158f9e4fec2d22d3a98;p=openbsd Replace bcopy with a simple assignment where both variables are properly aligned and sockaddr_union fields, or with memcpy when the memory doesn't overlap. OK bluhm@ --- diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index 4c1708a1576..5d8b3a7b19e 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.91 2016/09/27 12:32:26 fcambus Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.92 2017/04/06 14:25:18 dhill Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -90,7 +90,7 @@ spd_table_add(unsigned int rtableid) return (NULL); if (spd_tables != NULL) { - bcopy(spd_tables, p, sizeof(*rnh) * (spd_table_max+1)); + memcpy(p, spd_tables, sizeof(*rnh) * (spd_table_max+1)); free(spd_tables, M_RTABLE, 0); } spd_tables = p; @@ -672,7 +672,7 @@ ipsp_acquire_sa(struct ipsec_policy *ipo, union sockaddr_union *gw, if (ipa == NULL) return ENOMEM; - bcopy(gw, &ipa->ipa_addr, sizeof(union sockaddr_union)); + ipa->ipa_addr = *gw; timeout_set(&ipa->ipa_timeout, ipsp_delete_acquire, ipa); diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index cdf2db18ba2..2104a3c62ac 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.145 2017/02/28 09:59:34 mpi Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.146 2017/04/06 14:25:18 dhill Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -518,8 +518,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff) } tdbi = (struct tdb_ident *)(mtag + 1); - bcopy(&tdbp->tdb_dst, &tdbi->dst, - sizeof(union sockaddr_union)); + tdbi->dst = tdbp->tdb_dst; tdbi->proto = tdbp->tdb_sproto; tdbi->spi = tdbp->tdb_spi; tdbi->rdomain = tdbp->tdb_rdomain; @@ -739,7 +738,7 @@ ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa, dst.sin_len = sizeof(struct sockaddr_in); dst.sin_addr.s_addr = ip->ip_dst.s_addr; - bcopy((caddr_t)ip + hlen, &spi, sizeof(u_int32_t)); + memcpy(&spi, (caddr_t)ip + hlen, sizeof(u_int32_t)); tdbp = gettdb(rdomain, spi, (union sockaddr_union *)&dst, proto); diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c index 84b7c53986c..686f55c5ae4 100644 --- a/sys/netinet/ipsec_output.c +++ b/sys/netinet/ipsec_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_output.c,v 1.65 2017/01/20 04:22:58 mpi Exp $ */ +/* $OpenBSD: ipsec_output.c,v 1.66 2017/04/06 14:25:18 dhill Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -466,7 +466,7 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb) } tdbi = (struct tdb_ident *)(mtag + 1); - bcopy(&tdb->tdb_dst, &tdbi->dst, sizeof(union sockaddr_union)); + tdbi->dst = tdb->tdb_dst; tdbi->proto = tdb->tdb_sproto; tdbi->spi = tdb->tdb_spi; tdbi->rdomain = tdb->tdb_rdomain;