From owner-p4-projects@FreeBSD.ORG Sat Aug 18 03:04:36 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0862A16A41B; Sat, 18 Aug 2007 03:04:36 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8592616A418 for ; Sat, 18 Aug 2007 03:04:35 +0000 (UTC) (envelope-from mharvan@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7131F13C480 for ; Sat, 18 Aug 2007 03:04:35 +0000 (UTC) (envelope-from mharvan@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l7I34Zak051725 for ; Sat, 18 Aug 2007 03:04:35 GMT (envelope-from mharvan@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l7I34Z1L051722 for perforce@freebsd.org; Sat, 18 Aug 2007 03:04:35 GMT (envelope-from mharvan@FreeBSD.org) Date: Sat, 18 Aug 2007 03:04:35 GMT Message-Id: <200708180304.l7I34Z1L051722@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mharvan@FreeBSD.org using -f From: Matus Harvan To: Perforce Change Reviews Cc: Subject: PERFORCE change 125285 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Aug 2007 03:04:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=125285 Change 125285 by mharvan@mharvan_bike-planet on 2007/08/18 03:03:36 tcp plugin uses TCP_CATCHALL, i.e., listens on all unused ports Affected files ... .. //depot/projects/soc2007/mharvan-mtund/mtund.src/mtund.c#5 edit .. //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_tcp.c#13 edit Differences ... ==== //depot/projects/soc2007/mharvan-mtund/mtund.src/mtund.c#5 (text+ko) ==== @@ -1191,13 +1191,7 @@ /* pl = load_plugin("./plugin_udp.so"); */ /* pl->name = "udp_catchall_1234"; */ pl = load_plugin("./plugin_tcp.so"); - pl->name = "tcp_25"; - pl = load_plugin("./plugin_tcp.so"); - pl->name = "tcp_80"; - pl = load_plugin("./plugin_tcp.so"); - pl->name = "tcp_110"; -/* pl = load_plugin("./plugin_tcp.so"); */ -/* pl->name = "tcp_catchall_1234"; */ + pl->name = "tcp_1234"; pl = load_plugin("./plugin_icmp.so"); pl->name = "icmp"; ==== //depot/projects/soc2007/mharvan-mtund/mtund.src/plugin_tcp.c#13 (text+ko) ==== @@ -12,11 +12,15 @@ #include #include +#include +#include + #include "mtund.h" #include "plugin.h" #define MAXTMPCONNS 10 #define TEMP_CONN_TIMEOUT 5 +#define USE_TCP_CATCHALL 1 enum { CONN_STATUS_FREE, /* connection not in use */ @@ -283,9 +287,17 @@ data->tmpconns[i].data = data; } data->conn = NULL; - + if (server) { data->conns->fd = tcp_listen(port); + /* enable TCP_CATCHALL */ + if (USE_TCP_CATCHALL != 0) { + int soval = 1; + if (0 != setsockopt(data->conns->fd, IPPROTO_TCP, + TCP_CATCHALL, &soval, sizeof(soval))) + warnx("setsockopt(TCP_CATCHALL) failed\n"); + } + event_set(&data->conns->ev, data->conns->fd, EV_PERSIST | EV_READ, plugin_accept_new_conn, data->conns); if (data->conns->fd != -1) {