summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorcsgr <csgr@FreeBSD.org>1999-08-17 12:17:53 +0000
committercsgr <csgr@FreeBSD.org>1999-08-17 12:17:53 +0000
commit83e27dbadf6d54c9da1816d9e50aa2e0c77cfa3b (patch)
treeb282b74566f8902c296b6e7653f92505d2358c3f /sys/netinet/udp_usrreq.c
parentcf21d97ccd6296e40a082b743e278c15c6174ed9 (diff)
downloadFreeBSD-src-83e27dbadf6d54c9da1816d9e50aa2e0c77cfa3b.zip
FreeBSD-src-83e27dbadf6d54c9da1816d9e50aa2e0c77cfa3b.tar.gz
Add net.inet.tcp.blackhole and net.inet.udp.blackhole
sysctl knobs. With these knobs on, refused connection attempts are dropped without sending a RST, or Port unreachable in the UDP case. In the TCP case, sending of RST is inhibited iff the incoming segment was a SYN. Docs and rc.conf settings to follow.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 52da6ab..7076491 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
- * $Id: udp_usrreq.c,v 1.52 1999/06/19 18:43:33 green Exp $
+ * $Id: udp_usrreq.c,v 1.53 1999/07/11 18:32:46 green Exp $
*/
#include <sys/param.h>
@@ -78,6 +78,10 @@ static int log_in_vain = 0;
SYSCTL_INT(_net_inet_udp, OID_AUTO, log_in_vain, CTLFLAG_RW,
&log_in_vain, 0, "Log all incoming UDP packets");
+static int blackhole = 0;
+SYSCTL_INT(_net_inet_udp, OID_AUTO, blackhole, CTLFLAG_RW,
+ &blackhole, 0, "Do not send port unreachables for refused connects");
+
static struct inpcbhead udb; /* from udp_var.h */
struct inpcbinfo udbinfo;
@@ -302,7 +306,8 @@ udp_input(m, iphlen)
if (badport_bandlim(0) < 0)
goto bad;
#endif
- icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0);
+ if(!blackhole)
+ icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0);
return;
}
OpenPOWER on IntegriCloud