From owner-freebsd-questions Wed Feb 27 4:14:20 2002 Delivered-To: freebsd-questions@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 4720F37B400 for ; Wed, 27 Feb 2002 04:14:05 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g1RCDKD40726; Wed, 27 Feb 2002 14:13:20 +0200 (EET) (envelope-from ru) Date: Wed, 27 Feb 2002 14:13:20 +0200 From: Ruslan Ermilov To: Joao Carlos Cc: questions@FreeBSD.ORG Subject: Re: list of active translations on natd Message-ID: <20020227121320.GE30220@sunbay.com> References: <007b01c1b59d$567e8670$35ccb0c8@pchome> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <007b01c1b59d$567e8670$35ccb0c8@pchome> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 14, 2002 at 06:19:48PM -0300, Joao Carlos wrote: > Is there any way to list the active translations that NATD is doing? > Something like `ipchains -L -M` on Linux. > Not, without applying some patches. Cheers, -- Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: libalias/alias.h =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias.h,v retrieving revision 1.22 diff -u -p -r1.22 alias.h --- libalias/alias.h 2001/11/03 11:34:09 1.22 +++ libalias/alias.h 2001/11/28 14:54:12 @@ -90,6 +90,7 @@ int PacketAliasCheckNewLink(void); unsigned short PacketAliasInternetChecksum(unsigned short *_ptr, int _nbytes); void PacketAliasSetTarget(struct in_addr _target_addr); +void PacketAliasDumpTable(void); /* Transparent proxying routines. */ int PacketAliasProxyRule(const char *_cmd); Index: libalias/alias_db.c =================================================================== RCS file: /home/ncvs/src/lib/libalias/alias_db.c,v retrieving revision 1.47 diff -u -p -r1.47 alias_db.c --- libalias/alias_db.c 2001/11/03 11:34:09 1.47 +++ libalias/alias_db.c 2001/11/28 14:54:22 @@ -2810,3 +2810,35 @@ PacketAliasSetFWBase(unsigned int base, fireWallNumNums = num; #endif } + +static void +DumpLink(FILE *where, const char *prefix, struct alias_link *link) +{ + + if (prefix != NULL) + fprintf(where, "%s: ", prefix); + fprintf(where, "T=%d,", link->link_type); + fprintf(where, "S=%s:%d,", + inet_ntoa(link->src_addr), ntohs(link->src_port)); + fprintf(where, "A=%s:%d,", + inet_ntoa(link->alias_addr), ntohs(link->alias_port)); + fprintf(where, "D=%s:%d\n", + inet_ntoa(link->dst_addr), ntohs(link->dst_port)); +} + +void +PacketAliasDumpTable(void) +{ + struct alias_link *link; + int i; + + if (monitorFile) + { + fprintf(monitorFile, "*** Dumping aliasing table ***\n"); + for (i=0; i