Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 May 2022 17:11:58 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b46667c63eb7 - main - sockbuf: merge two versions of sbcreatecontrol() into one
Message-ID:  <202205171711.24HHBwc3095372@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=b46667c63eb7f126a56e23af1401d98d77b912e8

commit b46667c63eb7f126a56e23af1401d98d77b912e8
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-05-17 17:10:42 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-05-17 17:10:42 +0000

    sockbuf: merge two versions of sbcreatecontrol() into one
    
    No functional change.
---
 sys/dev/cxgbe/tom/t4_tls.c                         |  2 +-
 sys/kern/uipc_ktls.c                               |  2 +-
 sys/kern/uipc_sockbuf.c                            |  9 +--
 sys/kern/uipc_usrreq.c                             | 18 +++---
 .../bluetooth/socket/ng_btsocket_hci_raw.c         |  8 +--
 sys/netinet/ip_input.c                             | 56 +++++++++----------
 sys/netinet/udp_usrreq.c                           |  5 +-
 sys/netinet6/ip6_input.c                           | 65 +++++++++++-----------
 sys/netinet6/udp6_usrreq.c                         |  5 +-
 sys/sys/sockbuf.h                                  |  5 +-
 10 files changed, 83 insertions(+), 92 deletions(-)

diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c
index 936199fd18f1..eb540406a271 100644
--- a/sys/dev/cxgbe/tom/t4_tls.c
+++ b/sys/dev/cxgbe/tom/t4_tls.c
@@ -1035,7 +1035,7 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 
 	/* Allocate the control message mbuf. */
 	control = sbcreatecontrol(NULL, sizeof(*tgr), TLS_GET_RECORD,
-	    IPPROTO_TCP);
+	    IPPROTO_TCP, M_NOWAIT);
 	if (control == NULL) {
 		m_freem(m);
 		m_freem(tls_data);
diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index 7b99c460e8de..ea20532a4d8c 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -2119,7 +2119,7 @@ ktls_decrypt(struct socket *so)
 		tgr.tls_vminor = hdr->tls_vminor;
 		tgr.tls_length = htobe16(tls_len - tls->params.tls_hlen -
 		    trail_len);
-		control = sbcreatecontrol_how(&tgr, sizeof(tgr),
+		control = sbcreatecontrol(&tgr, sizeof(tgr),
 		    TLS_GET_RECORD, IPPROTO_TCP, M_WAITOK);
 
 		SOCKBUF_LOCK(sb);
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index 421fa5da37d9..884562510e61 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -1760,7 +1760,7 @@ sbdroprecord(struct sockbuf *sb)
  * type for presentation on a socket buffer.
  */
 struct mbuf *
-sbcreatecontrol_how(void *p, int size, int type, int level, int wait)
+sbcreatecontrol(void *p, int size, int type, int level, int wait)
 {
 	struct cmsghdr *cp;
 	struct mbuf *m;
@@ -1792,13 +1792,6 @@ sbcreatecontrol_how(void *p, int size, int type, int level, int wait)
 	return (m);
 }
 
-struct mbuf *
-sbcreatecontrol(caddr_t p, int size, int type, int level)
-{
-
-	return (sbcreatecontrol_how(p, size, type, level, M_NOWAIT));
-}
-
 /*
  * This does the same for socket buffers that sotoxsocket does for sockets:
  * generate an user-format data structure describing the socket buffer.  Note
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index e89d7567fcda..f08b972c6de6 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -2043,7 +2043,7 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags)
 			 */
 			newlen = newfds * sizeof(int);
 			*controlp = sbcreatecontrol(NULL, newlen,
-			    SCM_RIGHTS, SOL_SOCKET);
+			    SCM_RIGHTS, SOL_SOCKET, M_NOWAIT);
 			if (*controlp == NULL) {
 				FILEDESC_XUNLOCK(fdesc);
 				error = E2BIG;
@@ -2081,7 +2081,7 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags)
 			if (error || controlp == NULL)
 				goto next;
 			*controlp = sbcreatecontrol(NULL, datalen,
-			    cm->cmsg_type, cm->cmsg_level);
+			    cm->cmsg_type, cm->cmsg_level, M_NOWAIT);
 			if (*controlp == NULL) {
 				error = ENOBUFS;
 				goto next;
@@ -2222,7 +2222,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 		 * Fill in credential information.
 		 */
 		case SCM_CREDS:
-			*controlp = sbcreatecontrol_how(NULL, sizeof(*cmcred),
+			*controlp = sbcreatecontrol(NULL, sizeof(*cmcred),
 			    SCM_CREDS, SOL_SOCKET, M_WAITOK);
 			cmcred = (struct cmsgcred *)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
@@ -2266,7 +2266,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 			 * file structure and capability rights.
 			 */
 			newlen = oldfds * sizeof(fdep[0]);
-			*controlp = sbcreatecontrol_how(NULL, newlen,
+			*controlp = sbcreatecontrol(NULL, newlen,
 			    SCM_RIGHTS, SOL_SOCKET, M_WAITOK);
 			fdp = data;
 			for (i = 0; i < oldfds; i++, fdp++) {
@@ -2298,7 +2298,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 			break;
 
 		case SCM_TIMESTAMP:
-			*controlp = sbcreatecontrol_how(NULL, sizeof(*tv),
+			*controlp = sbcreatecontrol(NULL, sizeof(*tv),
 			    SCM_TIMESTAMP, SOL_SOCKET, M_WAITOK);
 			tv = (struct timeval *)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
@@ -2306,7 +2306,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 			break;
 
 		case SCM_BINTIME:
-			*controlp = sbcreatecontrol_how(NULL, sizeof(*bt),
+			*controlp = sbcreatecontrol(NULL, sizeof(*bt),
 			    SCM_BINTIME, SOL_SOCKET, M_WAITOK);
 			bt = (struct bintime *)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
@@ -2314,7 +2314,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 			break;
 
 		case SCM_REALTIME:
-			*controlp = sbcreatecontrol_how(NULL, sizeof(*ts),
+			*controlp = sbcreatecontrol(NULL, sizeof(*ts),
 			    SCM_REALTIME, SOL_SOCKET, M_WAITOK);
 			ts = (struct timespec *)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
@@ -2322,7 +2322,7 @@ unp_internalize(struct mbuf **controlp, struct thread *td)
 			break;
 
 		case SCM_MONOTONIC:
-			*controlp = sbcreatecontrol_how(NULL, sizeof(*ts),
+			*controlp = sbcreatecontrol(NULL, sizeof(*ts),
 			    SCM_MONOTONIC, SOL_SOCKET, M_WAITOK);
 			ts = (struct timespec *)
 			    CMSG_DATA(mtod(*controlp, struct cmsghdr *));
@@ -2370,7 +2370,7 @@ unp_addsockcred(struct thread *td, struct mbuf *control, int mode)
 		cmsgtype = SCM_CREDS;
 	}
 
-	m = sbcreatecontrol(NULL, ctrlsz, cmsgtype, SOL_SOCKET);
+	m = sbcreatecontrol(NULL, ctrlsz, cmsgtype, SOL_SOCKET, M_NOWAIT);
 	if (m == NULL)
 		return (control);
 
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
index 59bacf8c965b..03894464a69a 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
@@ -460,16 +460,16 @@ ng_btsocket_hci_raw_savctl(ng_btsocket_hci_raw_pcb_p pcb, struct mbuf **ctl,
 
 	if (pcb->flags & NG_BTSOCKET_HCI_RAW_DIRECTION) {
 		dir = (m->m_flags & M_PROTO1)? 1 : 0;
-		*ctl = sbcreatecontrol((caddr_t) &dir, sizeof(dir),
-					SCM_HCI_RAW_DIRECTION, SOL_HCI_RAW);
+		*ctl = sbcreatecontrol(&dir, sizeof(dir),
+		    SCM_HCI_RAW_DIRECTION, SOL_HCI_RAW, M_NOWAIT);
 		if (*ctl != NULL)
 			ctl = &((*ctl)->m_next);
 	}
 
 	if (pcb->so->so_options & SO_TIMESTAMP) {
 		microtime(&tv);
-		*ctl = sbcreatecontrol((caddr_t) &tv, sizeof(tv),
-					SCM_TIMESTAMP, SOL_SOCKET);
+		*ctl = sbcreatecontrol(&tv, sizeof(tv), SCM_TIMESTAMP,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*ctl != NULL)
 			ctl = &((*ctl)->m_next);
 	}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 7c365b2e51b8..e1029920c95f 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1167,8 +1167,8 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 		} else {
 			bintime(&bt);
 		}
-		*mp = sbcreatecontrol((caddr_t)&bt, sizeof(bt),
-		    SCM_BINTIME, SOL_SOCKET);
+		*mp = sbcreatecontrol(&bt, sizeof(bt), SCM_BINTIME,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*mp != NULL) {
 			mp = &(*mp)->m_next;
 			stamped = true;
@@ -1189,8 +1189,8 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 		} else {
 			microtime(&tv);
 		}
-		*mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv),
-		    SCM_TIMESTAMP, SOL_SOCKET);
+		*mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv), SCM_TIMESTAMP,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*mp != NULL) {
 			mp = &(*mp)->m_next;
 			stamped = true;
@@ -1208,8 +1208,8 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 		} else {
 			nanotime(&ts);
 		}
-		*mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts),
-		    SCM_REALTIME, SOL_SOCKET);
+		*mp = sbcreatecontrol(&ts, sizeof(ts), SCM_REALTIME,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*mp != NULL) {
 			mp = &(*mp)->m_next;
 			stamped = true;
@@ -1222,8 +1222,8 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 			mbuf_tstmp2timespec(m, &ts);
 		else
 			nanouptime(&ts);
-		*mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts),
-		    SCM_MONOTONIC, SOL_SOCKET);
+		*mp = sbcreatecontrol(&ts, sizeof(ts), SCM_MONOTONIC,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*mp != NULL) {
 			mp = &(*mp)->m_next;
 			stamped = true;
@@ -1237,20 +1237,20 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 		sti.st_info_flags = ST_INFO_HW;
 		if ((m->m_flags & M_TSTMP_HPREC) != 0)
 			sti.st_info_flags |= ST_INFO_HW_HPREC;
-		*mp = sbcreatecontrol((caddr_t)&sti, sizeof(sti), SCM_TIME_INFO,
-		    SOL_SOCKET);
+		*mp = sbcreatecontrol(&sti, sizeof(sti), SCM_TIME_INFO,
+		    SOL_SOCKET, M_NOWAIT);
 		if (*mp != NULL)
 			mp = &(*mp)->m_next;
 	}
 	if (inp->inp_flags & INP_RECVDSTADDR) {
-		*mp = sbcreatecontrol((caddr_t)&ip->ip_dst,
-		    sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP);
+		*mp = sbcreatecontrol(&ip->ip_dst, sizeof(struct in_addr),
+		    IP_RECVDSTADDR, IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
 	if (inp->inp_flags & INP_RECVTTL) {
-		*mp = sbcreatecontrol((caddr_t)&ip->ip_ttl,
-		    sizeof(u_char), IP_RECVTTL, IPPROTO_IP);
+		*mp = sbcreatecontrol(&ip->ip_ttl, sizeof(u_char), IP_RECVTTL,
+		    IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1261,15 +1261,15 @@ ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
 	 */
 	/* options were tossed already */
 	if (inp->inp_flags & INP_RECVOPTS) {
-		*mp = sbcreatecontrol((caddr_t)opts_deleted_above,
-		    sizeof(struct in_addr), IP_RECVOPTS, IPPROTO_IP);
+		*mp = sbcreatecontrol(opts_deleted_above,
+		    sizeof(struct in_addr), IP_RECVOPTS, IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
 	/* ip_srcroute doesn't do what we want here, need to fix */
 	if (inp->inp_flags & INP_RECVRETOPTS) {
-		*mp = sbcreatecontrol((caddr_t)ip_srcroute(m),
-		    sizeof(struct in_addr), IP_RECVRETOPTS, IPPROTO_IP);
+		*mp = sbcreatecontrol(ip_srcroute(m), sizeof(struct in_addr),
+		    IP_RECVRETOPTS, IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1301,14 +1301,14 @@ makedummy:
 			sdl2->sdl_index = 0;
 			sdl2->sdl_nlen = sdl2->sdl_alen = sdl2->sdl_slen = 0;
 		}
-		*mp = sbcreatecontrol((caddr_t)sdl2, sdl2->sdl_len,
-		    IP_RECVIF, IPPROTO_IP);
+		*mp = sbcreatecontrol(sdl2, sdl2->sdl_len, IP_RECVIF,
+		    IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
 	if (inp->inp_flags & INP_RECVTOS) {
-		*mp = sbcreatecontrol((caddr_t)&ip->ip_tos,
-		    sizeof(u_char), IP_RECVTOS, IPPROTO_IP);
+		*mp = sbcreatecontrol(&ip->ip_tos, sizeof(u_char), IP_RECVTOS,
+		    IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1323,12 +1323,12 @@ makedummy:
 		 * XXX should handle the failure of one or the
 		 * other - don't populate both?
 		 */
-		*mp = sbcreatecontrol((caddr_t) &flowid,
-		    sizeof(uint32_t), IP_FLOWID, IPPROTO_IP);
+		*mp = sbcreatecontrol(&flowid, sizeof(uint32_t), IP_FLOWID,
+		    IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
-		*mp = sbcreatecontrol((caddr_t) &flow_type,
-		    sizeof(uint32_t), IP_FLOWTYPE, IPPROTO_IP);
+		*mp = sbcreatecontrol(&flow_type, sizeof(uint32_t),
+		    IP_FLOWTYPE, IPPROTO_IP, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1342,8 +1342,8 @@ makedummy:
 		flow_type = M_HASHTYPE_GET(m);
 
 		if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) {
-			*mp = sbcreatecontrol((caddr_t) &rss_bucketid,
-			   sizeof(uint32_t), IP_RSSBUCKETID, IPPROTO_IP);
+			*mp = sbcreatecontrol(&rss_bucketid, sizeof(uint32_t),
+			    IP_RSSBUCKETID, IPPROTO_IP, M_NOWAIT);
 			if (*mp)
 				mp = &(*mp)->m_next;
 		}
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index f35ba81f3936..3b3bb71339d4 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -327,8 +327,9 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off,
 			ip_savecontrol(inp, &opts, ip, n);
 	}
 	if ((inp->inp_vflag & INP_IPV4) && (inp->inp_flags2 & INP_ORIGDSTADDR)) {
-		tmpopts = sbcreatecontrol((caddr_t)&udp_in[1],
-			sizeof(struct sockaddr_in), IP_ORIGDSTADDR, IPPROTO_IP);
+		tmpopts = sbcreatecontrol(&udp_in[1],
+		    sizeof(struct sockaddr_in), IP_ORIGDSTADDR, IPPROTO_IP,
+		    M_NOWAIT);
 		if (tmpopts) {
 			if (opts) {
 				tmpopts->m_next = opts;
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 3a13d2a9dc74..9835dc495f09 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1216,8 +1216,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 			} else {
 				microtime(&t.tv);
 			}
-			*mp = sbcreatecontrol((caddr_t) &t.tv, sizeof(t.tv),
-			    SCM_TIMESTAMP, SOL_SOCKET);
+			*mp = sbcreatecontrol(&t.tv, sizeof(t.tv),
+			    SCM_TIMESTAMP, SOL_SOCKET, M_NOWAIT);
 			if (*mp != NULL) {
 				mp = &(*mp)->m_next;
 				stamped = true;
@@ -1234,8 +1234,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 			} else {
 				bintime(&t.bt);
 			}
-			*mp = sbcreatecontrol((caddr_t)&t.bt, sizeof(t.bt),
-			    SCM_BINTIME, SOL_SOCKET);
+			*mp = sbcreatecontrol(&t.bt, sizeof(t.bt), SCM_BINTIME,
+			    SOL_SOCKET, M_NOWAIT);
 			if (*mp != NULL) {
 				mp = &(*mp)->m_next;
 				stamped = true;
@@ -1252,8 +1252,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 			} else {
 				nanotime(&t.ts);
 			}
-			*mp = sbcreatecontrol((caddr_t)&t.ts, sizeof(t.ts),
-			    SCM_REALTIME, SOL_SOCKET);
+			*mp = sbcreatecontrol(&t.ts, sizeof(t.ts),
+			    SCM_REALTIME, SOL_SOCKET, M_NOWAIT);
 			if (*mp != NULL) {
 				mp = &(*mp)->m_next;
 				stamped = true;
@@ -1266,8 +1266,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 				mbuf_tstmp2timespec(m, &t.ts);
 			else
 				nanouptime(&t.ts);
-			*mp = sbcreatecontrol((caddr_t)&t.ts, sizeof(t.ts),
-			    SCM_MONOTONIC, SOL_SOCKET);
+			*mp = sbcreatecontrol(&t.ts, sizeof(t.ts),
+			    SCM_MONOTONIC, SOL_SOCKET, M_NOWAIT);
 			if (*mp != NULL) {
 				mp = &(*mp)->m_next;
 				stamped = true;
@@ -1285,8 +1285,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 			sti.st_info_flags = ST_INFO_HW;
 			if ((m->m_flags & M_TSTMP_HPREC) != 0)
 				sti.st_info_flags |= ST_INFO_HW_HPREC;
-			*mp = sbcreatecontrol((caddr_t)&sti, sizeof(sti),
-			    SCM_TIME_INFO, SOL_SOCKET);
+			*mp = sbcreatecontrol(&sti, sizeof(sti), SCM_TIME_INFO,
+			    SOL_SOCKET, M_NOWAIT);
 			if (*mp != NULL)
 				mp = &(*mp)->m_next;
 		}
@@ -1318,9 +1318,9 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 		pi6.ipi6_ifindex =
 		    (m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0;
 
-		*mp = sbcreatecontrol((caddr_t) &pi6,
-		    sizeof(struct in6_pktinfo),
-		    IS2292(inp, IPV6_2292PKTINFO, IPV6_PKTINFO), IPPROTO_IPV6);
+		*mp = sbcreatecontrol(&pi6, sizeof(struct in6_pktinfo),
+		    IS2292(inp, IPV6_2292PKTINFO, IPV6_PKTINFO), IPPROTO_IPV6,
+		    M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1341,9 +1341,9 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 		} else {
 			hlim = ip6->ip6_hlim & 0xff;
 		}
-		*mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int),
+		*mp = sbcreatecontrol(&hlim, sizeof(int),
 		    IS2292(inp, IPV6_2292HOPLIMIT, IPV6_HOPLIMIT),
-		    IPPROTO_IPV6);
+		    IPPROTO_IPV6, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1368,8 +1368,8 @@ ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
 			flowinfo >>= 20;
 			tclass = flowinfo & 0xff;
 		}
-		*mp = sbcreatecontrol((caddr_t) &tclass, sizeof(int),
-		    IPV6_TCLASS, IPPROTO_IPV6);
+		*mp = sbcreatecontrol(&tclass, sizeof(int), IPV6_TCLASS,
+		    IPPROTO_IPV6, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1425,9 +1425,9 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 			 * RFC2292.
 			 * Note: this constraint is removed in RFC3542
 			 */
-			*mp = sbcreatecontrol((caddr_t)hbh, hbhlen,
+			*mp = sbcreatecontrol(hbh, hbhlen,
 			    IS2292(inp, IPV6_2292HOPOPTS, IPV6_HOPOPTS),
-			    IPPROTO_IPV6);
+			    IPPROTO_IPV6, M_NOWAIT);
 			if (*mp)
 				mp = &(*mp)->m_next;
 		}
@@ -1476,10 +1476,9 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 				if (!(inp->inp_flags & IN6P_DSTOPTS))
 					break;
 
-				*mp = sbcreatecontrol((caddr_t)ip6e, elen,
-				    IS2292(inp,
-					IPV6_2292DSTOPTS, IPV6_DSTOPTS),
-				    IPPROTO_IPV6);
+				*mp = sbcreatecontrol(ip6e, elen,
+				    IS2292(inp, IPV6_2292DSTOPTS, IPV6_DSTOPTS),
+				    IPPROTO_IPV6, M_NOWAIT);
 				if (*mp)
 					mp = &(*mp)->m_next;
 				break;
@@ -1487,9 +1486,9 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 				if (!(inp->inp_flags & IN6P_RTHDR))
 					break;
 
-				*mp = sbcreatecontrol((caddr_t)ip6e, elen,
+				*mp = sbcreatecontrol(ip6e, elen,
 				    IS2292(inp, IPV6_2292RTHDR, IPV6_RTHDR),
-				    IPPROTO_IPV6);
+				    IPPROTO_IPV6, M_NOWAIT);
 				if (*mp)
 					mp = &(*mp)->m_next;
 				break;
@@ -1526,12 +1525,12 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 		 * XXX should handle the failure of one or the
 		 * other - don't populate both?
 		 */
-		*mp = sbcreatecontrol((caddr_t) &flowid,
-		    sizeof(uint32_t), IPV6_FLOWID, IPPROTO_IPV6);
+		*mp = sbcreatecontrol(&flowid, sizeof(uint32_t), IPV6_FLOWID,
+		    IPPROTO_IPV6, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
-		*mp = sbcreatecontrol((caddr_t) &flow_type,
-		    sizeof(uint32_t), IPV6_FLOWTYPE, IPPROTO_IPV6);
+		*mp = sbcreatecontrol(&flow_type, sizeof(uint32_t),
+		    IPV6_FLOWTYPE, IPPROTO_IPV6, M_NOWAIT);
 		if (*mp)
 			mp = &(*mp)->m_next;
 	}
@@ -1545,8 +1544,8 @@ ip6_savecontrol(struct inpcb *inp, struct mbuf *m, struct mbuf **mp)
 		flow_type = M_HASHTYPE_GET(m);
 
 		if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) {
-			*mp = sbcreatecontrol((caddr_t) &rss_bucketid,
-			   sizeof(uint32_t), IPV6_RSSBUCKETID, IPPROTO_IPV6);
+			*mp = sbcreatecontrol(&rss_bucketid, sizeof(uint32_t),
+			    IPV6_RSSBUCKETID, IPPROTO_IPV6, M_NOWAIT);
 			if (*mp)
 				mp = &(*mp)->m_next;
 		}
@@ -1583,8 +1582,8 @@ ip6_notify_pmtu(struct inpcb *inp, struct sockaddr_in6 *dst, u_int32_t mtu)
 	if (sa6_recoverscope(&mtuctl.ip6m_addr))
 		return;
 
-	if ((m_mtu = sbcreatecontrol((caddr_t)&mtuctl, sizeof(mtuctl),
-	    IPV6_PATHMTU, IPPROTO_IPV6)) == NULL)
+	if ((m_mtu = sbcreatecontrol(&mtuctl, sizeof(mtuctl), IPV6_PATHMTU,
+	    IPPROTO_IPV6, M_NOWAIT)) == NULL)
 		return;
 
 	so =  inp->inp_socket;
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 20b78009854e..9b3bce7db7bc 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -183,8 +183,9 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off,
 	    inp->inp_socket->so_options & SO_TIMESTAMP)
 		ip6_savecontrol(inp, n, &opts);
 	if ((inp->inp_vflag & INP_IPV6) && (inp->inp_flags2 & INP_ORIGDSTADDR)) {
-		tmp_opts = sbcreatecontrol((caddr_t)&fromsa[1],
-                        sizeof(struct sockaddr_in6), IPV6_ORIGDSTADDR, IPPROTO_IPV6);
+		tmp_opts = sbcreatecontrol(&fromsa[1],
+		    sizeof(struct sockaddr_in6), IPV6_ORIGDSTADDR,
+		    IPPROTO_IPV6, M_NOWAIT);
                 if (tmp_opts) {
                         if (opts) {
                                 tmp_opts->m_next = opts;
diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h
index 2484407d557c..efa87b1f2378 100644
--- a/sys/sys/sockbuf.h
+++ b/sys/sys/sockbuf.h
@@ -158,10 +158,7 @@ void	sbappendrecord(struct sockbuf *sb, struct mbuf *m0);
 void	sbappendrecord_locked(struct sockbuf *sb, struct mbuf *m0);
 void	sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
 struct mbuf *
-	sbcreatecontrol(caddr_t p, int size, int type, int level);
-struct mbuf *
-	sbcreatecontrol_how(void *p, int size, int type, int level,
-	    int wait);
+	sbcreatecontrol(void *p, int size, int type, int level, int wait);
 void	sbdestroy(struct socket *, sb_which);
 void	sbdrop(struct sockbuf *sb, int len);
 void	sbdrop_locked(struct sockbuf *sb, int len);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205171711.24HHBwc3095372>