From owner-svn-src-user@FreeBSD.ORG Mon Jan 4 16:58:15 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 961D91065679; Mon, 4 Jan 2010 16:58:15 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 834948FC1C; Mon, 4 Jan 2010 16:58:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o04GwFHV023756; Mon, 4 Jan 2010 16:58:15 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o04GwFfG023749; Mon, 4 Jan 2010 16:58:15 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201001041658.o04GwFfG023749@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 4 Jan 2010 16:58:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201517 - in user/luigi/ipfw3-head/sys/netinet: . ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2010 16:58:15 -0000 Author: luigi Date: Mon Jan 4 16:58:15 2010 New Revision: 201517 URL: http://svn.freebsd.org/changeset/base/201517 Log: divert has no specific API so we don't really need an ip_divert.h Modified: user/luigi/ipfw3-head/sys/netinet/ip_divert.c user/luigi/ipfw3-head/sys/netinet/ip_divert.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_sockopt.c Modified: user/luigi/ipfw3-head/sys/netinet/ip_divert.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_divert.c Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ip_divert.c Mon Jan 4 16:58:15 2010 (r201517) @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef SCTP #include #endif @@ -194,7 +193,7 @@ div_destroy(void) * IPPROTO_DIVERT is not in the real IP protocol number space; this * function should never be called. Just in case, drop any packets. */ -void +static void div_input(struct mbuf *m, int off) { @@ -596,7 +595,7 @@ div_send(struct socket *so, int flags, s return div_output(so, m, (struct sockaddr_in *)nam, control); } -void +static void div_ctlinput(int cmd, struct sockaddr *sa, void *vip) { struct in_addr faddr; @@ -809,5 +808,5 @@ static moduledata_t ipdivertmod = { }; DECLARE_MODULE(ipdivert, ipdivertmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); -MODULE_DEPEND(dummynet, ipfw, 2, 2, 2); +MODULE_DEPEND(ipdivert, ipfw, 2, 2, 2); MODULE_VERSION(ipdivert, 1); Modified: user/luigi/ipfw3-head/sys/netinet/ip_divert.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ip_divert.h Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ip_divert.h Mon Jan 4 16:58:15 2010 (r201517) @@ -36,28 +36,20 @@ #define _NETINET_IP_DIVERT_H_ /* - * Sysctl declaration. + * divert has no custom kernel-userland API. + * + * All communication occurs through a sockaddr_in socket where + * + * kernel-->userland + * sin_port = matching rule, host format; + * sin_addr = IN: first address of the incoming interface; + * OUT: INADDR_ANY + * sin_zero = if fits, the interface name (max 7 bytes + NUL) + * + * userland->kernel + * sin_port = restart-rule - 1, host order + * (we restart at sin_port + 1) + * sin_addr = IN: address of the incoming interface; + * OUT: INADDR_ANY */ -#ifdef SYSCTL_DECL -SYSCTL_DECL(_net_inet_divert); -#endif - -/* - * Divert socket definitions. - */ - -/* - * Return the divert cookie associated with the mbuf; if any. - */ -static __inline u_int16_t -divert_cookie(struct m_tag *mtag) -{ - return ((struct ipfw_rule_ref *)(mtag+1))->rulenum; -} - -typedef void ip_divert_packet_t(struct mbuf *m, int incoming); -extern ip_divert_packet_t *ip_divert_ptr; - -extern void div_input(struct mbuf *, int); -extern void div_ctlinput(int, struct sockaddr *, void *); #endif /* _NETINET_IP_DIVERT_H_ */ Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw2.c Mon Jan 4 16:58:15 2010 (r201517) @@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Mon Jan 4 16:58:15 2010 (r201517) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -76,7 +75,7 @@ static VNET_DEFINE(int, fw6_enable) = 1; int ipfw_chg_hook(SYSCTL_HANDLER_ARGS); /* Divert hooks. */ -ip_divert_packet_t *ip_divert_ptr = NULL; +void (*ip_divert_ptr)(struct mbuf *m, int incoming); /* ng_ipfw hooks. */ ng_ipfw_input_t *ng_ipfw_input_p = NULL; Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_private.h Mon Jan 4 16:58:15 2010 (r201517) @@ -289,6 +289,9 @@ int ipfw_del_table_entry(struct ip_fw_ch int ipfw_count_table(struct ip_fw_chain *ch, uint32_t tbl, uint32_t *cnt); int ipfw_dump_table(struct ip_fw_chain *ch, ipfw_table *tbl); +/* hooks for divert */ +extern void (*ip_divert_ptr)(struct mbuf *m, int incoming); + /* In ip_fw_nat.c */ extern struct cfg_nat *(*lookup_nat_ptr)(struct nat_list *, int); Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_sockopt.c Mon Jan 4 16:03:26 2010 (r201516) +++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_sockopt.c Mon Jan 4 16:58:15 2010 (r201517) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef MAC #include