Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178104219
D58177.1795973378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
D58177.1795973378.diff
View Options
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -2206,7 +2206,7 @@
is_router = is_onlink = 0;
if (IN6_IS_ADDR_LINKLOCAL(&redtgt6))
is_router = 1; /* router case */
- if (bcmp(&redtgt6, &reddst6, sizeof(redtgt6)) == 0)
+ if (memcmp(&redtgt6, &reddst6, sizeof(redtgt6)) == 0)
is_onlink = 1; /* on-link destination case */
if (!is_router && !is_onlink) {
nd6log((LOG_ERR,
@@ -2259,18 +2259,18 @@
struct sockaddr *gw;
int rt_flags;
- bzero(&sdst, sizeof(sdst));
- bzero(&ssrc, sizeof(ssrc));
+ memset(&sdst, 0, sizeof(sdst));
+ memset(&ssrc, 0, sizeof(ssrc));
sdst.sin6_family = ssrc.sin6_family = AF_INET6;
sdst.sin6_len = ssrc.sin6_len = sizeof(struct sockaddr_in6);
- bcopy(&reddst6, &sdst.sin6_addr, sizeof(struct in6_addr));
- bcopy(&src6, &ssrc.sin6_addr, sizeof(struct in6_addr));
+ memcpy(&sdst.sin6_addr, &reddst6, sizeof(struct in6_addr));
+ memcpy(&ssrc.sin6_addr, &src6, sizeof(struct in6_addr));
rt_flags = 0;
if (is_router) {
- bzero(&sgw, sizeof(sgw));
+ memset(&sgw, 0, sizeof(sgw));
sgw.sin6_family = AF_INET6;
sgw.sin6_len = sizeof(struct sockaddr_in6);
- bcopy(&redtgt6, &sgw.sin6_addr,
+ memcpy(&sgw.sin6_addr, &redtgt6,
sizeof(struct in6_addr));
gw = (struct sockaddr *)&sgw;
rt_flags |= RTF_GATEWAY;
@@ -2324,7 +2324,7 @@
* [RFC 2461, sec 8.2]
*/
sip6 = mtod(m0, struct ip6_hdr *);
- bzero(&src_sa, sizeof(src_sa));
+ memset(&src_sa, 0, sizeof(src_sa));
src_sa.sin6_family = AF_INET6;
src_sa.sin6_len = sizeof(src_sa);
src_sa.sin6_addr = sip6->ip6_src;
@@ -2364,7 +2364,7 @@
IN6_IFF_NOTREADY|
IN6_IFF_ANYCAST)) == NULL)
goto fail;
- bcopy(&ia->ia_addr.sin6_addr, &ifp_ll6, sizeof(ifp_ll6));
+ memcpy(&ifp_ll6, &ia->ia_addr.sin6_addr, sizeof(ifp_ll6));
ifa_free(&ia->ia_ifa);
}
@@ -2387,8 +2387,8 @@
ip6->ip6_nxt = IPPROTO_ICMPV6;
ip6->ip6_hlim = 255;
/* ip6->ip6_src must be linklocal addr for my outgoing if. */
- bcopy(&ifp_ll6, &ip6->ip6_src, sizeof(struct in6_addr));
- bcopy(&sip6->ip6_src, &ip6->ip6_dst, sizeof(struct in6_addr));
+ memcpy(&ip6->ip6_src, &ifp_ll6, sizeof(struct in6_addr));
+ memcpy(&ip6->ip6_dst, &sip6->ip6_src, sizeof(struct in6_addr));
/* ND Redirect */
nd_rd = (struct nd_redirect *)(ip6 + 1);
@@ -2402,15 +2402,15 @@
*/
if (!router_ll6)
goto fail;
- bcopy(router_ll6, &nd_rd->nd_rd_target,
+ memcpy(&nd_rd->nd_rd_target, router_ll6,
sizeof(nd_rd->nd_rd_target));
- bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_dst,
+ memcpy(&nd_rd->nd_rd_dst, &sip6->ip6_dst,
sizeof(nd_rd->nd_rd_dst));
} else {
/* make sure redtgt == reddst */
- bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_target,
+ memcpy(&nd_rd->nd_rd_target, &sip6->ip6_dst,
sizeof(nd_rd->nd_rd_target));
- bcopy(&sip6->ip6_dst, &nd_rd->nd_rd_dst,
+ memcpy(&nd_rd->nd_rd_dst, &sip6->ip6_dst,
sizeof(nd_rd->nd_rd_dst));
}
@@ -2443,7 +2443,7 @@
nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR;
nd_opt->nd_opt_len = len >> 3;
lladdr = (char *)(nd_opt + 1) + pad;
- bcopy(ln->ll_addr, lladdr, ifp->if_addrlen);
+ memcpy(lladdr, ln->ll_addr, ifp->if_addrlen);
p += len;
}
}
@@ -2510,7 +2510,8 @@
/* pad if easy enough, truncate if not */
if (8 - extra <= M_TRAILINGSPACE(m0)) {
/* pad */
- bzero(m0->m_data + m0->m_len, 8 - extra);
+ memset(m0->m_data + m0->m_len, 0,
+ 8 - extra);
m0->m_len += (8 - extra);
m0->m_pkthdr.len += (8 - extra);
} else {
@@ -2525,7 +2526,7 @@
}
nd_opt_rh = (struct nd_opt_rd_hdr *)p;
- bzero(nd_opt_rh, sizeof(*nd_opt_rh));
+ memset(nd_opt_rh, 0, sizeof(*nd_opt_rh));
nd_opt_rh->nd_opt_rh_type = ND_OPT_REDIRECTED_HEADER;
nd_opt_rh->nd_opt_rh_len = len >> 3;
p += sizeof(*nd_opt_rh);
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -211,7 +211,7 @@
* to be a neighbor otherwise. This point is expected to be
* clarified in future revisions of the specification.
*/
- bzero(&src_sa6, sizeof(src_sa6));
+ memset(&src_sa6, 0, sizeof(src_sa6));
src_sa6.sin6_family = AF_INET6;
src_sa6.sin6_len = sizeof(src_sa6);
src_sa6.sin6_addr = saddr6;
@@ -405,7 +405,7 @@
if ((ln->la_flags & (LLE_PUB | LLE_VALID)) == (LLE_PUB | LLE_VALID)) {
link_init_sdl(ifp, (struct sockaddr *)sdl, ifp->if_type);
sdl->sdl_alen = ifp->if_addrlen;
- bcopy(ln->ll_addr, &sdl->sdl_data, ifp->if_addrlen);
+ memcpy(&sdl->sdl_data, ln->ll_addr, ifp->if_addrlen);
LLE_RUNLOCK(ln);
ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp,
IN6_IFF_NOTREADY|IN6_IFF_ANYCAST);
@@ -556,7 +556,7 @@
* above), but we do so here explicitly to make the intention
* clearer.
*/
- bzero(&ip6->ip6_src, sizeof(ip6->ip6_src));
+ memset(&ip6->ip6_src, 0, sizeof(ip6->ip6_src));
}
nd_ns = (struct nd_neighbor_solicit *)(ip6 + 1);
nd_ns->nd_ns_type = ND_NEIGHBOR_SOLICIT;
@@ -598,7 +598,7 @@
m->m_pkthdr.len += optlen;
m->m_len += optlen;
icmp6len += optlen;
- bzero(nd_opt, optlen);
+ memset(nd_opt, 0, optlen);
nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR;
nd_opt->nd_opt_len = optlen >> 3;
memcpy((char *)(nd_opt + 1) + pad, mac,
@@ -855,7 +855,8 @@
llchange = 0;
else {
if (ln->la_flags & LLE_VALID) {
- if (bcmp(lladdr, ln->ll_addr, ifp->if_addrlen))
+ if (memcmp(lladdr, ln->ll_addr,
+ ifp->if_addrlen))
llchange = 1;
else
llchange = 0;
@@ -1098,7 +1099,7 @@
m->m_pkthdr.len += optlen;
m->m_len += optlen;
icmp6len += optlen;
- bzero(nd_opt, optlen);
+ memset(nd_opt, 0, optlen);
nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR;
nd_opt->nd_opt_len = optlen >> 3;
memcpy((char *)(nd_opt + 1) + pad, mac, ifp->if_addrlen);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -298,7 +298,7 @@
return;
}
- bzero(&pr, sizeof(pr));
+ memset(&pr, 0, sizeof(pr));
pr.ndpr_prefix.sin6_family = AF_INET6;
pr.ndpr_prefix.sin6_len = sizeof(pr.ndpr_prefix);
pr.ndpr_prefix.sin6_addr = pi->nd_opt_pi_prefix;
@@ -569,7 +569,7 @@
if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst))
mcast = true;
- bzero(&dr0, sizeof(dr0));
+ memset(&dr0, 0, sizeof(dr0));
dr0.rtaddr = saddr6;
dr0.raflags = nd_ra->nd_ra_flags_reserved;
/*
@@ -2793,7 +2793,7 @@
if (error != 0)
return (error);
- bzero(&d, sizeof(d));
+ memset(&d, 0, sizeof(d));
d.rtaddr.sin6_family = AF_INET6;
d.rtaddr.sin6_len = sizeof(d.rtaddr);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 29, 5:29 PM (6 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42076765
Default Alt Text
D58177.1795973378.diff (6 KB)
Attached To
Mode
D58177: netinet6: use memcpy/memset/memcmp for consistency
Attached
Detach File
Event Timeline