summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2003-08-14 19:00:12 +0000
committerjason <jason@openbsd.org>2003-08-14 19:00:12 +0000
commit0bcc08bcc013755db1037c473bec9a63ab23e35a (patch)
tree8394aebd1dec66441235816d12adae1b3223fd7c
parentcorrect length mask (diff)
downloadwireguard-openbsd-0bcc08bcc013755db1037c473bec9a63ab23e35a.tar.xz
wireguard-openbsd-0bcc08bcc013755db1037c473bec9a63ab23e35a.zip
m_copyback()'s 4th arg is const void *, nuke (caddr_t) casts.
-rw-r--r--sys/net/if_vlan.c6
-rw-r--r--sys/net/pf.c73
-rw-r--r--sys/net/pf_norm.c4
-rw-r--r--sys/net/rtsock.c6
-rw-r--r--sys/netinet/ip_ah.c12
-rw-r--r--sys/netinet/ip_esp.c4
-rw-r--r--sys/netinet/ip_ether.c4
-rw-r--r--sys/netinet/ip_ipcomp.c6
-rw-r--r--sys/netinet/ip_output.c6
-rw-r--r--sys/netinet6/raw_ip6.c6
10 files changed, 60 insertions, 67 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index fa15a9b4fa0..9a6ec88a038 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.39 2003/07/25 03:45:42 jason Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.40 2003/08/14 19:00:12 jason Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
*
@@ -206,7 +206,7 @@ vlan_start(struct ifnet *ifp)
sizeof(struct ether_vlan_header);
m_copyback(m0, 0, sizeof(struct ether_vlan_header),
- (caddr_t)&evh);
+ &evh);
m = m0;
}
@@ -265,7 +265,7 @@ vlan_input_tag(struct mbuf *m, u_int16_t t)
if (m->m_len < sizeof(struct ether_vlan_header) &&
(m = m_pullup(m, sizeof(struct ether_vlan_header))) == NULL)
return (-1);
- m_copyback(m, 0, sizeof(struct ether_vlan_header), (caddr_t)&vh);
+ m_copyback(m, 0, sizeof(struct ether_vlan_header), &vh);
ether_input_mbuf(m->m_pkthdr.rcvif, m);
return (-1);
}
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 01c1d371d97..3369361121c 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.382 2003/08/09 14:56:48 cedric Exp $ */
+/* $OpenBSD: pf.c,v 1.383 2003/08/14 19:00:12 jason Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -2267,7 +2267,7 @@ pf_test_tcp(struct pf_rule **rm, struct pf_state **sm, int direction,
if (r->log) {
if (rewrite)
- m_copyback(m, off, sizeof(*th), (caddr_t)th);
+ m_copyback(m, off, sizeof(*th), th);
PFLOG_PACKET(ifp, h, m, af, direction, reason, r, a, ruleset);
}
@@ -2455,7 +2455,7 @@ pf_test_tcp(struct pf_rule **rm, struct pf_state **sm, int direction,
/* copy back packet headers if we performed NAT operations */
if (rewrite)
- m_copyback(m, off, sizeof(*th), (caddr_t)th);
+ m_copyback(m, off, sizeof(*th), th);
return (PF_PASS);
}
@@ -2585,7 +2585,7 @@ pf_test_udp(struct pf_rule **rm, struct pf_state **sm, int direction,
if (r->log) {
if (rewrite)
- m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+ m_copyback(m, off, sizeof(*uh), uh);
PFLOG_PACKET(ifp, h, m, af, direction, reason, r, a, ruleset);
}
@@ -2696,7 +2696,7 @@ pf_test_udp(struct pf_rule **rm, struct pf_state **sm, int direction,
/* copy back packet headers if we performed NAT operations */
if (rewrite)
- m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+ m_copyback(m, off, sizeof(*uh), uh);
return (PF_PASS);
}
@@ -2864,7 +2864,7 @@ pf_test_icmp(struct pf_rule **rm, struct pf_state **sm, int direction,
#ifdef INET6
if (rewrite)
m_copyback(m, off, sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
#endif /* INET6 */
PFLOG_PACKET(ifp, h, m, af, direction, reason, r, a, ruleset);
}
@@ -2954,7 +2954,7 @@ pf_test_icmp(struct pf_rule **rm, struct pf_state **sm, int direction,
/* copy back packet headers if we performed IPv6 NAT operations */
if (rewrite)
m_copyback(m, off, sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
#endif /* INET6 */
return (PF_PASS);
@@ -3674,10 +3674,10 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct ifnet *ifp,
pf_change_ap(pd->dst, &th->th_dport, pd->ip_sum,
&th->th_sum, &(*state)->lan.addr,
(*state)->lan.port, 0, pd->af);
- m_copyback(m, off, sizeof(*th), (caddr_t)th);
+ m_copyback(m, off, sizeof(*th), th);
} else if (copyback) {
/* Copyback sequence modulation or stateful scrub changes */
- m_copyback(m, off, sizeof(*th), (caddr_t)th);
+ m_copyback(m, off, sizeof(*th), th);
}
(*state)->rule.ptr->packets++;
@@ -3747,7 +3747,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct ifnet *ifp,
pf_change_ap(pd->dst, &uh->uh_dport, pd->ip_sum,
&uh->uh_sum, &(*state)->lan.addr,
(*state)->lan.port, 1, pd->af);
- m_copyback(m, off, sizeof(*uh), (caddr_t)uh);
+ m_copyback(m, off, sizeof(*uh), uh);
}
(*state)->rule.ptr->packets++;
@@ -3843,7 +3843,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
&(*state)->gwy.addr, 0);
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
break;
#endif /* INET6 */
}
@@ -3863,7 +3863,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
&(*state)->lan.addr, 0);
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
break;
#endif /* INET6 */
}
@@ -4054,24 +4054,24 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- (caddr_t)pd->hdr.icmp);
+ pd->hdr.icmp);
m_copyback(m, ipoff2, sizeof(h2),
- (caddr_t)&h2);
+ &h2);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
- (caddr_t)&h2_6);
+ &h2_6);
break;
#endif /* INET6 */
}
- m_copyback(m, off2, 8, (caddr_t)&th);
+ m_copyback(m, off2, 8, &th);
} else if (src->seqdiff) {
- m_copyback(m, off2, 8, (caddr_t)&th);
+ m_copyback(m, off2, 8, &th);
}
return (PF_PASS);
@@ -4116,23 +4116,21 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- (caddr_t)pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2),
- (caddr_t)&h2);
+ pd->hdr.icmp);
+ m_copyback(m, ipoff2, sizeof(h2), &h2);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
- (caddr_t)&h2_6);
+ &h2_6);
break;
#endif /* INET6 */
}
- m_copyback(m, off2, sizeof(uh),
- (caddr_t)&uh);
+ m_copyback(m, off2, sizeof(uh), &uh);
}
return (PF_PASS);
@@ -4174,12 +4172,9 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET);
}
- m_copyback(m, off, ICMP_MINLEN,
- (caddr_t)pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2),
- (caddr_t)&h2);
- m_copyback(m, off2, ICMP_MINLEN,
- (caddr_t)&iih);
+ m_copyback(m, off, ICMP_MINLEN, pd->hdr.icmp);
+ m_copyback(m, ipoff2, sizeof(h2), &h2);
+ m_copyback(m, off2, ICMP_MINLEN, &iih);
}
return (PF_PASS);
@@ -4223,11 +4218,10 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
pd->ip_sum, 0, AF_INET6);
}
m_copyback(m, off, sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
- m_copyback(m, ipoff2, sizeof(h2_6),
- (caddr_t)&h2_6);
+ pd->hdr.icmp6);
+ m_copyback(m, ipoff2, sizeof(h2_6), &h2_6);
m_copyback(m, off2, sizeof(struct icmp6_hdr),
- (caddr_t)&iih);
+ &iih);
}
return (PF_PASS);
@@ -4264,18 +4258,17 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct ifnet *ifp,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- (caddr_t)pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2),
- (caddr_t)&h2);
+ pd->hdr.icmp);
+ m_copyback(m, ipoff2, sizeof(h2), &h2);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- (caddr_t)pd->hdr.icmp6);
+ pd->hdr.icmp6);
m_copyback(m, ipoff2, sizeof(h2_6),
- (caddr_t)&h2_6);
+ &h2_6);
break;
#endif /* INET6 */
}
diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c
index 5765cd379d8..cc49e4ed1b3 100644
--- a/sys/net/pf_norm.c
+++ b/sys/net/pf_norm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_norm.c,v 1.70 2003/07/17 16:25:52 frantzen Exp $ */
+/* $OpenBSD: pf_norm.c,v 1.71 2003/08/14 19:00:12 jason Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@@ -1275,7 +1275,7 @@ pf_normalize_tcp(int dir, struct ifnet *ifp, struct mbuf *m, int ipoff,
/* copy back packet headers if we sanitized */
if (rewrite)
- m_copyback(m, off, sizeof(*th), (caddr_t)th);
+ m_copyback(m, off, sizeof(*th), th);
return (PF_PASS);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 93d5de65566..c17a79a0374 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.30 2003/07/05 00:00:32 itojun Exp $ */
+/* $OpenBSD: rtsock.c,v 1.31 2003/08/14 19:00:12 jason Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -394,7 +394,7 @@ flush:
if (dst)
route_proto.sp_protocol = dst->sa_family;
if (rtm) {
- 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;
@@ -494,7 +494,7 @@ rt_msg1(type, rtinfo)
continue;
rtinfo->rti_addrs |= (1 << i);
dlen = ROUNDUP(sa->sa_len);
- m_copyback(m, len, dlen, (caddr_t)sa);
+ m_copyback(m, len, dlen, sa);
len += dlen;
}
if (m->m_pkthdr.len != len) {
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index 41bf387c718..ef632660fcb 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.78 2003/07/24 09:59:02 itojun Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.79 2003/08/14 19:00:12 jason Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -362,7 +362,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
ip6.ip6_dst.s6_addr16[1] = 0;
/* Done with IPv6 header. */
- m_copyback(m, 0, sizeof(struct ip6_hdr), (caddr_t) &ip6);
+ m_copyback(m, 0, sizeof(struct ip6_hdr), &ip6);
/* Let's deal with the remaining headers (if any). */
if (skip - sizeof(struct ip6_hdr) > 0) {
@@ -1153,7 +1153,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
(caddr_t) &iplen, sizeof(u_int16_t));
iplen = htons(ntohs(iplen) + rplen + ahx->authsize);
m_copyback(m, offsetof(struct ip, ip_len),
- sizeof(u_int16_t), (caddr_t) &iplen);
+ sizeof(u_int16_t), &iplen);
break;
#endif /* INET */
@@ -1164,7 +1164,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
(caddr_t) &iplen, sizeof(u_int16_t));
iplen = htons(ntohs(iplen) + rplen + ahx->authsize);
m_copyback(m, offsetof(struct ip6_hdr, ip6_plen),
- sizeof(u_int16_t), (caddr_t) &iplen);
+ sizeof(u_int16_t), &iplen);
break;
#endif /* INET6 */
}
@@ -1174,7 +1174,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
/* Update the Next Protocol field in the IP header. */
prot = IPPROTO_AH;
- m_copyback(m, protoff, sizeof(u_int8_t), (caddr_t) &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot);
/* "Massage" the packet headers for crypto processing. */
if ((len = ah_massage_headers(&m, tdb->tdb_dst.sa.sa_family,
@@ -1187,7 +1187,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
} else {
/* Update the Next Protocol field in the IP header. */
prot = IPPROTO_AH;
- m_copyback(m, protoff, sizeof(u_int8_t), (caddr_t) &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot);
}
/* Crypto operation descriptor. */
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index 8ea427e157b..a8794edaece 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.86 2003/07/24 09:59:02 itojun Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.87 2003/08/14 19:00:12 jason Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -888,7 +888,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
/* Fix Next Protocol in IPv4/IPv6 header. */
prot = IPPROTO_ESP;
- m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot);
/* Get crypto descriptors. */
crp = crypto_getreq(esph && espx ? 2 : 1);
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 00371a5bc63..419bf3f4942 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.44 2003/05/03 01:43:07 itojun Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.45 2003/08/14 19:00:12 jason Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
*
@@ -412,7 +412,7 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
eip.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
eip.eip_pad = 0;
m_copyback(m, hlen - sizeof(struct etherip_header),
- sizeof(struct etherip_header), (caddr_t)&eip);
+ sizeof(struct etherip_header), &eip);
*mp = m;
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index 9530b0efc0a..41016b059ae 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.14 2003/04/02 20:09:26 millert Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.15 2003/08/14 19:00:12 jason Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -352,7 +352,7 @@ ipcomp_input_cb(op)
crypto_freereq(crp);
/* Restore the Next Protocol field */
- m_copyback(m, protoff, sizeof(u_int8_t), (u_int8_t *) & nproto);
+ m_copyback(m, protoff, sizeof(u_int8_t), &nproto);
/* Back to generic IPsec input processing */
error = ipsec_common_input_cb(m, tdb, skip, protoff, NULL);
@@ -559,7 +559,7 @@ ipcomp_output(m, tdb, mp, skip, protoff)
/* Fix Next Protocol in IPv4/IPv6 header */
prot = IPPROTO_IPCOMP;
- m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) & prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot);
/* Ok now, we can pass to the crypto processing */
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 0f8578b0e10..5a8bd4bd53d 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.154 2003/07/09 22:03:16 itojun Exp $ */
+/* $OpenBSD: ip_output.c,v 1.155 2003/08/14 19:00:12 jason Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1434,7 +1434,7 @@ ip_ctloutput(op, so, level, optname, mp)
m->m_len += ipr->ref_len;
*mtod(m, u_int16_t *) = ipr->ref_type;
m_copyback(m, sizeof(u_int16_t), ipr->ref_len,
- (caddr_t)(ipr + 1));
+ ipr + 1);
}
#endif
break;
@@ -1913,7 +1913,7 @@ in_delayed_cksum(struct mbuf *m)
}
if ((offset + sizeof(u_int16_t)) > m->m_len)
- m_copyback(m, offset, sizeof(csum), (caddr_t) &csum);
+ m_copyback(m, offset, sizeof(csum), &csum);
else
*(u_int16_t *)(mtod(m, caddr_t) + offset) = csum;
}
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 7842a826a3e..588c1ae8600 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.19 2003/06/02 23:28:16 millert Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.20 2003/08/14 19:00:13 jason Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -480,9 +480,9 @@ rip6_output(struct mbuf *m, ...)
off += sizeof(struct ip6_hdr);
sum = 0;
- m_copyback(m, off, sizeof(sum), (caddr_t)&sum);
+ m_copyback(m, off, sizeof(sum), &sum);
sum = in6_cksum(m, ip6->ip6_nxt, sizeof(*ip6), plen);
- m_copyback(m, off, sizeof(sum), (caddr_t)&sum);
+ m_copyback(m, off, sizeof(sum), &sum);
}
flags = 0;