Re: netinet6 - bcopy -> memcpy

2018-03-14 Thread Florian Obser
OK florian@ for after unlock

On Tue, Mar 13, 2018 at 05:40:24PM -0400, David Hill wrote:
> Hello -
> 
> A few bcopy to memcpy conversions where the memory does not overlap.
> 
> OK?
> 
> Index: netinet6/icmp6.c
> ===
> RCS file: /cvs/src/sys/netinet6/icmp6.c,v
> retrieving revision 1.221
> diff -u -p -r1.221 icmp6.c
> --- netinet6/icmp6.c  14 Dec 2017 14:26:50 -  1.221
> +++ netinet6/icmp6.c  13 Mar 2018 21:32:32 -
> @@ -1075,7 +1075,7 @@ icmp6_reflect(struct mbuf *m, size_t off
>   if ((m = m_pullup(m, l)) == NULL)
>   return;
>   }
> - bcopy((caddr_t), mtod(m, caddr_t), sizeof(nip6));
> + memcpy(mtod(m, caddr_t), (caddr_t), sizeof(nip6));
>   } else /* off == sizeof(struct ip6_hdr) */ {
>   size_t l;
>   l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
> @@ -1268,7 +1268,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sin6));
>   sin6.sin6_family = AF_INET6;
>   sin6.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(reddst6));
> + memcpy(_addr, , sizeof(reddst6));
>   rt = rtalloc(sin6tosa(), 0, m->m_pkthdr.ph_rtableid);
>   if (rt) {
>   if (rt->rt_gateway == NULL ||
> @@ -1376,9 +1376,9 @@ icmp6_redirect_input(struct mbuf *m, int
>   sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = 
> AF_INET6;
>   sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len =
>   sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   rtredirect(sin6tosa(), sin6tosa(), sin6tosa(),
>   , m->m_pkthdr.ph_rtableid);
>  
> @@ -1395,7 +1395,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sdst));
>   sdst.sin6_family = AF_INET6;
>   sdst.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   pfctlinput(PRC_REDIRECT_HOST, sin6tosa());
>   }
>  
> Index: netinet6/in6_ifattach.c
> ===
> RCS file: /cvs/src/sys/netinet6/in6_ifattach.c,v
> retrieving revision 1.106
> diff -u -p -r1.106 in6_ifattach.c
> --- netinet6/in6_ifattach.c   13 Mar 2018 13:58:03 -  1.106
> +++ netinet6/in6_ifattach.c   13 Mar 2018 21:32:33 -
> @@ -165,7 +165,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc
>  
>   /* make EUI64 address */
>   if (addrlen == 8)
> - bcopy(addr, >s6_addr[8], 8);
> + memcpy(>s6_addr[8], addr, 8);
>   else if (addrlen == 6) {
>   in6->s6_addr[8] = addr[0];
>   in6->s6_addr[9] = addr[1];
> @@ -244,7 +244,7 @@ in6_get_soii_ifid(struct ifnet *ifp, str
>   SHA512Update(, ip6_soiikey, sizeof(ip6_soiikey));
>   SHA512Final(digest, );
>  
> - bcopy(digest + (sizeof(digest) - 8), >s6_addr[8], 8);
> + memcpy(>s6_addr[8], digest + (sizeof(digest) - 8), 8);
>  
>   return 0;
>  }
> @@ -464,7 +464,7 @@ in6_nigroup(struct ifnet *ifp, const cha
>   sa6->sin6_addr.s6_addr16[0] = htons(0xff02);
>   sa6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
>   sa6->sin6_addr.s6_addr8[11] = 2;
> - bcopy(digest, >sin6_addr.s6_addr32[3],
> + memcpy(>sin6_addr.s6_addr32[3], digest,
>   sizeof(sa6->sin6_addr.s6_addr32[3]));
>  
>   return 0;
> Index: netinet6/ip6_output.c
> ===
> RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
> retrieving revision 1.234
> diff -u -p -r1.234 ip6_output.c
> --- netinet6/ip6_output.c 19 Feb 2018 08:59:53 -  1.234
> +++ netinet6/ip6_output.c 13 Mar 2018 21:32:33 -
> @@ -850,7 +850,7 @@ ip6_copyexthdr(struct mbuf **mp, caddr_t
>   }
>   m->m_len = hlen;
>   if (hdr)
> - bcopy(hdr, mtod(m, caddr_t), hlen);
> + memcpy(mtod(m, caddr_t), hdr, hlen);
>  
>   *mp = m;
>   return (0);
> @@ -918,7 +918,7 @@ ip6_insert_jumboopt(struct ip6_exthdrs *
>   if (!n)
>   return (ENOBUFS);
>   n->m_len = oldoptlen + JUMBOOPTLEN;
> - bcopy(mtod(mopt, caddr_t), mtod(n, caddr_t),
> + memcpy(mtod(n, caddr_t), mtod(mopt, caddr_t),
> oldoptlen);
>   optbuf = mtod(n, u_int8_t *) + oldoptlen;
>   

netinet6 - bcopy -> memcpy

2018-03-13 Thread David Hill
Hello -

A few bcopy to memcpy conversions where the memory does not overlap.

OK?

Index: netinet6/icmp6.c
===
RCS file: /cvs/src/sys/netinet6/icmp6.c,v
retrieving revision 1.221
diff -u -p -r1.221 icmp6.c
--- netinet6/icmp6.c14 Dec 2017 14:26:50 -  1.221
+++ netinet6/icmp6.c13 Mar 2018 21:32:32 -
@@ -1075,7 +1075,7 @@ icmp6_reflect(struct mbuf *m, size_t off
if ((m = m_pullup(m, l)) == NULL)
return;
}
-   bcopy((caddr_t), mtod(m, caddr_t), sizeof(nip6));
+   memcpy(mtod(m, caddr_t), (caddr_t), sizeof(nip6));
} else /* off == sizeof(struct ip6_hdr) */ {
size_t l;
l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
@@ -1268,7 +1268,7 @@ icmp6_redirect_input(struct mbuf *m, int
bzero(, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(reddst6));
+   memcpy(_addr, , sizeof(reddst6));
rt = rtalloc(sin6tosa(), 0, m->m_pkthdr.ph_rtableid);
if (rt) {
if (rt->rt_gateway == NULL ||
@@ -1376,9 +1376,9 @@ icmp6_redirect_input(struct mbuf *m, int
sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = 
AF_INET6;
sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len =
sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(struct in6_addr));
-   bcopy(, _addr, sizeof(struct in6_addr));
-   bcopy(, _addr, sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
rtredirect(sin6tosa(), sin6tosa(), sin6tosa(),
, m->m_pkthdr.ph_rtableid);
 
@@ -1395,7 +1395,7 @@ icmp6_redirect_input(struct mbuf *m, int
bzero(, sizeof(sdst));
sdst.sin6_family = AF_INET6;
sdst.sin6_len = sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
pfctlinput(PRC_REDIRECT_HOST, sin6tosa());
}
 
Index: netinet6/in6_ifattach.c
===
RCS file: /cvs/src/sys/netinet6/in6_ifattach.c,v
retrieving revision 1.106
diff -u -p -r1.106 in6_ifattach.c
--- netinet6/in6_ifattach.c 13 Mar 2018 13:58:03 -  1.106
+++ netinet6/in6_ifattach.c 13 Mar 2018 21:32:33 -
@@ -165,7 +165,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struc
 
/* make EUI64 address */
if (addrlen == 8)
-   bcopy(addr, >s6_addr[8], 8);
+   memcpy(>s6_addr[8], addr, 8);
else if (addrlen == 6) {
in6->s6_addr[8] = addr[0];
in6->s6_addr[9] = addr[1];
@@ -244,7 +244,7 @@ in6_get_soii_ifid(struct ifnet *ifp, str
SHA512Update(, ip6_soiikey, sizeof(ip6_soiikey));
SHA512Final(digest, );
 
-   bcopy(digest + (sizeof(digest) - 8), >s6_addr[8], 8);
+   memcpy(>s6_addr[8], digest + (sizeof(digest) - 8), 8);
 
return 0;
 }
@@ -464,7 +464,7 @@ in6_nigroup(struct ifnet *ifp, const cha
sa6->sin6_addr.s6_addr16[0] = htons(0xff02);
sa6->sin6_addr.s6_addr16[1] = htons(ifp->if_index);
sa6->sin6_addr.s6_addr8[11] = 2;
-   bcopy(digest, >sin6_addr.s6_addr32[3],
+   memcpy(>sin6_addr.s6_addr32[3], digest,
sizeof(sa6->sin6_addr.s6_addr32[3]));
 
return 0;
Index: netinet6/ip6_output.c
===
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.234
diff -u -p -r1.234 ip6_output.c
--- netinet6/ip6_output.c   19 Feb 2018 08:59:53 -  1.234
+++ netinet6/ip6_output.c   13 Mar 2018 21:32:33 -
@@ -850,7 +850,7 @@ ip6_copyexthdr(struct mbuf **mp, caddr_t
}
m->m_len = hlen;
if (hdr)
-   bcopy(hdr, mtod(m, caddr_t), hlen);
+   memcpy(mtod(m, caddr_t), hdr, hlen);
 
*mp = m;
return (0);
@@ -918,7 +918,7 @@ ip6_insert_jumboopt(struct ip6_exthdrs *
if (!n)
return (ENOBUFS);
n->m_len = oldoptlen + JUMBOOPTLEN;
-   bcopy(mtod(mopt, caddr_t), mtod(n, caddr_t),
+   memcpy(mtod(n, caddr_t), mtod(mopt, caddr_t),
  oldoptlen);
optbuf = mtod(n, u_int8_t *) + oldoptlen;
m_freem(mopt);



Re: my final netinet6 bcopy->memcpy

2016-09-30 Thread David Hill
Ping.

On Mon, Sep 19, 2016 at 09:22:50PM -0400, David Hill wrote:
> Hello -
> 
> Here are the final bcopy->memcpy conversions in netinet6 that I am
> comfortable with.  There is also one (bcmp()) to (memcmp() != 0)
> conversion since the memory is not overlapping.
> 
> This, with the last netinet6 diff, has dropped the number of bcopy()
> calls from 62 to 29 in netinet6/
> 
> Index: icmp6.c
> ===
> RCS file: /cvs/src/sys/netinet6/icmp6.c,v
> retrieving revision 1.190
> diff -u -p -r1.190 icmp6.c
> --- icmp6.c   24 Aug 2016 09:38:29 -  1.190
> +++ icmp6.c   20 Sep 2016 01:00:36 -
> @@ -1401,7 +1401,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sin6));
>   sin6.sin6_family = AF_INET6;
>   sin6.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(reddst6));
> + memcpy(_addr, , sizeof(reddst6));
>   rt = rtalloc(sin6tosa(), 0, m->m_pkthdr.ph_rtableid);
>   if (rt) {
>   if (rt->rt_gateway == NULL ||
> @@ -1509,9 +1509,9 @@ icmp6_redirect_input(struct mbuf *m, int
>   sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = 
> AF_INET6;
>   sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len =
>   sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   rtredirect(sin6tosa(), sin6tosa(), sin6tosa(),
>   , m->m_pkthdr.ph_rtableid);
>  
> @@ -1528,7 +1528,7 @@ icmp6_redirect_input(struct mbuf *m, int
>   bzero(, sizeof(sdst));
>   sdst.sin6_family = AF_INET6;
>   sdst.sin6_len = sizeof(struct sockaddr_in6);
> - bcopy(, _addr, sizeof(struct in6_addr));
> + memcpy(_addr, , sizeof(struct in6_addr));
>   pfctlinput(PRC_REDIRECT_HOST, sin6tosa());
>   }
>  
> Index: in6.c
> ===
> RCS file: /cvs/src/sys/netinet6/in6.c,v
> retrieving revision 1.192
> diff -u -p -r1.192 in6.c
> --- in6.c 4 Sep 2016 10:32:01 -   1.192
> +++ in6.c 20 Sep 2016 01:00:36 -
> @@ -1029,9 +1029,9 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
>  
>   /* copy args to in6_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */
>   bzero(, sizeof(ifra));
> - bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name));
> + memcpy(ifra.ifra_name, iflr->iflr_name, sizeof(ifra.ifra_name));
>  
> - bcopy(>addr, _addr,
> + memcpy(_addr, >addr,
>   ((struct sockaddr *)>addr)->sa_len);
>   if (hostid) {
>   /* fill in hostid part */
> @@ -1042,7 +1042,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
>   }
>  
>   if (((struct sockaddr *)>dstaddr)->sa_family) {   /*XXX*/
> - bcopy(>dstaddr, _dstaddr,
> + memcpy(_dstaddr, >dstaddr,
>   ((struct sockaddr *)>dstaddr)->sa_len);
>   if (hostid) {
>   ifra.ifra_dstaddr.sin6_addr.s6_addr32[2] =
> @@ -1073,14 +1073,14 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
>   in6_prefixlen2mask(, iflr->prefixlen);
>  
>   sin6 = (struct sockaddr_in6 *)>addr;
> - bcopy(>sin6_addr, , sizeof(match));
> + memcpy(, >sin6_addr, sizeof(match));
>   match.s6_addr32[0] &= mask.s6_addr32[0];
>   match.s6_addr32[1] &= mask.s6_addr32[1];
>   match.s6_addr32[2] &= mask.s6_addr32[2];
>   match.s6_addr32[3] &= mask.s6_addr32[3];
>  
>   /* if you set extra bits, that's wrong */
> - if (bcmp(, >sin6_addr, sizeof(match)))
> + if (memcmp(, >sin6_addr, sizeof(match)) != 
> 0)
>   return EINVAL;
>  
>   cmp = 1;
> @@ -1092,7 +1092,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
>   /* on deleting an address, do exact match */
>   in6_prefixlen2mask(, 128);
>   sin6 = (struct sockaddr_in6 *)>addr;
> - bcopy(>sin6_addr, , sizeof(match));
> + memcpy(, >sin6_addr, sizeof(match));
>  
>   cmp = 1;
>   }
> @@ -1104,7 +1104,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
>   if (!cmp)
>   break;
>  
> - bcopy(IFA_IN6(ifa), 

my final netinet6 bcopy->memcpy

2016-09-19 Thread David Hill
Hello -

Here are the final bcopy->memcpy conversions in netinet6 that I am
comfortable with.  There is also one (bcmp()) to (memcmp() != 0)
conversion since the memory is not overlapping.

This, with the last netinet6 diff, has dropped the number of bcopy()
calls from 62 to 29 in netinet6/

Index: icmp6.c
===
RCS file: /cvs/src/sys/netinet6/icmp6.c,v
retrieving revision 1.190
diff -u -p -r1.190 icmp6.c
--- icmp6.c 24 Aug 2016 09:38:29 -  1.190
+++ icmp6.c 20 Sep 2016 01:00:36 -
@@ -1401,7 +1401,7 @@ icmp6_redirect_input(struct mbuf *m, int
bzero(, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(reddst6));
+   memcpy(_addr, , sizeof(reddst6));
rt = rtalloc(sin6tosa(), 0, m->m_pkthdr.ph_rtableid);
if (rt) {
if (rt->rt_gateway == NULL ||
@@ -1509,9 +1509,9 @@ icmp6_redirect_input(struct mbuf *m, int
sdst.sin6_family = sgw.sin6_family = ssrc.sin6_family = 
AF_INET6;
sdst.sin6_len = sgw.sin6_len = ssrc.sin6_len =
sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(struct in6_addr));
-   bcopy(, _addr, sizeof(struct in6_addr));
-   bcopy(, _addr, sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
rtredirect(sin6tosa(), sin6tosa(), sin6tosa(),
, m->m_pkthdr.ph_rtableid);
 
@@ -1528,7 +1528,7 @@ icmp6_redirect_input(struct mbuf *m, int
bzero(, sizeof(sdst));
sdst.sin6_family = AF_INET6;
sdst.sin6_len = sizeof(struct sockaddr_in6);
-   bcopy(, _addr, sizeof(struct in6_addr));
+   memcpy(_addr, , sizeof(struct in6_addr));
pfctlinput(PRC_REDIRECT_HOST, sin6tosa());
}
 
Index: in6.c
===
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.192
diff -u -p -r1.192 in6.c
--- in6.c   4 Sep 2016 10:32:01 -   1.192
+++ in6.c   20 Sep 2016 01:00:36 -
@@ -1029,9 +1029,9 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
 
/* copy args to in6_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */
bzero(, sizeof(ifra));
-   bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name));
+   memcpy(ifra.ifra_name, iflr->iflr_name, sizeof(ifra.ifra_name));
 
-   bcopy(>addr, _addr,
+   memcpy(_addr, >addr,
((struct sockaddr *)>addr)->sa_len);
if (hostid) {
/* fill in hostid part */
@@ -1042,7 +1042,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
}
 
if (((struct sockaddr *)>dstaddr)->sa_family) {   /*XXX*/
-   bcopy(>dstaddr, _dstaddr,
+   memcpy(_dstaddr, >dstaddr,
((struct sockaddr *)>dstaddr)->sa_len);
if (hostid) {
ifra.ifra_dstaddr.sin6_addr.s6_addr32[2] =
@@ -1073,14 +1073,14 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
in6_prefixlen2mask(, iflr->prefixlen);
 
sin6 = (struct sockaddr_in6 *)>addr;
-   bcopy(>sin6_addr, , sizeof(match));
+   memcpy(, >sin6_addr, sizeof(match));
match.s6_addr32[0] &= mask.s6_addr32[0];
match.s6_addr32[1] &= mask.s6_addr32[1];
match.s6_addr32[2] &= mask.s6_addr32[2];
match.s6_addr32[3] &= mask.s6_addr32[3];
 
/* if you set extra bits, that's wrong */
-   if (bcmp(, >sin6_addr, sizeof(match)))
+   if (memcmp(, >sin6_addr, sizeof(match)) != 
0)
return EINVAL;
 
cmp = 1;
@@ -1092,7 +1092,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
/* on deleting an address, do exact match */
in6_prefixlen2mask(, 128);
sin6 = (struct sockaddr_in6 *)>addr;
-   bcopy(>sin6_addr, , sizeof(match));
+   memcpy(, >sin6_addr, sizeof(match));
 
cmp = 1;
}
@@ -1104,7 +1104,7 @@ in6_lifaddr_ioctl(u_long cmd, caddr_t da
if (!cmp)
break;
 
-   bcopy(IFA_IN6(ifa), , sizeof(candidate));
+   memcpy(, IFA_IN6(ifa), sizeof(candidate));
candidate.s6_addr32[0] &= 

Re: netinet6 bcopy->memcpy

2016-09-13 Thread Jeremie Courreges-Anglas
David Hill  writes:

> Hello -
>
> Here is a diff to switch some bcopy's to memcpy's.
>
> Most bcopy's are on freshly alloc'd memory.

Looks fine to me, ok jca@

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



netinet6 - bcopy -> memcpy

2015-12-02 Thread David Hill
Hello -

Here are a few bcopy -> memcpy conversions for buffers that do not
overlap.

Index: sys/netinet6/ip6_forward.c
===
RCS file: /cvs/src/sys/netinet6/ip6_forward.c,v
retrieving revision 1.86
diff -u -p -r1.86 ip6_forward.c
--- sys/netinet6/ip6_forward.c  2 Nov 2015 07:22:28 -   1.86
+++ sys/netinet6/ip6_forward.c  2 Dec 2015 17:20:27 -
@@ -206,7 +206,7 @@ reroute:
}
 
/* We need to do IPsec */
-   bcopy(>tdb_dst, , sizeof(sdst));
+   memcpy(, >tdb_dst, sizeof(sdst));
sspi = tdb->tdb_spi;
sproto = tdb->tdb_sproto;
}
Index: sys/netinet6/ip6_input.c
===
RCS file: /cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.151
diff -u -p -r1.151 ip6_input.c
--- sys/netinet6/ip6_input.c11 Nov 2015 10:23:23 -  1.151
+++ sys/netinet6/ip6_input.c2 Dec 2015 17:20:28 -
@@ -804,7 +804,7 @@ ip6_process_hopopts(struct mbuf *m, u_in
return (-1);
}
optlen = IP6OPT_RTALERT_LEN;
-   bcopy((caddr_t)(opt + 2), (caddr_t)_val, 2);
+   memcpy(_val, opt + 2, sizeof(rtalert_val));
*rtalertp = ntohs(rtalert_val);
break;
case IP6OPT_JUMBO:
@@ -837,9 +837,9 @@ ip6_process_hopopts(struct mbuf *m, u_in
 
/*
 * We may see jumbolen in unaligned location, so
-* we'd need to perform bcopy().
+* we'd need to perform memcpy().
 */
-   bcopy(opt + 2, , sizeof(jumboplen));
+   memcpy(, opt + 2, sizeof(jumboplen));
jumboplen = (u_int32_t)htonl(jumboplen);
 
 #if 1
@@ -962,7 +962,7 @@ ip6_savecontrol(struct inpcb *in6p, stru
/* RFC 2292 sec. 5 */
if ((in6p->inp_flags & IN6P_PKTINFO) != 0) {
struct in6_pktinfo pi6;
-   bcopy(>ip6_dst, _addr, sizeof(struct in6_addr));
+   memcpy(_addr, >ip6_dst, sizeof(struct in6_addr));
if (IN6_IS_SCOPE_EMBED(_addr))
pi6.ipi6_addr.s6_addr16[1] = 0;
pi6.ipi6_ifindex = m ? m->m_pkthdr.ph_ifidx : 0;
Index: sys/netinet6/ip6_output.c
===
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.201
diff -u -p -r1.201 ip6_output.c
--- sys/netinet6/ip6_output.c   2 Dec 2015 13:29:26 -   1.201
+++ sys/netinet6/ip6_output.c   2 Dec 2015 17:20:28 -
@@ -2015,7 +2015,7 @@ do {\
dst->type = malloc(hlen, M_IP6OPT, canwait);\
if (dst->type == NULL && canwait == M_NOWAIT)\
goto bad;\
-   bcopy(src->type, dst->type, hlen);\
+   memcpy(dst->type, src->type, hlen);\
}\
 } while (/*CONSTCOND*/ 0)
 
Index: sys/netinet6/raw_ip6.c
===
RCS file: /cvs/src/sys/netinet6/raw_ip6.c,v
retrieving revision 1.87
diff -u -p -r1.87 raw_ip6.c
--- sys/netinet6/raw_ip6.c  24 Nov 2015 13:37:16 -  1.87
+++ sys/netinet6/raw_ip6.c  2 Dec 2015 17:20:28 -
@@ -756,7 +756,7 @@ rip6_usrreq(struct socket *so, int req, 
bzero(, sizeof(tmp));
tmp.sin6_family = AF_INET6;
tmp.sin6_len = sizeof(struct sockaddr_in6);
-   bcopy(>inp_faddr6, _addr,
+   memcpy(_addr, >inp_faddr6,
sizeof(struct in6_addr));
dst = 
} else {