Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149622763
D7878.id20304.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
12 KB
Referenced Files
None
Subscribers
None
D7878.id20304.diff
View Options
Index: sys/contrib/ipfilter/netinet/ip_compat.h
===================================================================
--- sys/contrib/ipfilter/netinet/ip_compat.h
+++ sys/contrib/ipfilter/netinet/ip_compat.h
@@ -211,7 +211,7 @@
# define MSGDSIZE(m) mbufchainlen(m)
# define M_LEN(m) (m)->m_len
# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(x) m_copy((x), 0, M_COPYALL)
+# define M_COPY(x) m_copym((x), 0, M_COPYALL, M_NOWAIT)
# define M_DUP(m) m_dup(m, M_NOWAIT)
# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
typedef struct mbuf mb_t;
Index: sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
===================================================================
--- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
+++ sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
@@ -920,7 +920,7 @@
mhip->ip_off |= IP_MF;
mhip->ip_len = htons((u_short)(len + mhlen));
*mnext = m;
- m->m_next = m_copy(m0, off, len);
+ m->m_next = m_copym(m0, off, len, M_NOWAIT);
if (m->m_next == 0) {
error = ENOBUFS; /* ??? */
goto sendorfree;
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -1640,7 +1640,8 @@
do {
if (flags & MSG_PEEK) {
if (controlp != NULL) {
- *controlp = m_copy(m, 0, m->m_len);
+ *controlp = m_copym(m, 0, m->m_len,
+ M_NOWAIT);
controlp = &(*controlp)->m_next;
}
m = m->m_next;
Index: sys/net/if_arcsubr.c
===================================================================
--- sys/net/if_arcsubr.c
+++ sys/net/if_arcsubr.c
@@ -225,7 +225,7 @@
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
- struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
+ struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
(void) if_simloop(ifp, n, dst->sa_family, ARC_HDRLEN);
} else if (ah->arc_dhost == ah->arc_shost) {
Index: sys/net/if_fddisubr.c
===================================================================
--- sys/net/if_fddisubr.c
+++ sys/net/if_fddisubr.c
@@ -275,7 +275,7 @@
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
(void) if_simloop(ifp, n, dst->sa_family,
FDDI_HDR_LEN);
} else if (bcmp(fh->fddi_dhost, fh->fddi_shost,
Index: sys/net/if_iso88025subr.c
===================================================================
--- sys/net/if_iso88025subr.c
+++ sys/net/if_iso88025subr.c
@@ -364,7 +364,7 @@
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
(void) if_simloop(ifp, n, dst->sa_family,
ISO88025_HDR_LEN);
} else if (bcmp(th->iso88025_dhost, th->iso88025_shost,
Index: sys/net/raw_usrreq.c
===================================================================
--- sys/net/raw_usrreq.c
+++ sys/net/raw_usrreq.c
@@ -95,7 +95,7 @@
continue;
if (last) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (n) {
if (sbappendaddr(&last->so_rcv, src,
n, (struct mbuf *)0) == 0)
Index: sys/netinet/ip_input.c
===================================================================
--- sys/netinet/ip_input.c
+++ sys/netinet/ip_input.c
@@ -1000,7 +1000,7 @@
* because unnecessary, or because rate limited), so we are
* really we are wasting a lot of work here.
*
- * We don't use m_copy() because it might return a reference
+ * We don't use m_copym() because it might return a reference
* to a shared cluster. Both this function and ip_output()
* assume exclusive access to the IP header in `m', so any
* data in a cluster may change before we reach icmp_error().
Index: sys/netinet/ip_mroute.c
===================================================================
--- sys/netinet/ip_mroute.c
+++ sys/netinet/ip_mroute.c
@@ -1344,7 +1344,7 @@
goto fail;
/* Make a copy of the header to send to the user level process */
- mm = m_copy(mb0, 0, hlen);
+ mm = m_copym(mb0, 0, hlen, M_NOWAIT);
if (mm == NULL)
goto fail1;
@@ -1542,7 +1542,7 @@
struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET };
struct igmpmsg *im;
int hlen = ip->ip_hl << 2;
- struct mbuf *mm = m_copy(m, 0, hlen);
+ struct mbuf *mm = m_copym(m, 0, hlen, M_NOWAIT);
if (mm && (!M_WRITABLE(mm) || mm->m_len < hlen))
mm = m_pullup(mm, hlen);
@@ -2734,9 +2734,9 @@
* actions (e.g., send back PIM_REGISTER_STOP).
* XXX: here m->m_data points to the outer IP header.
*/
- mcp = m_copy(m, 0, iphlen + PIM_REG_MINLEN);
+ mcp = m_copym(m, 0, iphlen + PIM_REG_MINLEN, M_NOWAIT);
if (mcp == NULL) {
- CTR1(KTR_IPMF, "%s: m_copy() failed", __func__);
+ CTR1(KTR_IPMF, "%s: m_copym() failed", __func__);
m_freem(m);
return (IPPROTO_DONE);
}
Index: sys/netinet/raw_ip.c
===================================================================
--- sys/netinet/raw_ip.c
+++ sys/netinet/raw_ip.c
@@ -322,7 +322,7 @@
if (last != NULL) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (n != NULL)
(void) rip_append(last, ip, n, &ripsrc);
/* XXX count dropped packet */
@@ -400,7 +400,7 @@
if (last != NULL) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (n != NULL)
(void) rip_append(last, ip, n, &ripsrc);
/* XXX count dropped packet */
Index: sys/netinet/tcp_output.c
===================================================================
--- sys/netinet/tcp_output.c
+++ sys/netinet/tcp_output.c
@@ -1049,7 +1049,7 @@
mtod(m, caddr_t) + hdrlen);
m->m_len += len;
} else {
- m->m_next = m_copy(mb, moff, (int)len);
+ m->m_next = m_copym(mb, moff, len, M_NOWAIT);
if (m->m_next == NULL) {
SOCKBUF_UNLOCK(&so->so_snd);
(void) m_free(m);
Index: sys/netinet/udp_usrreq.c
===================================================================
--- sys/netinet/udp_usrreq.c
+++ sys/netinet/udp_usrreq.c
@@ -597,7 +597,8 @@
if (last != NULL) {
struct mbuf *n;
- if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
+ if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) !=
+ NULL) {
UDP_PROBE(receive, NULL, last, ip,
last, uh);
if (udp_append(last, ip, n, iphlen,
Index: sys/netinet6/icmp6.c
===================================================================
--- sys/netinet6/icmp6.c
+++ sys/netinet6/icmp6.c
@@ -554,7 +554,7 @@
icmp6_ifstat_inc(ifp, ifs6_in_echo);
if (code != 0)
goto badcode;
- if ((n = m_copy(m, 0, M_COPYALL)) == NULL) {
+ if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
/* Give up remote */
break;
}
@@ -651,7 +651,7 @@
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo),
IPPROTO_DONE);
#endif
- n = m_copy(m, 0, M_COPYALL);
+ n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (n)
n = ni6_input(n, off);
/* XXX meaningless if n == NULL */
@@ -2039,7 +2039,7 @@
}
}
if (n != NULL ||
- (n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ (n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
if (last->inp_flags & INP_CONTROLOPTS)
ip6_savecontrol(last, n, &opts);
/* strip intermediate headers */
Index: sys/netinet6/ip6_forward.c
===================================================================
--- sys/netinet6/ip6_forward.c
+++ sys/netinet6/ip6_forward.c
@@ -166,7 +166,8 @@
* It is important to save it before IPsec processing as IPsec
* processing may modify the mbuf.
*/
- mcopy = m_copy(m, 0, imin(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN));
+ mcopy = m_copym(m, 0, imin(m->m_pkthdr.len, ICMPV6_PLD_MAXLEN),
+ M_NOWAIT);
#ifdef IPSEC
/* get a security policy for this packet */
Index: sys/netinet6/ip6_mroute.c
===================================================================
--- sys/netinet6/ip6_mroute.c
+++ sys/netinet6/ip6_mroute.c
@@ -1145,7 +1145,7 @@
MFC6_UNLOCK();
return (ENOBUFS);
}
- mb0 = m_copy(m, 0, M_COPYALL);
+ mb0 = m_copym(m, 0, M_COPYALL, M_NOWAIT);
/*
* Pullup packet header if needed before storing it,
* as other references may modify it in the meantime.
@@ -1185,7 +1185,7 @@
* Make a copy of the header to send to the user
* level process
*/
- mm = m_copy(mb0, 0, sizeof(struct ip6_hdr));
+ mm = m_copym(mb0, 0, sizeof(struct ip6_hdr), M_NOWAIT);
if (mm == NULL) {
free(rte, M_MRTABLE6);
m_freem(mb0);
@@ -1417,7 +1417,8 @@
struct omrt6msg *oim;
#endif
- mm = m_copy(m, 0, sizeof(struct ip6_hdr));
+ mm = m_copym(m, 0, sizeof(struct ip6_hdr),
+ M_NOWAIT);
if (mm &&
(!M_WRITABLE(mm) ||
mm->m_len < sizeof(struct ip6_hdr)))
@@ -1547,7 +1548,7 @@
* the IPv6 header is actually copied, not just referenced,
* so that ip6_output() only scribbles on the copy.
*/
- mb_copy = m_copy(m, 0, M_COPYALL);
+ mb_copy = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (mb_copy &&
(!M_WRITABLE(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr)))
mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
@@ -1651,7 +1652,7 @@
mm->m_data += max_linkhdr;
mm->m_len = sizeof(struct ip6_hdr);
- if ((mm->m_next = m_copy(m, 0, M_COPYALL)) == NULL) {
+ if ((mm->m_next = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
m_freem(mm);
return (ENOBUFS);
}
@@ -1870,7 +1871,7 @@
/*
* make a copy of the whole header to pass to the daemon later.
*/
- mcp = m_copy(m, 0, off + PIM6_REG_MINLEN);
+ mcp = m_copym(m, 0, off + PIM6_REG_MINLEN, M_NOWAIT);
if (mcp == NULL) {
MRT6_DLOG(DEBUG_ANY | DEBUG_ERR, "pim register: "
"could not copy register head");
Index: sys/netinet6/ip6_output.c
===================================================================
--- sys/netinet6/ip6_output.c
+++ sys/netinet6/ip6_output.c
@@ -259,7 +259,7 @@
ip6f->ip6f_offlg |= IP6F_MORE_FRAG;
mhip6->ip6_plen = htons((u_short)(mtu + hlen +
sizeof(*ip6f) - sizeof(struct ip6_hdr)));
- if ((m_frgpart = m_copy(m0, off, mtu)) == NULL) {
+ if ((m_frgpart = m_copym(m0, off, mtu, M_NOWAIT)) == NULL) {
IP6STAT_INC(ip6s_odropped);
return (ENOBUFS);
}
@@ -3003,7 +3003,7 @@
struct mbuf *copym;
struct ip6_hdr *ip6;
- copym = m_copy(m, 0, M_COPYALL);
+ copym = m_copym(m, 0, M_COPYALL, M_NOWAIT);
if (copym == NULL)
return;
Index: sys/netinet6/raw_ip6.c
===================================================================
--- sys/netinet6/raw_ip6.c
+++ sys/netinet6/raw_ip6.c
@@ -256,7 +256,7 @@
}
}
if (last != NULL) {
- struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
+ struct mbuf *n = m_copym(m, 0, M_COPYALL, M_NOWAIT);
#ifdef IPSEC
/*
Index: sys/netinet6/udp6_usrreq.c
===================================================================
--- sys/netinet6/udp6_usrreq.c
+++ sys/netinet6/udp6_usrreq.c
@@ -366,7 +366,8 @@
if (last != NULL) {
struct mbuf *n;
- if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
+ if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) !=
+ NULL) {
INP_RLOCK(last);
UDP_PROBE(receive, NULL, last, ip6,
last, uh);
Index: sys/netipsec/keysock.c
===================================================================
--- sys/netipsec/keysock.c
+++ sys/netipsec/keysock.c
@@ -301,7 +301,7 @@
* (based on pf_key@inner.net message on 14 Oct 1998)
*/
if (((struct keycb *)rp)->kp_promisc) {
- if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) != NULL) {
(void)key_sendup0(rp, n, 1);
n = NULL;
}
@@ -331,7 +331,7 @@
if (!sendup)
continue;
- if ((n = m_copy(m, 0, (int)M_COPYALL)) == NULL) {
+ if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
m_freem(m);
PFKEYSTAT_INC(in_nomem);
mtx_unlock(&rawcb_mtx);
Index: sys/sys/mbuf.h
===================================================================
--- sys/sys/mbuf.h
+++ sys/sys/mbuf.h
@@ -979,9 +979,6 @@
/* Length to m_copy to copy all. */
#define M_COPYALL 1000000000
-/* Compatibility with 4.3. */
-#define m_copy(m, o, l) m_copym((m), (o), (l), M_NOWAIT)
-
extern int max_datalen; /* MHLEN - max_hdr */
extern int max_hdr; /* Largest link + protocol header */
extern int max_linkhdr; /* Largest link-level header */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 26, 6:09 PM (1 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30391537
Default Alt Text
D7878.id20304.diff (12 KB)
Attached To
Mode
D7878: Remove the 4.3BSD compatible macro m_copy(), use m_copym() instead
Attached
Detach File
Event Timeline
Log In to Comment