reviewed: bwelling

1241.   [bug]           Drop received UDP messsages with a zero source port
                        as these are invariably forged. [RT #2621]
This commit is contained in:
Mark Andrews
2002-07-10 00:04:57 +00:00
parent 7d73f463e2
commit f324e3cfdf
4 changed files with 29 additions and 5 deletions
+3
View File
@@ -43,6 +43,9 @@
1273. [bug] The dnssec system test failed to remove the correct
files.
1241. [bug] Drop received UDP messsages with a zero source port
as these are invariably forged. [RT #2621]
--- 9.2.1 released ---
1271. [port] win32: a make file contained absolute version specific
+2 -1
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: msgs.h,v 1.5 2001/04/26 23:45:55 gson Exp $ */
/* $Id: msgs.h,v 1.5.2.1 2002/07/10 00:04:53 marka Exp $ */
#ifndef ISC_MSGS_H
#define ISC_MSGS_H 1
@@ -144,6 +144,7 @@
#define ISC_MSG_BOUND 1417 /* "bound" */
#define ISC_MSG_ACCEPTRETURNED 1418 /* accept() returned %d/%s */
#define ISC_MSG_TOOMANYFDS 1419 /* %s: too many open file descriptors */
#define ISC_MSG_ZEROPORT 1420 /* dropping source port zero packet */
#define ISC_MSG_AWAKE 1502 /* "awake" */
#define ISC_MSG_WORKING 1503 /* "working" */
+12 -2
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.207.2.10 2002/03/20 20:56:44 marka Exp $ */
/* $Id: socket.c,v 1.207.2.11 2002/07/10 00:04:55 marka Exp $ */
#include <config.h>
@@ -948,8 +948,18 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
if ((sock->type == isc_sockettype_tcp) && (cc == 0))
return (DOIO_EOF);
if (sock->type == isc_sockettype_udp)
if (sock->type == isc_sockettype_udp) {
dev->address.length = msghdr.msg_namelen;
if (isc_sockaddr_getport(&dev->address) == 0) {
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
socket_log(sock, &dev->address, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_ZEROPORT,
"dropping source port zero packet");
}
return (DOIO_SOFT);
}
}
socket_log(sock, &dev->address, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PKTRECV,
+12 -2
View File
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.5.2.5 2002/02/19 00:40:09 marka Exp $ */
/* $Id: socket.c,v 1.5.2.6 2002/07/10 00:04:57 marka Exp $ */
#define MAKE_EXTERNAL 1
@@ -1057,8 +1057,18 @@ doio_recv(isc_socket_t *sock, isc_socketevent_t *dev) {
if ((sock->type == isc_sockettype_tcp) && (cc == 0))
return (DOIO_EOF);
if (sock->type == isc_sockettype_udp)
if (sock->type == isc_sockettype_udp) {
dev->address.length = msghdr.msg_namelen;
if (isc_sockaddr_getport(&dev->address) == 0) {
if (isc_log_wouldlog(isc_lctx, IOEVENT_LEVEL)) {
socket_log(sock, &dev->address, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET,
ISC_MSG_ZEROPORT,
"dropping source port zero packet");
}
return (DOIO_SOFT);
}
}
socket_log(sock, &dev->address, IOEVENT,
isc_msgcat, ISC_MSGSET_SOCKET, ISC_MSG_PKTRECV,