net*: remove remnants of caddr_t

caddr_t is a typedef for a character pointer (char *) that originated in
Version 7 Unix, released by AT&T in 1979.  It became obsolete in 1989,
when ANSI C introduced void *.

What's left:

* ioctl(9) KPI still uses caddr_t, thus network related ioctl method
  still use it.
* if_clone KPI, to be done separately.
* bpf(4), to be done separately.
* SCTP, let maintainers decide.
* iflib(4), let maintainers decide.

Reviewed by:		zlei
Differential Revision:	https://reviews.freebsd.org/D60738
This commit is contained in:
Gleb Smirnoff committed 2026-10-16 14:16:59 -07:00
1 parent 690c3fbbe1
commit d7cf2e714e
52 files changed
+202 -204

No files matched your search

+6 -6
View File
@@ -259,7 +259,7 @@ bstp_transmit_tcn(struct bstp_state *bs, struct bstp_port *bp)
bpdu.tbu_protover = 0;
bpdu.tbu_bpdutype = BSTP_MSGTYPE_TCN;
memcpy(mtod(m, caddr_t) + sizeof(*eh), &bpdu, sizeof(bpdu));
memcpy(mtod(m, char *) + sizeof(*eh), &bpdu, sizeof(bpdu));
bp->bp_txcount++;
ifp->if_transmit(ifp, m);
@@ -372,7 +372,7 @@ bstp_send_bpdu(struct bstp_state *bs, struct bstp_port *bp,
bpdu->cbu_protover = BSTP_PROTO_STP;
m->m_pkthdr.len = sizeof(*eh) + BSTP_BPDU_STP_LEN;
eh->ether_type = htons(BSTP_BPDU_STP_LEN);
memcpy(mtod(m, caddr_t) + sizeof(*eh), bpdu,
memcpy(mtod(m, char *) + sizeof(*eh), bpdu,
BSTP_BPDU_STP_LEN);
break;
@@ -381,7 +381,7 @@ bstp_send_bpdu(struct bstp_state *bs, struct bstp_port *bp,
bpdu->cbu_versionlen = htons(0);
m->m_pkthdr.len = sizeof(*eh) + BSTP_BPDU_RSTP_LEN;
eh->ether_type = htons(BSTP_BPDU_RSTP_LEN);
memcpy(mtod(m, caddr_t) + sizeof(*eh), bpdu,
memcpy(mtod(m, char *) + sizeof(*eh), bpdu,
BSTP_BPDU_RSTP_LEN);
break;
@@ -481,7 +481,7 @@ bstp_input(struct bstp_port *bp, struct ifnet *ifp, struct mbuf *m)
(m = m_pullup(m, sizeof(tpdu))) == NULL)
goto out;
memcpy(&tpdu, mtod(m, caddr_t), sizeof(tpdu));
memcpy(&tpdu, mtod(m, char *), sizeof(tpdu));
/* basic packet checks */
if (tpdu.tbu_dsap != LLC_8021D_LSAP ||
@@ -546,7 +546,7 @@ bstp_received_stp(struct bstp_state *bs, struct bstp_port *bp,
if ((*mp)->m_len < BSTP_BPDU_STP_LEN &&
(*mp = m_pullup(*mp, BSTP_BPDU_STP_LEN)) == NULL)
return;
memcpy(&cpdu, mtod(*mp, caddr_t), BSTP_BPDU_STP_LEN);
memcpy(&cpdu, mtod(*mp, char *), BSTP_BPDU_STP_LEN);
bstp_decode_bpdu(bp, &cpdu, cu);
bstp_received_bpdu(bs, bp, cu);
@@ -567,7 +567,7 @@ bstp_received_rstp(struct bstp_state *bs, struct bstp_port *bp,
if ((*mp)->m_len < BSTP_BPDU_RSTP_LEN &&
(*mp = m_pullup(*mp, BSTP_BPDU_RSTP_LEN)) == NULL)
return;
memcpy(&cpdu, mtod(*mp, caddr_t), BSTP_BPDU_RSTP_LEN);
memcpy(&cpdu, mtod(*mp, char *), BSTP_BPDU_RSTP_LEN);
bstp_decode_bpdu(bp, &cpdu, cu);
bstp_received_bpdu(bs, bp, cu);
+4 -4
View File
@@ -257,7 +257,7 @@ int (*carp_iamatch_p)(struct ifaddr *, uint8_t **);
#endif
#ifdef INET6
struct ifaddr *(*carp_iamatch6_p)(struct ifnet *ifp, struct in6_addr *taddr6);
caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m,
char * (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m,
const struct in6_addr *taddr);
#endif
@@ -886,7 +886,7 @@ if_attach_internal(struct ifnet *ifp, bool vmove)
ifp->if_addr = ifa;
ifa->ifa_ifp = ifp;
ifa->ifa_addr = (struct sockaddr *)sdl;
sdl = (struct sockaddr_dl *)(socksize + (caddr_t)sdl);
sdl = (struct sockaddr_dl *)((char *)sdl + socksize);
ifa->ifa_netmask = (struct sockaddr *)sdl;
sdl->sdl_len = masklen;
while (namelen != 0)
@@ -1932,8 +1932,8 @@ next: continue;
*/
if (ifa_maybe == NULL ||
ifa_preferred(ifa_maybe, ifa) ||
rn_refines((caddr_t)ifa->ifa_netmask,
(caddr_t)ifa_maybe->ifa_netmask)) {
rn_refines(ifa->ifa_netmask,
ifa_maybe->ifa_netmask)) {
ifa_maybe = ifa;
}
}
+4 -4
View File
@@ -71,10 +71,10 @@ struct arphdr {
#endif
};
#define ar_sha(ap) (((caddr_t)((ap)+1)) + 0)
#define ar_spa(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln)
#define ar_tha(ap) (((caddr_t)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln)
#define ar_tpa(ap) (((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
#define ar_sha(ap) (((char *)((ap)+1)) + 0)
#define ar_spa(ap) (((char *)((ap)+1)) + (ap)->ar_hln)
#define ar_tha(ap) (((char *)((ap)+1)) + (ap)->ar_hln + (ap)->ar_pln)
#define ar_tpa(ap) (((char *)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
#define arphdr_len2(ar_hln, ar_pln) \
(sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))
+8 -8
View File
@@ -4045,12 +4045,12 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
}
/* Strip off the Ethernet header and keep a copy. */
m_copydata(*mp, 0, ETHER_HDR_LEN, (caddr_t) &eh2);
m_copydata(*mp, 0, ETHER_HDR_LEN, &eh2);
m_adj(*mp, ETHER_HDR_LEN);
/* Strip off snap header, if present */
if (snap) {
m_copydata(*mp, 0, sizeof(struct llc), (caddr_t) &llc1);
m_copydata(*mp, 0, sizeof(struct llc), &llc1);
m_adj(*mp, sizeof(struct llc));
}
@@ -4186,13 +4186,13 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
M_PREPEND(*mp, sizeof(struct llc), M_NOWAIT);
if (*mp == NULL)
return (error);
bcopy(&llc1, mtod(*mp, caddr_t), sizeof(struct llc));
bcopy(&llc1, mtod(*mp, void *), sizeof(struct llc));
}
M_PREPEND(*mp, ETHER_HDR_LEN, M_NOWAIT);
if (*mp == NULL)
return (error);
bcopy(&eh2, mtod(*mp, caddr_t), ETHER_HDR_LEN);
bcopy(&eh2, mtod(*mp, void *), ETHER_HDR_LEN);
return (0);
@@ -4226,7 +4226,7 @@ bridge_ip_checkbasic(struct mbuf **mp)
if (*mp == NULL)
return (-1);
if (IP_HDR_ALIGNED_P(mtod(m, caddr_t)) == 0) {
if (IP_HDR_ALIGNED_P(mtod(m, char *)) == 0) {
if ((m = m_copyup(m, sizeof(struct ip),
(max_linkhdr + 3) & ~3)) == NULL) {
/* XXXJRT new stat, please */
@@ -4323,7 +4323,7 @@ bridge_ip6_checkbasic(struct mbuf **mp)
* it. Otherwise, if it is aligned, make sure the entire base
* IPv6 header is in the first mbuf of the chain.
*/
if (IP6_HDR_ALIGNED_P(mtod(m, caddr_t)) == 0) {
if (IP6_HDR_ALIGNED_P(mtod(m, char *)) == 0) {
struct ifnet *inifp = m->m_pkthdr.rcvif;
if ((m = m_copyup(m, sizeof(struct ip6_hdr),
(max_linkhdr + 3) & ~3)) == NULL) {
@@ -4401,7 +4401,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh,
mprev->m_nextpkt = nextpkt;
goto dropit;
}
bcopy(llc, mtod(mcur, caddr_t),sizeof(struct llc));
bcopy(llc, mtod(mcur, void *), sizeof(struct llc));
}
M_PREPEND(mcur, ETHER_HDR_LEN, M_NOWAIT);
@@ -4412,7 +4412,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh,
mprev->m_nextpkt = nextpkt;
goto dropit;
}
bcopy(eh, mtod(mcur, caddr_t), ETHER_HDR_LEN);
bcopy(eh, mtod(mcur, void *), ETHER_HDR_LEN);
/*
* The previous two M_PREPEND could have inserted one or two
+3 -3
View File
@@ -194,7 +194,7 @@ struct ifbreq {
struct ifbifconf {
uint32_t ifbic_len; /* buffer size */
union {
caddr_t ifbicu_buf;
char *ifbicu_buf;
struct ifbreq *ifbicu_req;
} ifbic_ifbicu;
#define ifbic_buf ifbic_ifbicu.ifbicu_buf
@@ -225,7 +225,7 @@ struct ifbareq {
struct ifbaconf {
uint32_t ifbac_len; /* buffer size */
union {
caddr_t ifbacu_buf;
char *ifbacu_buf;
struct ifbareq *ifbacu_req;
} ifbac_ifbacu;
#define ifbac_buf ifbac_ifbacu.ifbacu_buf
@@ -292,7 +292,7 @@ struct ifbpstpreq {
struct ifbpstpconf {
uint32_t ifbpstp_len; /* buffer size */
union {
caddr_t ifbpstpu_buf;
char *ifbpstpu_buf;
struct ifbpstpreq *ifbpstpu_req;
} ifbpstp_ifbpstpu;
#define ifbpstp_buf ifbpstp_ifbpstpu.ifbpstpu_buf
+1 -1
View File
@@ -1237,7 +1237,7 @@ ether_vlan_mtap(struct bpf_if *bp, struct mbuf *m, void *data, u_int dlen)
*/
if (data != NULL) {
mv.m_next = m;
mv.m_data = (caddr_t)&vlan;
mv.m_data = (char *)&vlan;
mv.m_len = sizeof(vlan);
mb.m_next = &mv;
mb.m_data = data;
+3 -3
View File
@@ -2489,7 +2489,7 @@ geneve_inherit_l3_hdr(struct mbuf *m, struct geneve_softc *sc, uint16_t proto,
switch (proto) {
case ETHERTYPE_IP:
if (__predict_false(m->m_len < offset + sizeof(struct ip))) {
m_copydata(m, offset, sizeof(struct ip), (caddr_t)&iphdr);
m_copydata(m, offset, sizeof(struct ip), &iphdr);
ip_inner = &iphdr;
} else
ip_inner = mtodo(m, offset);
@@ -2503,7 +2503,7 @@ geneve_inherit_l3_hdr(struct mbuf *m, struct geneve_softc *sc, uint16_t proto,
case ETHERTYPE_IPV6:
if (__predict_false(m->m_len < offset + sizeof(struct ip6_hdr))) {
m_copydata(m, offset, sizeof(struct ip6_hdr), (caddr_t)&ip6hdr);
m_copydata(m, offset, sizeof(struct ip6_hdr), &ip6hdr);
ip6_inner = &ip6hdr;
} else
ip6_inner = mtodo(m, offset);
@@ -2996,7 +2996,7 @@ geneve_udp_input(struct mbuf *m, int offset, struct inpcb *inpcb,
/* Get geneve header */
offset += sizeof(struct udphdr);
if (__predict_false(m->m_len < offset + sizeof(struct genevehdr))) {
m_copydata(m, offset, sizeof(struct genevehdr), (caddr_t)&gnvhdr);
m_copydata(m, offset, sizeof(struct genevehdr), &gnvhdr);
gnvh = &gnvhdr;
} else
gnvh = mtodo(m, offset);
+2 -2
View File
@@ -2466,7 +2466,7 @@ ovpn_peer_from_mbuf(struct ovpn_softc *sc, struct mbuf *m, int off)
if (m_length(m, NULL) < (off + sizeof(struct udphdr) + hdrlen))
return (NULL);
m_copydata(m, off + sizeof(struct udphdr), hdrlen, (caddr_t)&ohdr);
m_copydata(m, off + sizeof(struct udphdr), hdrlen, &ohdr);
peerid = ntohl(ohdr.opcode) & 0x00ffffff;
@@ -2512,7 +2512,7 @@ ovpn_udp_input(struct mbuf *m, int off, struct inpcb *inp,
return (false);
}
m_copydata(m, off + sizeof(*uhdr), ohdrlen, (caddr_t)&tmphdr);
m_copydata(m, off + sizeof(*uhdr), ohdrlen, &tmphdr);
op = ntohl(tmphdr.opcode) >> 24 >> OVPN_OP_SHIFT;
if (op != OVPN_OP_DATA_V2) {
+2 -2
View File
@@ -390,7 +390,7 @@ stf_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
if (proto != IPPROTO_IPV6)
return (0);
m_copydata(m, 0, sizeof(ip), (caddr_t)&ip);
m_copydata(m, 0, sizeof(ip), &ip);
if (ip.ip_v != 4)
return (0);
@@ -735,7 +735,7 @@ in_stf_input(struct mbuf *m, int off, int proto, void *arg)
return (IPPROTO_DONE);
}
m_copydata(m, 0, sizeof(struct ip), (caddr_t)&ip);
m_copydata(m, 0, sizeof(struct ip), &ip);
if (sc == NULL || (STF2IFP(sc)->if_flags & IFF_UP) == 0) {
m_freem(m);
SDT_PROBE2(if_stf, , stf_input, out, IPPROTO_DONE, __LINE__);
+1 -2
View File
@@ -2825,8 +2825,7 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb,
goto out;
if (__predict_false(m->m_len < offset + sizeof(struct vxlan_header))) {
m_copydata(m, offset, sizeof(struct vxlan_header),
(caddr_t) &vxlanhdr);
m_copydata(m, offset, sizeof(struct vxlan_header), &vxlanhdr);
vxh = &vxlanhdr;
} else
vxh = mtodo(m, offset);
+1 -1
View File
@@ -239,7 +239,7 @@ typedef struct if_softc_ctx {
uint32_t __spare6__;
uint32_t __spare7__;
uint32_t __spare8__;
caddr_t __spare9__;
void *__spare9__;
int isc_disable_msix;
if_txrx_t isc_txrx;
struct ifmedia *isc_media;
+1 -1
View File
@@ -460,7 +460,7 @@ struct sadb_x_if_hw_offl {
#define PFKEY_ADDR_PROTO(ext) \
(((const struct sadb_address *)(ext))->sadb_address_proto)
#define PFKEY_ADDR_SADDR(ext) \
((const struct sockaddr *)((c_caddr_t)(ext) + sizeof(struct sadb_address)))
((const struct sockaddr *)((const char *)(ext) + sizeof(struct sadb_address)))
/* in 64bits */
#define PFKEY_UNUNIT64(a) ((a) << 3)
+2 -2
View File
@@ -151,11 +151,11 @@ void rn_inithead_internal(struct radix_head *rh, struct radix_node *base_nodes,
#ifndef _KERNEL
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))
#define R_Zalloc(p, t, n) (p = (t) calloc(1,(unsigned int)(n)))
#define R_Free(p) free((char *)p);
#define R_Free(p) free(p);
#else
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT))
#define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT | M_ZERO))
#define R_Free(p) free((caddr_t)p, M_RTABLE);
#define R_Free(p) free(p, M_RTABLE);
#define RADIX_NODE_HEAD_RLOCK_TRACKER struct rm_priotracker _rnh_tracker
#define RADIX_NODE_HEAD_LOCK_INIT(rnh) \
+1 -1
View File
@@ -601,7 +601,7 @@ rt_maskedcopy(const struct sockaddr *src, struct sockaddr *dst,
while (cp2 < cplim)
*cp2++ = *cp1++ & *cp3++;
if (cp2 < cplim2)
bzero((caddr_t)cp2, (unsigned)(cplim2 - cp2));
bzero(cp2, (unsigned)(cplim2 - cp2));
}
/*
+17 -17
View File
@@ -695,7 +695,7 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, struct linear_buffer *lb, u_int fi
* link-local address because rtrequest requires addresses with
* embedded scope id.
*/
if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, info))
if (rt_xaddrs((char *)(rtm + 1), (char *)rtm + len, info))
return (EINVAL);
info->rti_flags = rtm->rtm_flags;
@@ -1106,7 +1106,7 @@ rts_send(struct socket *so, int flags, struct mbuf *m,
if ((rtm = malloc(total_len, M_TEMP, M_NOWAIT)) == NULL)
senderr(ENOBUFS);
m_copydata(m, 0, len, (caddr_t)rtm);
m_copydata(m, 0, len, rtm);
bzero(&info, sizeof(info));
nh = NULL;
struct linear_buffer lb = {
@@ -1294,7 +1294,7 @@ send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, struct mbuf *m,
else
rtm->rtm_flags |= RTF_DONE;
m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm);
m_copyback(m, 0, rtm->rtm_msglen, rtm);
if (m->m_pkthdr.len < rtm->rtm_msglen) {
m_freem(m);
m = NULL;
@@ -1753,7 +1753,7 @@ rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo)
m->m_pkthdr.len = m->m_len = len;
rtm = mtod(m, struct rt_msghdr *);
bzero((caddr_t)rtm, len);
bzero(rtm, len);
for (i = 0; i < RTAX_MAX; i++) {
if ((sa = rtinfo->rti_info[i]) == NULL)
continue;
@@ -1771,7 +1771,7 @@ rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo)
(void)sa6_recoverscope(sin6);
}
#endif
m_copyback(m, len, dlen, (caddr_t)sa);
m_copyback(m, len, dlen, sa);
len += dlen;
}
if (m->m_pkthdr.len != len) {
@@ -1881,7 +1881,7 @@ rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *
(void)sa6_recoverscope(sin6);
}
#endif
bcopy((caddr_t)sa, cp, (unsigned)dlen);
bcopy(sa, cp, (unsigned)dlen);
cp += dlen;
buflen -= dlen;
} else if (cp != NULL) {
@@ -1976,7 +1976,7 @@ rtsock_ifmsg(struct ifnet *ifp, int if_flags_mask __unused)
if (V_route_cb.any_count == 0)
return;
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
m = rtsock_msg_mbuf(RTM_IFINFO, &info);
if (m == NULL)
return;
@@ -2010,7 +2010,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *ifa, int fibnum)
ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR;
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
info.rti_info[RTAX_IFA] = sa = ifa->ifa_addr;
info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr;
info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(
@@ -2056,7 +2056,7 @@ rtsock_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh,
init_sockaddrs_family(family, &dst.sa, &mask.sa);
export_rtaddrs(rt, &dst.sa, &mask.sa);
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = &dst.sa;
info.rti_info[RTAX_NETMASK] = &mask.sa;
info.rti_info[RTAX_GATEWAY] = &nh->gw_sa;
@@ -2123,7 +2123,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma)
if (V_route_cb.any_count == 0)
return;
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
info.rti_info[RTAX_IFA] = ifma->ifma_addr;
if (ifp && ifp->if_addr)
info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr;
@@ -2154,7 +2154,7 @@ rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,
if (V_route_cb.any_count == 0)
return NULL;
bzero((caddr_t)info, sizeof(*info));
bzero(info, sizeof(*info));
m = rtsock_msg_mbuf(type, info);
if (m != NULL) {
ifan = mtod(m, struct if_announcemsghdr *);
@@ -2284,7 +2284,7 @@ sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight,
if (w->w_op == NET_RT_FLAGS && !(rtflags & w->w_arg))
return (0);
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = w->dst;
info.rti_info[RTAX_GATEWAY] = &nh->gw_sa;
info.rti_info[RTAX_NETMASK] = (rtflags & RTF_HOST) ? NULL : w->mask;
@@ -2316,7 +2316,7 @@ sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight,
rtm->rtm_rmx.rmx_weight = weight;
rtm->rtm_index = nh->nh_ifp->if_index;
rtm->rtm_addrs = info.rti_addrs;
error = SYSCTL_OUT(w->w_req, (caddr_t)rtm, size);
error = SYSCTL_OUT(w->w_req, rtm, size);
return (error);
}
return (error);
@@ -2359,7 +2359,7 @@ sysctl_iflist_ifml(struct ifnet *ifp, const struct if_data *src_ifd,
memcpy(ifd, src_ifd, sizeof(*ifd));
return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len));
return (SYSCTL_OUT(w->w_req, ifm, len));
}
static int
@@ -2393,7 +2393,7 @@ sysctl_iflist_ifm(struct ifnet *ifp, const struct if_data *src_ifd,
memcpy(ifd, src_ifd, sizeof(*ifd));
return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len));
return (SYSCTL_OUT(w->w_req, ifm, len));
}
static int
@@ -2472,7 +2472,7 @@ sysctl_iflist(int af, struct walkarg *w)
int len, error = 0;
struct sockaddr_storage ss;
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
bzero(&ifd, sizeof(ifd));
CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
@@ -2538,7 +2538,7 @@ sysctl_ifmalist(int af, struct walkarg *w)
NET_EPOCH_ASSERT();
error = 0;
bzero((caddr_t)&info, sizeof(info));
bzero(&info, sizeof(info));
CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
if (w->w_arg && w->w_arg != ifp->if_index)
+1 -1
View File
@@ -396,7 +396,7 @@ arprequest_internal(struct ifnet *ifp, const struct in_addr *sip,
m->m_pkthdr.len = m->m_len;
M_ALIGN(m, m->m_len);
ah = mtod(m, struct arphdr *);
bzero((caddr_t)ah, m->m_len);
bzero(ah, m->m_len);
#ifdef MAC
mac_netinet_arp_send(ifp, m);
#endif
+2 -2
View File
@@ -316,7 +316,7 @@ rss_mbuf_software_hash_v4(const struct mbuf *m, int dir, uint32_t *hashval,
RSS_DEBUG("short TCP frame?\n");
return (-1);
}
th = (const struct tcphdr *)((c_caddr_t)ip + iphlen);
th = (const struct tcphdr *)((const char *)ip + iphlen);
return rss_proto_software_hash_v4(ip->ip_src, ip->ip_dst,
th->th_sport,
th->th_dport,
@@ -326,7 +326,7 @@ rss_mbuf_software_hash_v4(const struct mbuf *m, int dir, uint32_t *hashval,
} else if ((rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4) &&
(proto == IPPROTO_UDP) &&
(is_frag == 0)) {
uh = (const struct udphdr *)((c_caddr_t)ip + iphlen);
uh = (const struct udphdr *)((const char *)ip + iphlen);
if (m->m_len < iphlen + sizeof(struct udphdr)) {
RSS_DEBUG("short UDP frame?\n");
return (-1);
+1 -1
View File
@@ -1408,7 +1408,7 @@ vrrp_send_ad_locked(struct carp_softc *sc)
in = (struct sockaddr_in *)sc->sc_ifas[i]->ifa_addr;
if (m_append(m, sizeof(in->sin_addr),
(caddr_t)&in->sin_addr) != 1) {
&in->sin_addr) != 1) {
m_freem(m);
goto resched;
}
+1 -1
View File
@@ -186,7 +186,7 @@ ip_redir_alloc(struct mbuf *m, struct nhop_object *nh, u_short ip_len,
}
mcopy->m_len = min(ip_len, M_TRAILINGSPACE(mcopy));
mcopy->m_pkthdr.len = mcopy->m_len;
m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t));
m_copydata(m, 0, mcopy->m_len, mtod(mcopy, void *));
return (mcopy);
}
+1 -1
View File
@@ -528,7 +528,7 @@ in_gre_output(struct mbuf *m, int af, int hlen)
m_copydata(m, hlen + offsetof(struct ip, ip_tos),
sizeof(u_char), &gi->gi_ip.ip_tos);
m_copydata(m, hlen + offsetof(struct ip, ip_id),
sizeof(u_short), (caddr_t)&gi->gi_ip.ip_id);
sizeof(u_short), &gi->gi_ip.ip_id);
break;
#ifdef INET6
case AF_INET6:
+8 -9
View File
@@ -244,7 +244,7 @@ icmp_error(struct mbuf *n, int type, int code, uint32_t dest, int mtu)
if (oip->ip_off & htons(~(IP_MF|IP_DF)))
goto freeit;
if (oip->ip_p == IPPROTO_ICMP && type != ICMP_REDIRECT &&
!ICMP_INFOTYPE(((struct icmp *)((caddr_t)oip +
!ICMP_INFOTYPE(((struct icmp *)((char *)oip +
oiphlen))->icmp_type)) {
ICMPSTAT_INC(icps_oldicmp);
goto freeit;
@@ -367,7 +367,7 @@ stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) -
* Copy the quotation into ICMP message and
* convert quoted IP header back to network representation.
*/
m_copydata(n, 0, icmplen, (caddr_t)&icp->icmp_ip);
m_copydata(n, 0, icmplen, &icp->icmp_ip);
nip = &icp->icmp_ip;
/*
@@ -384,7 +384,7 @@ stdreply: icmpelen = max(8, min(V_icmp_quotelen, ntohs(oip->ip_len) -
m->m_pkthdr.len = m->m_len;
m->m_pkthdr.rcvif = n->m_pkthdr.rcvif;
nip = mtod(m, struct ip *);
bcopy((caddr_t)oip, (caddr_t)nip, sizeof(struct ip));
bcopy(oip, nip, sizeof(struct ip));
nip->ip_len = htons(m->m_len);
nip->ip_v = IPVERSION;
nip->ip_hl = 5;
@@ -911,18 +911,17 @@ match:
*/
if (opt == IPOPT_RR || opt == IPOPT_TS ||
opt == IPOPT_SECURITY) {
bcopy((caddr_t)cp,
mtod(opts, caddr_t) + opts->m_len, len);
opts->m_len += len;
bcopy(cp, mtod(opts, char *) +
opts->m_len, len);
opts->m_len += len;
}
}
/* Terminate & pad, if necessary */
cnt = opts->m_len % 4;
if (cnt) {
for (; cnt < 4; cnt++) {
*(mtod(opts, caddr_t) + opts->m_len) =
IPOPT_EOL;
opts->m_len++;
*(mtod(opts, char *) + opts->m_len) = IPOPT_EOL;
opts->m_len++;
}
}
#ifdef ICMPPRINTFS
+2 -2
View File
@@ -1017,7 +1017,7 @@ ip_forward(struct mbuf *m, int srcrt)
if (mcopy != NULL) {
mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy));
mcopy->m_pkthdr.len = mcopy->m_len;
m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t));
m_copydata(m, 0, mcopy->m_len, mtod(mcopy, void *));
}
#ifdef IPSTEALTH
if (V_ipstealth == 0)
@@ -1182,7 +1182,7 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
} else {
microtime(&tv);
}
*mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv), SCM_TIMESTAMP,
*mp = sbcreatecontrol(&tv, sizeof(tv), SCM_TIMESTAMP,
SOL_SOCKET, M_NOWAIT);
if (*mp != NULL) {
mp = &(*mp)->m_next;
+5 -5
View File
@@ -477,7 +477,7 @@ X_ip_mrouter_set(struct socket *so, struct sockopt *sopt)
} else {
error = sooptcopyin(sopt, &mfc, sizeof(struct mfcctl),
sizeof(struct mfcctl));
bzero((caddr_t)&mfc + sizeof(struct mfcctl),
bzero((char *)&mfc + sizeof(struct mfcctl),
sizeof(mfc) - sizeof(struct mfcctl));
}
if (error)
@@ -1088,7 +1088,7 @@ del_vif_locked(struct mfctable *mfct, vifi_t vifi,
mtx_destroy(&vifp->v_mtx);
bzero((caddr_t)vifp, sizeof (*vifp));
bzero(vifp, sizeof(*vifp));
CTR2(KTR_IPMF, "%s: delete vif %d", __func__, (int)vifi);
@@ -2286,10 +2286,10 @@ bw_upcalls_send(struct mfctable *mfct)
return;
}
m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg);
m_copyback(m, 0, sizeof(struct igmpmsg), &igmpmsg);
len += sizeof(struct igmpmsg);
while ((bu = buf_ring_dequeue_mc(mfct->bw_upcalls)) != NULL) {
m_copyback(m, len, sizeof(struct bw_upcall), (caddr_t)bu);
m_copyback(m, len, sizeof(struct bw_upcall), bu);
len += sizeof(struct bw_upcall);
free(bu, M_MRTABLE);
}
@@ -2538,7 +2538,7 @@ pim_register_send_rp(struct mfctable *mfct, struct ip *ip, struct vif *vifp,
if (ip->ip_off & htons(IP_DF))
ip_outer->ip_off |= htons(IP_DF);
ip_fillid(ip_outer, V_ip_random_id);
pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer
pimhdr = (struct pim_encap_pimhdr *)((char *)ip_outer
+ sizeof(pim_encap_iphdr));
*pimhdr = pim_encap_pimhdr;
/* If the iif crosses a border, set the Border-bit */
+3 -3
View File
@@ -453,9 +453,9 @@ ip_srcroute(struct mbuf *m0)
*/
opts->ip_srcrt.nop = IPOPT_NOP;
opts->ip_srcrt.srcopt[IPOPT_OFFSET] = IPOPT_MINOFF;
(void)memcpy(mtod(m, caddr_t) + sizeof(struct in_addr),
(void)memcpy(mtod(m, char *) + sizeof(struct in_addr),
&(opts->ip_srcrt.nop), OPTSIZ);
q = (struct in_addr *)(mtod(m, caddr_t) +
q = (struct in_addr *)(mtod(m, char *) +
sizeof(struct in_addr) + OPTSIZ);
#undef OPTSIZ
/*
@@ -675,7 +675,7 @@ ip_pcbopts(struct inpcb *inp, int optname, struct mbuf *m)
/*
* Move first hop before start of options.
*/
bcopy((caddr_t)&cp[IPOPT_OFFSET+1], mtod(m, caddr_t),
bcopy(&cp[IPOPT_OFFSET+1], mtod(m, void *),
sizeof(struct in_addr));
/*
* Then copy rest of options back
+2 -2
View File
@@ -1058,7 +1058,7 @@ in_delayed_cksum_o(struct mbuf *m, uint16_t iph_offset)
/* if udp header is not in the first mbuf copy udplen */
if (offset + sizeof(struct udphdr) > m->m_len) {
m_copydata(m, offset + offsetof(struct udphdr,
uh_ulen), sizeof(cklen), (caddr_t)&cklen);
uh_ulen), sizeof(cklen), &cklen);
cklen = ntohs(cklen);
} else {
uh = (struct udphdr *)mtodo(m, offset);
@@ -1074,7 +1074,7 @@ in_delayed_cksum_o(struct mbuf *m, uint16_t iph_offset)
offset += m->m_pkthdr.csum_data; /* checksum offset */
if (offset + sizeof(csum) > m->m_len)
m_copyback(m, offset, sizeof(csum), (caddr_t)&csum);
m_copyback(m, offset, sizeof(csum), &csum);
else
*(u_short *)mtodo(m, offset) = csum;
}
+1 -1
View File
@@ -1818,7 +1818,7 @@ m_megapullup(struct mbuf *m, int len)
goto bad;
m_align(mcl, len);
m_move_pkthdr(mcl, m);
m_copydata(m, 0, len, mtod(mcl, caddr_t));
m_copydata(m, 0, len, mtod(mcl, void *));
mcl->m_len = mcl->m_pkthdr.len = len;
m_freem(m);
+2 -2
View File
@@ -754,7 +754,7 @@ siftr_chkpkt(struct mbuf **m, struct ifnet *ifp, int flags,
* in 4-byte words, so multiply it to get the size in bytes.
*/
ip_hl = (ip->ip_hl << 2);
th = (struct tcphdr *)((caddr_t)ip + ip_hl);
th = (struct tcphdr *)((char *)ip + ip_hl);
/*
* Only pkts selected by the tcp port filter
@@ -905,7 +905,7 @@ siftr_chkpkt6(struct mbuf **m, struct ifnet *ifp, int flags,
* in the ipv6 packet.
*/
ip6_hl = sizeof(struct ip6_hdr);
th = (struct tcphdr *)((caddr_t)ip6 + ip6_hl);
th = (struct tcphdr *)((char *)ip6 + ip6_hl);
/*
* Only pkts selected by the tcp port filter
+5 -5
View File
@@ -638,7 +638,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
isipv6 = mtod(m, struct ip *)->ip_v == 6;
if (isipv6) {
ip6 = mtod(m, struct ip6_hdr *);
th = (struct tcphdr *)((caddr_t)ip6 + off0);
th = (struct tcphdr *)((char *)ip6 + off0);
tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0;
if (port)
goto skip6_csum;
@@ -700,7 +700,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
}
}
ip = mtod(m, struct ip *);
th = (struct tcphdr *)((caddr_t)ip + off0);
th = (struct tcphdr *)((char *)ip + off0);
tlen = ntohs(ip->ip_len) - off0;
iptos = ip->ip_tos;
@@ -775,7 +775,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
return (IPPROTO_DONE);
}
ip6 = mtod(m, struct ip6_hdr *);
th = (struct tcphdr *)((caddr_t)ip6 + off0);
th = (struct tcphdr *)((char *)ip6 + off0);
}
}
#endif
@@ -791,7 +791,7 @@ tcp_input_with_port(struct mbuf **mp, int *offp, int proto, uint16_t port)
return (IPPROTO_DONE);
}
ip = mtod(m, struct ip *);
th = (struct tcphdr *)((caddr_t)ip + off0);
th = (struct tcphdr *)((char *)ip + off0);
}
}
#endif
@@ -3588,7 +3588,7 @@ tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m,
while (cnt >= 0) {
if (m->m_len > cnt) {
char *cp = mtod(m, caddr_t) + cnt;
char *cp = mtod(m, char *) + cnt;
struct tcpcb *tp = sototcpcb(so);
INP_WLOCK_ASSERT(tptoinpcb(tp));
+4 -4
View File
@@ -2266,10 +2266,10 @@ tcp_log_getlogbuf(struct sockopt *sopt, struct tcpcb *tp)
INP_WUNLOCK(inp);
} else {
/* Sanity check entries */
KASSERT(((caddr_t)out_entry - (caddr_t)sopt->sopt_val) ==
KASSERT(((char *)out_entry - (char *)sopt->sopt_val) ==
outsize, ("%s: Actual output size (%zu) != "
"calculated output size (%zu)", __func__,
(size_t)((caddr_t)out_entry - (caddr_t)sopt->sopt_val),
(size_t)((char *)out_entry - (char *)sopt->sopt_val),
outsize));
/* Free the entries we just copied out. */
@@ -2279,8 +2279,8 @@ tcp_log_getlogbuf(struct sockopt *sopt, struct tcpcb *tp)
}
}
sopt->sopt_valsize = (size_t)((caddr_t)out_entry -
(caddr_t)sopt->sopt_val);
sopt->sopt_valsize = (size_t)((char *)out_entry -
(char *)sopt->sopt_val);
return (error);
}
+4 -3
View File
@@ -426,9 +426,10 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo
break;
/* Try to parse inner headers. */
data_ptr = tcp_lro_low_level_parser(data_ptr, pi, update_data, true,
(m->m_len - ((caddr_t)data_ptr - m->m_data)));
if (data_ptr == NULL || (pi->total_hdr_len + po->total_hdr_len) > m->m_len)
data_ptr = tcp_lro_low_level_parser(data_ptr, pi, update_data,
true, (m->m_len - ((char *)data_ptr - m->m_data)));
if (data_ptr == NULL ||
(pi->total_hdr_len + po->total_hdr_len) > m->m_len)
break;
/* Verify supported header types. */
+5 -5
View File
@@ -1077,8 +1077,7 @@ send:
*/
mb = sbsndptr_noadv(&so->so_snd, off, &moff);
if (len <= MHLEN - hdrlen - max_linkhdr && !hw_tls) {
m_copydata(mb, moff, len,
mtod(m, caddr_t) + hdrlen);
m_copydata(mb, moff, len, mtod(m, char *) + hdrlen);
if (SEQ_LT(tp->snd_nxt, tp->snd_max))
sbsndptr_adv(&so->so_snd, mb, len);
m->m_len += len;
@@ -1158,7 +1157,8 @@ send:
if (isipv6) {
ip6 = mtod(m, struct ip6_hdr *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr));
udp = (struct udphdr *)((char *)ip6 +
sizeof(struct ip6_hdr));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip6_hdr);
@@ -1173,7 +1173,7 @@ send:
{
ip = mtod(m, struct ip *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
udp = (struct udphdr *)((char *)ip + sizeof(struct ip));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip);
@@ -2098,7 +2098,7 @@ tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
n->m_data = m->m_data + off;
mb_dupcl(n, m);
} else
bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t),
bcopy(mtod(m, char *) + off, mtod(n, char *),
(u_int)n->m_len);
if (sb && (sb->sb_sndptr == m) &&
+4 -3
View File
@@ -13138,7 +13138,7 @@ send:
mb = sbsndptr_noadv(sb, sb_offset, &moff);
if (len <= MHLEN - hdrlen - max_linkhdr && !hw_tls) {
m_copydata(mb, moff, (int)len,
mtod(m, caddr_t)+hdrlen);
mtod(m, char *)+hdrlen);
if (rsm == NULL)
sbsndptr_adv(sb, mb, len);
m->m_len += len;
@@ -13253,7 +13253,8 @@ send:
if (isipv6) {
ip6 = mtod(m, struct ip6_hdr *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr));
udp = (struct udphdr *)((char *)ip6 +
sizeof(struct ip6_hdr));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip6_hdr);
@@ -13268,7 +13269,7 @@ send:
{
ip = mtod(m, struct ip *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
udp = (struct udphdr *)((char *)ip + sizeof(struct ip));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip);
+9 -6
View File
@@ -13946,7 +13946,8 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack, int32_t flags)
ip6 = (struct ip6_hdr *)rack->r_ctl.fsb.tcp_ip_hdr;
if (tp->t_port) {
rack->r_ctl.fsb.tcp_ip_hdr_len += sizeof(struct udphdr);
udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr));
udp = (struct udphdr *)((char *)ip6 +
sizeof(struct ip6_hdr));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
rack->r_ctl.fsb.udp = udp;
@@ -13968,7 +13969,7 @@ rack_init_fsb_block(struct tcpcb *tp, struct tcp_rack *rack, int32_t flags)
ip = (struct ip *)rack->r_ctl.fsb.tcp_ip_hdr;
if (tp->t_port) {
rack->r_ctl.fsb.tcp_ip_hdr_len += sizeof(struct udphdr);
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
udp = (struct udphdr *)((char *)ip + sizeof(struct ip));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
rack->r_ctl.fsb.udp = udp;
@@ -18117,7 +18118,7 @@ rack_fo_base_copym(struct mbuf *the_m, uint32_t the_off, int32_t *plen,
n->m_data = m->m_data + off;
mb_dupcl(n, m);
} else {
bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t),
bcopy(mtod(m, char *) + off, mtod(n, char *),
(u_int)n->m_len);
}
len -= n->m_len;
@@ -21412,7 +21413,7 @@ send:
s_moff = moff;
if (len <= MHLEN - hdrlen - max_linkhdr && !hw_tls) {
m_copydata(mb, moff, (int)len,
mtod(m, caddr_t)+hdrlen);
mtod(m, char *) + hdrlen);
/*
* If we are not retransmitting advance the
* sndptr to help remember the next place in
@@ -21547,7 +21548,8 @@ send:
if (isipv6) {
ip6 = mtod(m, struct ip6_hdr *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip6 + sizeof(struct ip6_hdr));
udp = (struct udphdr *)((char *)ip6 +
sizeof(struct ip6_hdr));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip6_hdr);
@@ -21562,7 +21564,8 @@ send:
#ifdef INET
ip = mtod(m, struct ip *);
if (tp->t_port) {
udp = (struct udphdr *)((caddr_t)ip + sizeof(struct ip));
udp = (struct udphdr *)((char *)ip +
sizeof(struct ip));
udp->uh_sport = htons(V_tcp_udp_tunneling_port);
udp->uh_dport = tp->t_port;
ulen = hdrlen + len - sizeof(struct ip);
+15 -18
View File
@@ -595,7 +595,7 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
return (true);
}
iph = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)iph + off);
uh = (struct udphdr *)((char *)iph + off);
th = (struct tcphdr *)(uh + 1);
thlen = th->th_off << 2;
if (m->m_len < off + sizeof(struct udphdr) + thlen) {
@@ -605,7 +605,7 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
return (true);
} else {
iph = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)iph + off);
uh = (struct udphdr *)((char *)iph + off);
th = (struct tcphdr *)(uh + 1);
}
}
@@ -1796,8 +1796,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
m->m_data += max_linkhdr;
#ifdef INET6
if (isipv6) {
bcopy((caddr_t)ip6, mtod(m, caddr_t),
sizeof(struct ip6_hdr));
bcopy(ip6, mtod(m, char *), sizeof(struct ip6_hdr));
ip6 = mtod(m, struct ip6_hdr *);
nth = (struct tcphdr *)(ip6 + 1);
if (port) {
@@ -1810,7 +1809,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
} else
#endif /* INET6 */
{
bcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip));
bcopy(ip, mtod(m, char *), sizeof(struct ip));
ip = mtod(m, struct ip *);
nth = (struct tcphdr *)(ip + 1);
if (port) {
@@ -1821,7 +1820,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
nth = (struct tcphdr *)(uh + 1);
}
}
bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr));
bcopy(th, nth, sizeof(struct tcphdr));
flags = TH_ACK;
} else if ((!M_WRITABLE(m)) || (port != 0)) {
struct mbuf *n;
@@ -1844,8 +1843,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
#define xchg(a,b,type) { type t; t=a; a=b; b=t; }
#ifdef INET6
if (isipv6) {
bcopy((caddr_t)ip6, mtod(n, caddr_t),
sizeof(struct ip6_hdr));
bcopy(ip6, mtod(n, char *), sizeof(struct ip6_hdr));
ip6 = mtod(n, struct ip6_hdr *);
xchg(ip6->ip6_dst, ip6->ip6_src, struct in6_addr);
nth = (struct tcphdr *)(ip6 + 1);
@@ -1859,7 +1857,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
} else
#endif /* INET6 */
{
bcopy((caddr_t)ip, mtod(n, caddr_t), sizeof(struct ip));
bcopy(ip, mtod(n, char *), sizeof(struct ip));
ip = mtod(n, struct ip *);
xchg(ip->ip_dst.s_addr, ip->ip_src.s_addr, uint32_t);
nth = (struct tcphdr *)(ip + 1);
@@ -1871,7 +1869,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
nth = (struct tcphdr *)(uh + 1);
}
}
bcopy((caddr_t)th, (caddr_t)nth, sizeof(struct tcphdr));
bcopy(th, nth, sizeof(struct tcphdr));
xchg(nth->th_dport, nth->th_sport, uint16_t);
th = nth;
m_freem(m);
@@ -1883,7 +1881,7 @@ tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, struct mbuf *m,
*/
m_freem(m->m_next);
m->m_next = NULL;
m->m_data = (caddr_t)ipgen;
m->m_data = ipgen;
/* clear any receive flags for proper bpf timestamping */
m->m_flags &= ~(M_TSTMP | M_TSTMP_LRO);
/* m_len is set later */
@@ -3130,7 +3128,7 @@ tcp_ctlinput_with_port(struct icmp *icp, uint16_t port)
}
ip = &icp->icmp_ip;
th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
th = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2));
icmp_tcp_seq = th->th_seq;
inp = in_pcblookup(&V_tcbinfo, ip->ip_dst, th->th_dport, ip->ip_src,
th->th_sport, INPLOOKUP_WLOCKPCB, NULL);
@@ -3204,7 +3202,7 @@ tcp_ctlinput_viaudp(udp_tun_icmp_param_t param)
int i_hlen, o_len;
uint16_t port;
outer_ip = (struct ip *)((caddr_t)icmp - sizeof(struct ip));
outer_ip = (struct ip *)((char *)icmp - sizeof(struct ip));
inner_ip = &icmp->icmp_ip;
i_hlen = inner_ip->ip_hl << 2;
o_len = ntohs(outer_ip->ip_len);
@@ -3214,7 +3212,7 @@ tcp_ctlinput_viaudp(udp_tun_icmp_param_t param)
return;
}
/* Ok lets strip out the inner udphdr header by copying up on top of it the tcp hdr */
udp = (struct udphdr *)(((caddr_t)inner_ip) + i_hlen);
udp = (struct udphdr *)(((char *)inner_ip) + i_hlen);
if (ntohs(udp->uh_sport) != V_tcp_udp_tunneling_port) {
return;
}
@@ -3315,14 +3313,14 @@ tcp6_ctlinput_with_port(struct ip6ctlparam *ip6cp, uint16_t port)
return;
}
bzero(&t_ports, sizeof(struct tcp_ports));
m_copydata(m, off, sizeof(struct tcp_ports), (caddr_t)&t_ports);
m_copydata(m, off, sizeof(struct tcp_ports), &t_ports);
inp = in6_pcblookup(&V_tcbinfo, &ip6->ip6_dst, t_ports.th_dport,
&ip6->ip6_src, t_ports.th_sport, INPLOOKUP_WLOCKPCB, NULL);
off += sizeof(struct tcp_ports);
if (m->m_pkthdr.len < (int32_t) (off + sizeof(tcp_seq))) {
goto out;
}
m_copydata(m, off, sizeof(tcp_seq), (caddr_t)&icmp_tcp_seq);
m_copydata(m, off, sizeof(tcp_seq), &icmp_tcp_seq);
if (inp != NULL) {
tp = intotcpcb(inp);
#ifdef TCP_OFFLOAD
@@ -3398,8 +3396,7 @@ tcp6_ctlinput_viaudp(udp_tun_icmp_param_t param)
if (ip6cp->ip6c_m->m_pkthdr.len <
ip6cp->ip6c_off + sizeof(struct udphdr))
return;
m_copydata(ip6cp->ip6c_m, ip6cp->ip6c_off, sizeof(udp),
(caddr_t)&udp);
m_copydata(ip6cp->ip6c_m, ip6cp->ip6c_off, sizeof(udp), &udp);
if (ntohs(udp.uh_sport) != V_tcp_udp_tunneling_port)
return;
port = udp.uh_dport;
+1 -1
View File
@@ -876,7 +876,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
sin.sin_len = sizeof(sin);
sin.sin_addr = sc->sc_inc.inc_faddr;
sin.sin_port = sc->sc_inc.inc_fport;
bzero((caddr_t)sin.sin_zero, sizeof(sin.sin_zero));
bzero(sin.sin_zero, sizeof(sin.sin_zero));
error = in_pcbconnect(inp, &sin, thread0.td_ucred);
if (error != 0)
goto abort;
+1 -1
View File
@@ -1332,7 +1332,7 @@ tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
goto out;
}
m->m_len = 1;
*mtod(m, caddr_t) = tp->t_iobc;
*mtod(m, char *) = tp->t_iobc;
if ((flags & MSG_PEEK) == 0)
tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
+2 -2
View File
@@ -503,7 +503,7 @@ udp_input(struct mbuf **mp, int *offp, int proto)
}
}
ip = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)ip + iphlen);
uh = (struct udphdr *)((char *)ip + iphlen);
cscov_partial = (proto == IPPROTO_UDPLITE) ? 1 : 0;
/*
@@ -743,7 +743,7 @@ udp_common_ctlinput(struct icmp *icmp, struct inpcbinfo *pcbinfo)
if (icmp_errmap(icmp) == 0)
return;
uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));
uh = (struct udphdr *)((char *)ip + (ip->ip_hl << 2));
inp = in_pcblookup(pcbinfo, ip->ip_dst, uh->uh_dport, ip->ip_src,
uh->uh_sport, INPLOOKUP_WLOCKPCB, NULL);
if (inp != NULL) {
+2 -2
View File
@@ -78,7 +78,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto)
return (IPPROTO_DONE);
}
}
dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off);
dstopts = (struct ip6_dest *)(mtod(m, char *) + off);
dstoptlen = (dstopts->ip6d_len + 1) << 3;
if (m->m_len < off + dstoptlen) {
@@ -89,7 +89,7 @@ dest6_input(struct mbuf **mp, int *offp, int proto)
return (IPPROTO_DONE);
}
}
dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off);
dstopts = (struct ip6_dest *)(mtod(m, char *) + off);
off += dstoptlen;
dstoptlen -= sizeof(struct ip6_dest);
opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest);
+3 -4
View File
@@ -474,7 +474,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
* sizeof(struct ip6_frag) == 8
* sizeof(struct ip6_hdr) = 40
*/
ip6f = (struct ip6_frag *)((caddr_t)ip6 + offset);
ip6f = (struct ip6_frag *)((char *)ip6 + offset);
if ((ip6f->ip6f_offlg & IP6F_MORE_FRAG) &&
(((ntohs(ip6->ip6_plen) - offset) & 0x7) != 0)) {
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
@@ -503,7 +503,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
* we must update the last one.
*/
m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t),
(caddr_t)&nxt);
&nxt);
ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) -
sizeof(struct ip6_frag));
if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0)
@@ -864,8 +864,7 @@ postinsert:
ip6_deletefraghdr(m, offset, M_NOWAIT);
/* Set nxt(-hdr field value) to the original value. */
m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t),
(caddr_t)&nxt);
m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), &nxt);
#ifdef MAC
mac_ip6q_reassemble(q6, m);
+20 -20
View File
@@ -337,7 +337,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param)
}
}
oip6 = mtod(m, struct ip6_hdr *);
icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off);
icp = (struct icmp6_hdr *)(mtod(m, char *) + off);
if (icp->icmp6_type < ICMP6_ECHO_REQUEST ||
icp->icmp6_type == ND_REDIRECT) {
@@ -499,7 +499,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
}
/* Calculate the checksum. */
icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off);
icmp6 = (struct icmp6_hdr *)((char *)ip6 + off);
code = icmp6->icmp6_code;
if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) {
nd6log((LOG_ERR,
@@ -608,7 +608,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
break;
}
}
nicmp6 = (struct icmp6_hdr *)(mtod(n, caddr_t) + off);
nicmp6 = (struct icmp6_hdr *)(mtod(n, char *) + off);
noff = off;
}
if (n) {
@@ -940,7 +940,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
return (-1);
}
}
icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off);
icmp6 = (struct icmp6_hdr *)(mtod(m, char *) + off);
eip6 = (struct ip6_hdr *)(icmp6 + 1);
bzero(&icmp6dst, sizeof(icmp6dst));
@@ -973,7 +973,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
}
}
eh = (struct ip6_ext *)
(mtod(m, caddr_t) + eoff);
(mtod(m, char *) + eoff);
if (nxt == IPPROTO_AH)
eoff += (eh->ip6e_len + 2) << 2;
else
@@ -998,7 +998,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
}
}
rth = (struct ip6_rthdr *)
(mtod(m, caddr_t) + eoff);
(mtod(m, char *) + eoff);
rthlen = (rth->ip6r_len + 1) << 3;
/*
* XXX: currently there is no
@@ -1022,7 +1022,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
}
}
rth0 = (struct ip6_rthdr0 *)
(mtod(m, caddr_t) + eoff);
(mtod(m, char *) + eoff);
/* just ignore a bogus header */
if ((rth0->ip6r0_len % 2) == 0 &&
@@ -1042,7 +1042,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
return (-1);
}
}
fh = (struct ip6_frag *)(mtod(m, caddr_t) +
fh = (struct ip6_frag *)(mtod(m, char *) +
eoff);
/*
* Data after a fragment header is meaningless
@@ -1069,7 +1069,7 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp6len)
}
}
notify:
icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off);
icmp6 = (struct icmp6_hdr *)(mtod(m, char *) + off);
/*
* retrieve parameters from the inner IPv6 header, and convert
@@ -1189,7 +1189,7 @@ ni6_input(struct mbuf *m, int off, struct prison *pr)
struct in6_ifaddr *ia6 = NULL;
ip6 = mtod(m, struct ip6_hdr *);
ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off);
ni6 = (struct icmp6_nodeinfo *)(mtod(m, char *) + off);
/*
* Validate IPv6 source address.
@@ -1285,7 +1285,7 @@ ni6_input(struct mbuf *m, int off, struct prison *pr)
* We do not do proxy at this moment.
*/
m_copydata(m, off + sizeof(struct icmp6_nodeinfo),
subjlen, (caddr_t)&in6_subj);
subjlen, &in6_subj);
if (in6_setscope(&in6_subj, m->m_pkthdr.rcvif, NULL))
goto bad;
@@ -1332,8 +1332,8 @@ ni6_input(struct mbuf *m, int off, struct prison *pr)
}
}
/* ip6 possibly invalid but not used after. */
ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off);
subj = (char *)(mtod(m, caddr_t) + off +
ni6 = (struct icmp6_nodeinfo *)(mtod(m, char *) + off);
subj = (char *)(mtod(m, char *) + off +
sizeof(struct icmp6_nodeinfo));
if (!ni6_dnsmatch(subj, subjlen, mtod(n, const char *),
n->m_len)) {
@@ -1420,9 +1420,9 @@ ni6_input(struct mbuf *m, int off, struct prison *pr)
n->m_pkthdr.len = n->m_len = replylen;
/* copy mbuf header and IPv6 + Node Information base headers */
bcopy(mtod(m, caddr_t), mtod(n, caddr_t), sizeof(struct ip6_hdr));
bcopy(mtod(m, void *), mtod(n, void *), sizeof(struct ip6_hdr));
nni6 = (struct icmp6_nodeinfo *)(mtod(n, struct ip6_hdr *) + 1);
bcopy((caddr_t)ni6, (caddr_t)nni6, sizeof(struct icmp6_nodeinfo));
bcopy(ni6, nni6, sizeof(struct icmp6_nodeinfo));
/* qtype dependent procedure */
switch (qtype) {
@@ -1442,7 +1442,7 @@ ni6_input(struct mbuf *m, int off, struct prison *pr)
}
case NI_QTYPE_FQDN:
nni6->ni_code = ICMP6_NI_SUCCESS;
fqdn = (struct ni_reply_fqdn *)(mtod(n, caddr_t) +
fqdn = (struct ni_reply_fqdn *)(mtod(n, char *) +
sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo));
nni6->ni_flags = 0; /* XXX: meaningless TTL */
fqdn->ni_fqdn_ttl = 0; /* ditto. */
@@ -1911,7 +1911,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
int delivered = 0, fib;
/* This is assumed to be safe; icmp6_input() does a pullup. */
icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off);
icmp6 = (struct icmp6_hdr *)((char *)ip6 + off);
/*
* XXX: the address may have embedded scope zone ID, which should be
@@ -2033,14 +2033,14 @@ icmp6_reflect(struct mbuf *m, size_t off)
struct ip6_hdr nip6;
l = off - sizeof(struct ip6_hdr);
m_copydata(m, 0, sizeof(nip6), (caddr_t)&nip6);
m_copydata(m, 0, sizeof(nip6), &nip6);
m_adj(m, l);
l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
if (m->m_len < l) {
if ((m = m_pullup(m, l)) == NULL)
return;
}
bcopy((caddr_t)&nip6, mtod(m, caddr_t), sizeof(nip6));
bcopy(&nip6, mtod(m, void *), sizeof(nip6));
} else /* off == sizeof(struct ip6_hdr) */ {
size_t l;
l = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr);
@@ -2195,7 +2195,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
}
}
ip6 = mtod(m, struct ip6_hdr *);
nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off);
nd_rd = (struct nd_redirect *)((char *)ip6 + off);
ifp = m->m_pkthdr.rcvif;
redtgt6 = nd_rd->nd_rd_target;
+3 -3
View File
@@ -268,7 +268,7 @@ rss_mbuf_software_hash_v6(const struct mbuf *m, int dir, uint32_t *hashval,
RSS_DEBUG("short fragment frame?\n");
return (-1);
}
ip6f = (const struct ip6_frag *)((c_caddr_t)ip6 + off);
ip6f = (const struct ip6_frag *)((const char *)ip6 + off);
if ((ip6f->ip6f_offlg & ~IP6F_RESERVED_MASK) == 0) {
off = ip6_lasthdr(m, off, proto, &nxt);
if (off < 0) {
@@ -342,7 +342,7 @@ rss_mbuf_software_hash_v6(const struct mbuf *m, int dir, uint32_t *hashval,
RSS_DEBUG("short TCP frame?\n");
return (-1);
}
th = (const struct tcphdr *)((c_caddr_t)ip6 + off);
th = (const struct tcphdr *)((const char *)ip6 + off);
return rss_proto_software_hash_v6(&ip6->ip6_src, &ip6->ip6_dst,
th->th_sport,
th->th_dport,
@@ -355,7 +355,7 @@ rss_mbuf_software_hash_v6(const struct mbuf *m, int dir, uint32_t *hashval,
RSS_DEBUG("short UDP frame?\n");
return (-1);
}
uh = (const struct udphdr *)((c_caddr_t)ip6 + off);
uh = (const struct udphdr *)((const char *)ip6 + off);
return rss_proto_software_hash_v6(&ip6->ip6_src, &ip6->ip6_dst,
uh->uh_sport,
uh->uh_dport,
+10 -10
View File
@@ -592,7 +592,7 @@ ip6_input(struct mbuf *m)
goto bad;
m_move_pkthdr(n, m);
m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t));
m_copydata(m, 0, n->m_pkthdr.len, mtod(n, void *));
n->m_len = n->m_pkthdr.len;
m_freem(m);
m = n;
@@ -959,7 +959,7 @@ ip6_hopopts_input(u_int32_t *rtalertp, struct mbuf **mp, int *offp)
return (-1);
}
}
hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off);
hbh = (struct ip6_hbh *)(mtod(m, char *) + off);
hbhlen = (hbh->ip6h_len + 1) << 3;
if (m->m_len < off + hbhlen) {
@@ -970,7 +970,7 @@ ip6_hopopts_input(u_int32_t *rtalertp, struct mbuf **mp, int *offp)
return (-1);
}
}
hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off);
hbh = (struct ip6_hbh *)(mtod(m, char *) + off);
off += hbhlen;
hbhlen -= sizeof(struct ip6_hbh);
if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh),
@@ -1029,7 +1029,7 @@ ip6_process_hopopts(struct mbuf *m, u_int8_t *opthead, int hbhlen,
return (-1);
}
optlen = IP6OPT_RTALERT_LEN;
bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2);
bcopy(opt + 2, &rtalert_val, 2);
*rtalertp = ntohs(rtalert_val);
break;
case IP6OPT_JUMBO:
@@ -1403,7 +1403,7 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
if (off + sizeof(*ip6e) > m->m_len)
goto loopend;
ip6e = (struct ip6_ext *)(mtod(m, caddr_t) + off);
ip6e = (struct ip6_ext *)(mtod(m, char *) + off);
if (nxt == IPPROTO_AH)
elen = (ip6e->ip6e_len + 2) << 2;
else
@@ -1557,7 +1557,7 @@ ip6_get_prevhdr(const struct mbuf *m, int off)
len = sizeof(struct ip6_hdr);
nlen = 0;
while (len < off) {
m_copydata(m, len, sizeof(ip6e), (caddr_t)&ip6e);
m_copydata(m, len, sizeof(ip6e), &ip6e);
switch (nxt) {
case IPPROTO_FRAGMENT:
nlen = sizeof(struct ip6_frag);
@@ -1594,7 +1594,7 @@ ip6_nexthdr(const struct mbuf *m, int off, int proto, int *nxtp)
case IPPROTO_IPV6:
if (m->m_pkthdr.len < off + sizeof(ip6))
return -1;
m_copydata(m, off, sizeof(ip6), (caddr_t)&ip6);
m_copydata(m, off, sizeof(ip6), &ip6);
if (nxtp)
*nxtp = ip6.ip6_nxt;
off += sizeof(ip6);
@@ -1607,7 +1607,7 @@ ip6_nexthdr(const struct mbuf *m, int off, int proto, int *nxtp)
*/
if (m->m_pkthdr.len < off + sizeof(fh))
return -1;
m_copydata(m, off, sizeof(fh), (caddr_t)&fh);
m_copydata(m, off, sizeof(fh), &fh);
/* IP6F_OFF_MASK = 0xfff8(BigEndian), 0xf8ff(LittleEndian) */
if (fh.ip6f_offlg & IP6F_OFF_MASK)
return -1;
@@ -1619,7 +1619,7 @@ ip6_nexthdr(const struct mbuf *m, int off, int proto, int *nxtp)
case IPPROTO_AH:
if (m->m_pkthdr.len < off + sizeof(ip6e))
return -1;
m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e);
m_copydata(m, off, sizeof(ip6e), &ip6e);
if (nxtp)
*nxtp = ip6e.ip6e_nxt;
off += (ip6e.ip6e_len + 2) << 2;
@@ -1630,7 +1630,7 @@ ip6_nexthdr(const struct mbuf *m, int off, int proto, int *nxtp)
case IPPROTO_DSTOPTS:
if (m->m_pkthdr.len < off + sizeof(ip6e))
return -1;
m_copydata(m, off, sizeof(ip6e), (caddr_t)&ip6e);
m_copydata(m, off, sizeof(ip6e), &ip6e);
if (nxtp)
*nxtp = ip6e.ip6e_nxt;
off += (ip6e.ip6e_len + 1) << 3;
+1 -1
View File
@@ -1854,7 +1854,7 @@ pim6_input(struct mbuf *m, int off, int proto, void *arg __unused)
}
}
ip6 = mtod(m, struct ip6_hdr *);
pim = (struct pim *)((caddr_t)ip6 + off);
pim = (struct pim *)((char *)ip6 + off);
#define PIM6_CHECKSUM
#ifdef PIM6_CHECKSUM
+7 -7
View File
@@ -139,7 +139,7 @@ static int ip6_getpcbopt(struct inpcb *, int, struct sockopt *);
static int ip6_setpktopt(int, u_char *, int, struct ip6_pktopts *,
struct ucred *, int, int, int);
static int ip6_copyexthdr(struct mbuf **, caddr_t, int);
static int ip6_copyexthdr(struct mbuf **, const void *, int);
static int ip6_insertfraghdr(struct mbuf *, struct mbuf *, int,
struct ip6_frag **);
static int ip6_splithdr(struct mbuf *, struct ip6_exthdrs *);
@@ -157,7 +157,7 @@ static int copypktopts(struct ip6_pktopts *, struct ip6_pktopts *, int);
#define MAKE_EXTHDR(hp, mp, _ol) \
do { \
struct ip6_ext *eh = (struct ip6_ext *)(hp); \
error = ip6_copyexthdr((mp), (caddr_t)(hp), \
error = ip6_copyexthdr((mp), (hp), \
((eh)->ip6e_len + 1) << 3); \
if (error) \
goto freehdrs; \
@@ -198,7 +198,7 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset)
offset += m->m_pkthdr.csum_data; /* checksum offset */
if (offset + sizeof(csum) > m->m_len)
m_copyback(m, offset, sizeof(csum), (caddr_t)&csum);
m_copyback(m, offset, sizeof(csum), &csum);
else
*(u_short *)mtodo(m, offset) = csum;
}
@@ -1278,7 +1278,7 @@ bad:
}
static int
ip6_copyexthdr(struct mbuf **mp, caddr_t hdr, int hlen)
ip6_copyexthdr(struct mbuf **mp, const void *hdr, int hlen)
{
struct mbuf *m;
@@ -1293,7 +1293,7 @@ ip6_copyexthdr(struct mbuf **mp, caddr_t hdr, int hlen)
return (ENOBUFS);
m->m_len = hlen;
if (hdr)
bcopy(hdr, mtod(m, caddr_t), hlen);
bcopy(hdr, mtod(m, void *), hlen);
*mp = m;
return (0);
@@ -1324,7 +1324,7 @@ ip6_insertfraghdr(struct mbuf *m0, struct mbuf *m, int hlen,
if (M_WRITABLE(mlast) &&
M_TRAILINGSPACE(mlast) >= sizeof(struct ip6_frag)) {
/* use the trailing space of the last mbuf for the fragment hdr */
*frghdrp = (struct ip6_frag *)(mtod(mlast, caddr_t) +
*frghdrp = (struct ip6_frag *)(mtod(mlast, char *) +
mlast->m_len);
mlast->m_len += sizeof(struct ip6_frag);
m->m_pkthdr.len += sizeof(struct ip6_frag);
@@ -3191,7 +3191,7 @@ ip6_splithdr(struct mbuf *m, struct ip6_exthdrs *exthdrs)
mh->m_next = m;
m = mh;
m->m_len = sizeof(*ip6);
bcopy((caddr_t)ip6, mtod(m, caddr_t), sizeof(*ip6));
bcopy(ip6, mtod(m, void *), sizeof(*ip6));
}
exthdrs->ip6e_ip6 = m;
return 0;
+1 -2
View File
@@ -1011,8 +1011,7 @@ mld_v2_process_group_query(struct in6_multi *inm, struct mld_ifsoftc *mli,
soff = off + sizeof(struct mldv2_query);
nrecorded = 0;
for (i = 0; i < nsrc; i++) {
m_copydata(m0, soff, sizeof(struct in6_addr),
(caddr_t)&srcaddr);
m_copydata(m0, soff, sizeof(struct in6_addr), &srcaddr);
retval = in6m_record_source(inm, &srcaddr);
if (retval < 0)
break;
+3 -3
View File
@@ -429,7 +429,7 @@ nd6_option(union nd_opts *ndopts)
nd_opt = ndopts->nd_opts_search;
/* make sure nd_opt_len is inside the buffer */
if ((caddr_t)&nd_opt->nd_opt_len >= (caddr_t)ndopts->nd_opts_last) {
if ((char *)&nd_opt->nd_opt_len >= (char *)ndopts->nd_opts_last) {
bzero(ndopts, sizeof(*ndopts));
return NULL;
}
@@ -444,7 +444,7 @@ nd6_option(union nd_opts *ndopts)
return NULL;
}
ndopts->nd_opts_search = (struct nd_opt_hdr *)((caddr_t)nd_opt + olen);
ndopts->nd_opts_search = (struct nd_opt_hdr *)((char *)nd_opt + olen);
if (ndopts->nd_opts_search > ndopts->nd_opts_last) {
/* option overruns the end of buffer, invalid */
bzero(ndopts, sizeof(*ndopts));
@@ -612,7 +612,7 @@ nd6_llinfo_get_holdsrc(struct llentry *ln, struct in6_addr *src)
if (sizeof(hdr) > m->m_len)
return (NULL);
m_copydata(m, 0, sizeof(hdr), (caddr_t)&hdr);
m_copydata(m, 0, sizeof(hdr), &hdr);
*src = hdr.ip6_src;
return (src);
+1 -1
View File
@@ -380,7 +380,7 @@ void nd6_na_output(struct ifnet *, const struct in6_addr *,
void nd6_ns_input(struct mbuf *, int, int);
void nd6_ns_output(struct ifnet *, const struct in6_addr *,
const struct in6_addr *, const struct in6_addr *, uint8_t *);
caddr_t nd6_ifptomac(struct ifnet *);
char *nd6_ifptomac(struct ifnet *);
u_int nd6_lladdr_opt_pad(struct ifnet *);
void nd6_dad_init(void);
void nd6_dad_start(struct ifaddr *, int);
+7 -7
View File
@@ -180,7 +180,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
}
}
ip6 = mtod(m, struct ip6_hdr *);
nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off);
nd_ns = (struct nd_neighbor_solicit *)((char *)ip6 + off);
saddr6 = ip6->ip6_src;
daddr6 = ip6->ip6_dst;
@@ -623,10 +623,10 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6,
m->m_pkthdr.len += optlen;
m->m_len += optlen;
icmp6len += optlen;
bzero((caddr_t)nd_opt, optlen);
bzero(nd_opt, optlen);
nd_opt->nd_opt_type = ND_OPT_NONCE;
nd_opt->nd_opt_len = optlen >> 3;
bcopy(nonce, (caddr_t)(nd_opt + 1), ND_OPT_NONCE_LEN);
bcopy(nonce, nd_opt + 1, ND_OPT_NONCE_LEN);
}
ip6->ip6_plen = htons((u_short)icmp6len);
nd_ns->nd_ns_cksum = 0;
@@ -718,7 +718,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
}
}
ip6 = mtod(m, struct ip6_hdr *);
nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off);
nd_na = (struct nd_neighbor_advert *)((char *)ip6 + off);
flags = nd_na->nd_na_flags_reserved;
is_router = ((flags & ND_NA_FLAG_ROUTER) != 0);
@@ -1004,7 +1004,7 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
NET_EPOCH_ASSERT();
int icmp6len, maxlen, error;
caddr_t mac = NULL;
char *mac = NULL;
daddr6 = *daddr6_0; /* make a local copy for modification */
@@ -1104,7 +1104,7 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0,
m->m_pkthdr.len += optlen;
m->m_len += optlen;
icmp6len += optlen;
bzero((caddr_t)nd_opt, optlen);
bzero(nd_opt, 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);
@@ -1149,7 +1149,7 @@ nd6_na_output(struct ifnet *ifp, const struct in6_addr *daddr6_0,
}
#endif
caddr_t
char *
nd6_ifptomac(struct ifnet *ifp)
{
switch (ifp->if_type) {
+3 -3
View File
@@ -213,7 +213,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
}
}
ip6 = mtod(m, struct ip6_hdr *);
nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off);
nd_rs = (struct nd_router_solicit *)((char *)ip6 + off);
icmp6len -= sizeof(*nd_rs);
nd6_option_init(nd_rs + 1, icmp6len, &ndopts);
@@ -558,7 +558,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
}
ip6 = mtod(m, struct ip6_hdr *);
}
nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off);
nd_ra = (struct nd_router_advert *)((char *)ip6 + off);
icmp6len -= sizeof(*nd_ra);
nd6_option_init(nd_ra + 1, icmp6len, &ndopts);
@@ -637,7 +637,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
auth = ((m->m_flags & M_AUTHIPHDR) && (m->m_flags & M_AUTHIPDGM));
for (pt = (struct nd_opt_hdr *)ndopts.nd_opts_pi;
pt <= (struct nd_opt_hdr *)ndopts.nd_opts_pi_end;
pt = (struct nd_opt_hdr *)((caddr_t)pt +
pt = (struct nd_opt_hdr *)((char *)pt +
(pt->nd_opt_len << 3))) {
nd6_ra_opt_pi(pt, ifp, nd_ra, dr, auth, mcast);
}
+1 -1
View File
@@ -516,7 +516,7 @@ rip6_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
}
if (!n)
goto bad;
p = (u_int16_t *)(mtod(n, caddr_t) + off);
p = (uint16_t *)(mtod(n, char *) + off);
*p = 0;
*p = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
}
+2 -2
View File
@@ -89,7 +89,7 @@ route6_input(struct mbuf **mp, int *offp, int proto)
}
}
ip6 = mtod(m, struct ip6_hdr *);
rh = (struct ip6_rthdr *)((caddr_t)ip6 + off);
rh = (struct ip6_rthdr *)((char *)ip6 + off);
/*
* While this switch may look gratuitous, leave it in
@@ -104,7 +104,7 @@ route6_input(struct mbuf **mp, int *offp, int proto)
}
IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
(caddr_t)&rh->ip6r_type - (caddr_t)ip6);
(char *)&rh->ip6r_type - (char *)ip6);
*mp = NULL;
return (IPPROTO_DONE);
}
+3 -3
View File
@@ -377,7 +377,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
}
}
ip6 = mtod(m, struct ip6_hdr *);
uh = (struct udphdr *)((caddr_t)ip6 + off);
uh = (struct udphdr *)((char *)ip6 + off);
UDPSTAT_INC(udps_ipackets);
@@ -582,7 +582,7 @@ udp6_common_ctlinput(struct ip6ctlparam *ip6cp, struct inpcbinfo *pcbinfo)
return;
bzero(&uh, sizeof(uh));
m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh);
m_copydata(m, off, sizeof(*uhp), &uh);
/* Check to see if its tunneled */
inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_dst, uh.uh_dport,
@@ -889,7 +889,7 @@ udp6_send(struct socket *so, int flags_arg, struct mbuf *m,
* Stuff checksum and output datagram.
*/
cscov = cscov_partial = 0;
udp6 = (struct udphdr *)(mtod(m, caddr_t) + hlen);
udp6 = (struct udphdr *)(mtod(m, char *) + hlen);
udp6->uh_sport = inp->inp_lport; /* lport is always set in the PCB */
udp6->uh_dport = fport;
if (nxt == IPPROTO_UDPLITE) {