Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2001 00:18:08 -0500 (CDT)
From:      Jonathan Lemon <jlemon@flugsvamp.com>
To:        knotwell@ix.netcom.com, bugs@freebsd.org
Subject:   Re: kern/30634: kevent.data value incorrect for UDP sockets
Message-ID:  <200109200518.f8K5I8e08579@prism.flugsvamp.com>
In-Reply-To: <local.mail.freebsd-bugs/200109171730.f8HHUub00713@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <local.mail.freebsd-bugs/200109171730.f8HHUub00713@freefall.freebsd.org> you write:
>>Description:
>When kevent returns a read event for a UDP socket, the data field (AKA
>the number of bytes to be read) is 16 bytes too long.

This is happening because UDP places the sockaddr of the sending
host in the data buffer.  16 bytes == sizeof(struct sockaddr_in).

There isn't a quick fix for this because the kernel doesn't keep
the data and addresses separate; there is only a single counter to
indicate how much data is in the buffer.  Getting an accurate count
of the data would require walking the mbuf buffer chain (expensive)
or changing the code to keep track of the counts separately.
-- 
Jonathan

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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