diff -Nru netstat-nat-1.4.9/ChangeLog netstat-nat-1.4.10/ChangeLog --- netstat-nat-1.4.9/ChangeLog 2007-11-24 13:18:48.000000000 +0000 +++ netstat-nat-1.4.10/ChangeLog 2010-01-09 19:34:24.000000000 +0000 @@ -1,8 +1,11 @@ -$Id: ChangeLog,v 1.6 2007/11/24 13:18:48 danny Exp $ +$Id: ChangeLog,v 1.7 2010/01/09 19:34:24 danny Exp $ Changelog: -------------------------------------------------------------------------------- +version: 1.4.10 +- fix for properly display DNAT over SNAT connection + version: 1.4.9 - Added '-R' option to show routed connections instead of showing them with '-L' - Some allocation & free bugs were squashed diff -Nru netstat-nat-1.4.9/configure netstat-nat-1.4.10/configure --- netstat-nat-1.4.9/configure 2007-11-24 13:20:49.000000000 +0000 +++ netstat-nat-1.4.10/configure 2008-09-13 10:45:53.000000000 +0000 @@ -2028,7 +2028,7 @@ # Define the identity of the package. PACKAGE=netstat-nat - VERSION=1.4.9 + VERSION=1.4.10 cat >>confdefs.h <<_ACEOF diff -Nru netstat-nat-1.4.9/configure.in netstat-nat-1.4.10/configure.in --- netstat-nat-1.4.9/configure.in 2007-11-24 13:16:55.000000000 +0000 +++ netstat-nat-1.4.10/configure.in 2008-09-13 10:45:47.000000000 +0000 @@ -1,5 +1,5 @@ AC_INIT(netstat-nat.c) -AM_INIT_AUTOMAKE(netstat-nat,1.4.9) +AM_INIT_AUTOMAKE(netstat-nat,1.4.10) AC_PROG_CC AC_PROG_INSTALL AC_PREFIX_DEFAULT(/usr) diff -Nru netstat-nat-1.4.9/debian/changelog netstat-nat-1.4.10/debian/changelog --- netstat-nat-1.4.9/debian/changelog 2010-10-15 15:25:04.000000000 +0000 +++ netstat-nat-1.4.10/debian/changelog 2010-08-21 12:21:22.000000000 +0000 @@ -1,3 +1,22 @@ +netstat-nat (1.4.10-2) unstable; urgency=low + + * QA upload. + * debian/rules: Replace regular rule targets by dh override targets. + (Closes: #593769) + - Build-depend on debhelper >= 7.0.50~. + * Standards-Version bumped to 3.9.1. + + -- Johann Felix Soden Sat, 21 Aug 2010 14:21:13 +0200 + +netstat-nat (1.4.10-1) unstable; urgency=low + + * QA upload. + * New upstream release + * Convert package to the 3.0 (quilt) source format. + * Standards-Version bumped to 3.8.4. + + -- Johann Felix Soden Sun, 27 Jun 2010 10:14:30 +0200 + netstat-nat (1.4.9-2) unstable; urgency=low * QA upload. diff -Nru netstat-nat-1.4.9/debian/control netstat-nat-1.4.10/debian/control --- netstat-nat-1.4.9/debian/control 2010-10-15 15:25:04.000000000 +0000 +++ netstat-nat-1.4.10/debian/control 2010-08-21 11:40:40.000000000 +0000 @@ -2,8 +2,8 @@ Section: net Priority: optional Maintainer: Debian QA Group -Build-Depends: debhelper (>= 7), autotools-dev -Standards-Version: 3.8.3 +Build-Depends: debhelper (>= 7.0.50~), autotools-dev +Standards-Version: 3.9.1 Homepage: http://www.tweegy.nl/projects/netstat-nat/ Package: netstat-nat diff -Nru netstat-nat-1.4.9/debian/rules netstat-nat-1.4.10/debian/rules --- netstat-nat-1.4.9/debian/rules 2010-10-15 15:25:04.000000000 +0000 +++ netstat-nat-1.4.10/debian/rules 2010-08-21 12:14:04.000000000 +0000 @@ -6,13 +6,8 @@ %: dh $@ -build: - dh build --before dh_auto_test - dh build --after dh_auto_test - -binary: - dh binary --before dh_install +override_dh_auto_install: + dh_auto_install # W: netstat-nat: extra-license-file usr/share/doc/netstat-nat-1.4.9/COPYING.gz # W: netstat-nat: zero-byte-file-in-doc-directory usr/share/doc/netstat-nat-1.4.9/NEWS.gz - rm -rf debian/netstat-nat/usr/share/doc/netstat-nat-1.4.9/ - dh binary --remaining + rm -rf debian/netstat-nat/usr/share/doc/netstat-nat-*/ diff -Nru netstat-nat-1.4.9/debian/source/format netstat-nat-1.4.10/debian/source/format --- netstat-nat-1.4.9/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ netstat-nat-1.4.10/debian/source/format 2010-10-15 15:25:05.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru netstat-nat-1.4.9/netstat-nat.c netstat-nat-1.4.10/netstat-nat.c --- netstat-nat-1.4.9/netstat-nat.c 2007-11-24 13:18:48.000000000 +0000 +++ netstat-nat-1.4.10/netstat-nat.c 2010-01-09 19:34:24.000000000 +0000 @@ -1,9 +1,12 @@ /* #------------------------------------------------------------------------------- # -# $Id: netstat-nat.c,v 1.32 2007/11/24 13:18:48 danny Exp $ +# $Id: netstat-nat.c,v 1.33 2010/01/09 19:34:24 danny Exp $ # # $Log: netstat-nat.c,v $ +# Revision 1.33 2010/01/09 19:34:24 danny +# fix for properly display DNAT over SNAT connection +# # Revision 1.32 2007/11/24 13:18:48 danny # - Added '-R' option to show routed connections instead of showing them with '-L' # - Some allocation & free bugs were squashed @@ -178,7 +181,7 @@ } sIpAddresses; #include "netstat-nat.h" -static char const rcsid[] = "$Id: netstat-nat.c,v 1.32 2007/11/24 13:18:48 danny Exp $"; +static char const rcsid[] = "$Id: netstat-nat.c,v 1.33 2010/01/09 19:34:24 danny Exp $"; char SRC_IP[50]; char DST_IP[50]; int SNAT = 1; @@ -209,6 +212,7 @@ char from[50] = "NATed Address"; char nathost[50] = "NAT-host Address"; char dest[50] = "Destination Address"; + char *ret; char ***pa; char *store; @@ -221,9 +225,6 @@ char *ifbuf, *facename, *ptr; int facefound, lastlen, len, sock; //IpAddresses = NULL; - /* */ - - connection_table = (char ***) xcalloc((1) * sizeof(char **)); // check parameters while ((c = getopt(argc, argv, args)) != -1) { @@ -299,7 +300,8 @@ } // get local IP addresses if (ROUTED || LOCAL) { - /* find all interfaces */ + // find all interfaces + sock = socket(PF_INET, SOCK_DGRAM, 0); lastlen = 0; len = 100 * sizeof(struct ifreq); @@ -318,15 +320,15 @@ } } else { if(ifc.ifc_len == lastlen) - /* success */ + // success // break; lastlen = ifc.ifc_len; } - /* increment buffer */ + // increment buffer // len += 10 * sizeof(struct ifreq); free(ifbuf); } - /* store all local addresses in memory */ + // store all local addresses in memory // for(ptr = ifbuf; ptr < ifbuf + ifc.ifc_len; ) { req = (struct ifreq *)ptr; ipaddr = (struct sockaddr_in *) &req->ifr_addr; @@ -338,7 +340,8 @@ free(ifbuf); } } - + + connection_table = (char ***) xcalloc((1) * sizeof(char **)); // some checking for IPTables and read file if ((f = fopen(NF_CONNTRACK_LOCATION, "r")) == NULL) { if ((f = fopen(IP_CONNTRACK_LOCATION, "r")) == NULL) { @@ -373,21 +376,21 @@ // bugfix for proper read-in on some systems, provided by Supaflyster while (!feof(f)) { - fgets(line, sizeof(line), f); + ret = fgets(line, sizeof(line), f); if (strlen(line) > 0) { process_entry(line); } memset(line, 0, sizeof(line)); } - fclose(f); - - + // create index of arrays pointed to main connection array if (connection_index == 0) { - // There are no connections at this moment! + // There are no connections at this moment! free mem and exit + free(connection_table); + ip_addresses_free(&IpAddresses); return (0); - } + } pa = (char ***) xcalloc((connection_index) * sizeof(char **)); @@ -633,15 +636,21 @@ } if (DNAT) { if ((strcmp(srcip_f, dstip_s) == 0) && (!strcmp(dstip_f, srcip_s) == 0)) { - check_src_dst(protocol, srcip_f, srcip_s, srcport, dstport, dstip_f, dstport_s, state); + check_src_dst(protocol, srcip_f, srcip_s, srcport, srcport_s, dstip_f, dstport_s, state); } } - // bugfix for displaying dnat over snat connections, submiited by Supaflyster + // bugfix for displaying dnat over snat connections, submitted by Supaflyster (intercepted traffic to DNAT) (2 interfaces) if (DNAT || SNAT) { if ((!strcmp(srcip_f, srcip_s) == 0) && (!strcmp(srcip_f, dstip_s) == 0) && (!strcmp(dstip_f, srcip_s) == 0) && (!strcmp(dstip_f, dstip_s) == 0) ) { check_src_dst(protocol, srcip_f, srcip_s, srcport, srcport_s, dstip_s, dstport_s, state); } } + // (DNAT) (1 interface) + if (DNAT) { + if ((!strcmp(srcip_f, srcip_s) == 0) && (!strcmp(srcip_f, dstip_s) == 0) && (!strcmp(dstip_f, srcip_s) == 0) && (strcmp(dstip_f, dstip_s) == 0) ) { + check_src_dst(protocol, srcip_f, srcip_s, srcport, srcport_s, dstip_s, dstport_s, state); + } + } if (LOCAL) { if ((strcmp(srcip_f, dstip_s) == 0) && (strcmp(dstip_f, srcip_s) == 0) && ((ip_addresses_search(IpAddresses, srcip_f) == 1) || (ip_addresses_search(IpAddresses, srcip_s) == 1) @@ -987,7 +996,7 @@ void display_help() - { +{ printf("args: -h: displays this help\n"); printf(" -n: don't resolve host/portnames\n"); printf(" -p : display connections by protocol\n"); @@ -1005,7 +1014,7 @@ printf("\n"); printf(" netstat-nat [-S|-D|-L|-R] [-no]\n"); printf(" netstat-nat [-nxo]\n"); - } +} // -- End of internal used functions