Page MenuHomeFreeBSD

D62413.1796435963.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62413.1796435963.diff

diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -2666,10 +2666,8 @@
/*
* Send to a socket from a kernel thread.
*
- * XXXGL: in almost all cases uio is NULL and the mbuf is supplied.
- * Exception is nfs/bootp_subr.c. It is arguable that the VNET context needs
- * to be set at all. This function should just boil down to a static inline
- * calling the protocol method.
+ * It is arguable that the VNET context needs to be set at all. This function
+ * should just boil down to a static inline calling the protocol method.
*/
int
sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -122,6 +122,8 @@
char file[128];
unsigned char vend[1222];
};
+_Static_assert(sizeof(struct bootp_packet) <= MCLBYTES,
+ "bootp packet does not fit in mbuf cluster");
struct bootpc_ifcontext {
STAILQ_ENTRY(bootpc_ifcontext) next;
@@ -491,6 +493,7 @@
time_t rtimo;
struct timeval tv;
struct bootpc_ifcontext *ifctx;
+ struct mbuf *m;
int outstanding;
int gotrootpath;
int retry;
@@ -624,17 +627,6 @@
ifctx->sentmsg = 1;
}
- aio.iov_base = (caddr_t) &ifctx->call;
- aio.iov_len = sizeof(ifctx->call);
-
- auio.uio_iov = &aio;
- auio.uio_iovcnt = 1;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_rw = UIO_WRITE;
- auio.uio_offset = 0;
- auio.uio_resid = sizeof(ifctx->call);
- auio.uio_td = td;
-
/* Set netmask to 0.0.0.0 */
clear_sinaddr(sin);
error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra,
@@ -643,8 +635,12 @@
panic("%s: SIOCAIFADDR, error=%d", __func__,
error);
- error = sosend(bootp_so, (struct sockaddr *) &dst,
- &auio, NULL, NULL, 0, td);
+ m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR);
+ memcpy(mtod(m, void *), &ifctx->call,
+ sizeof(ifctx->call));
+ m->m_pkthdr.len = m->m_len = sizeof(ifctx->call);
+ error = sosend(bootp_so, (struct sockaddr *)&dst, NULL,
+ m, NULL, 0, td);
if (error != 0)
printf("%s: sosend: %d state %08x\n", __func__,
error, (int )bootp_so->so_state);

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 5, 1:59 AM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42217049
Default Alt Text
D62413.1796435963.diff (2 KB)

Event Timeline