packages: iptraf/iptraf.spec, iptraf/iptraf-3.0.0-in_trafic.patch (NEW), ip...

arekm arekm at pld-linux.org
Sun Mar 20 22:30:54 CET 2011


Author: arekm                        Date: Sun Mar 20 21:30:54 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 3; fixes from fc

---- Files affected:
packages/iptraf:
   iptraf.spec (1.65 -> 1.66) , iptraf-3.0.0-in_trafic.patch (NONE -> 1.1)  (NEW), iptraf-3.0.1-compile.fix.patch (NONE -> 1.1)  (NEW), iptraf-3.0.1-ipv6-fix.patch (NONE -> 1.1)  (NEW), iptraf-3.0.1-ipv6.patch (NONE -> 1.1)  (NEW), iptraf-3.0.1-servmon-fix.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/iptraf/iptraf.spec
diff -u packages/iptraf/iptraf.spec:1.65 packages/iptraf/iptraf.spec:1.66
--- packages/iptraf/iptraf.spec:1.65	Sat Jan 29 01:06:46 2011
+++ packages/iptraf/iptraf.spec	Sun Mar 20 22:30:49 2011
@@ -7,7 +7,7 @@
 Summary(uk.UTF-8):	IPTraf - консольна програма моніторингу трафіку в мережі
 Name:		iptraf
 Version:	3.0.1
-Release:	2
+Release:	3
 License:	GPL
 Group:		Networking/Utilities
 Source0:	ftp://iptraf.seul.org/pub/iptraf/%{name}-%{version}.tar.gz
@@ -16,6 +16,12 @@
 Patch1:		%{name}-iface.patch
 Patch2:		%{name}-show_all_interfaces.patch
 Patch3:		%{name}-strcpy-overlap-memory.patch
+# from fc
+Patch4:		iptraf-3.0.1-compile.fix.patch
+Patch5:		iptraf-3.0.0-in_trafic.patch
+Patch6:		iptraf-3.0.1-ipv6.patch
+Patch7:		iptraf-3.0.1-ipv6-fix.patch
+Patch8:		iptraf-3.0.1-servmon-fix.patch
 URL:		http://iptraf.seul.org/
 BuildRequires:	ncurses-ext-devel >= 5.4
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -69,6 +75,11 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %build
 cd src
@@ -105,6 +116,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.66  2011/03/20 21:30:49  arekm
+- rel 3; fixes from fc
+
 Revision 1.65  2011/01/29 00:06:46  sparky
 - dropped pre-cvs changelog
 

================================================================
Index: packages/iptraf/iptraf-3.0.0-in_trafic.patch
diff -u /dev/null packages/iptraf/iptraf-3.0.0-in_trafic.patch:1.1
--- /dev/null	Sun Mar 20 22:30:54 2011
+++ packages/iptraf/iptraf-3.0.0-in_trafic.patch	Sun Mar 20 22:30:49 2011
@@ -0,0 +1,11 @@
+--- iptraf-3.0.0/src/serv.c.in	2006-12-11 11:13:27.000000000 +0100
++++ iptraf-3.0.0/src/serv.c	2006-12-11 11:12:49.000000000 +0100
+@@ -333,7 +333,7 @@
+         }
+ 
+         dport_listent->ibcount += br;
+-        dport_listent->spans.spanbr_out += br;
++        dport_listent->spans.spanbr_in += br;
+         dport_listent->icount++;
+     }
+     if (sport_listent != NULL || dport_listent != NULL) {

================================================================
Index: packages/iptraf/iptraf-3.0.1-compile.fix.patch
diff -u /dev/null packages/iptraf/iptraf-3.0.1-compile.fix.patch:1.1
--- /dev/null	Sun Mar 20 22:30:54 2011
+++ packages/iptraf/iptraf-3.0.1-compile.fix.patch	Sun Mar 20 22:30:49 2011
@@ -0,0 +1,77 @@
+diff -up iptraf-3.0.1/src/othptab.c.old iptraf-3.0.1/src/othptab.c
+--- iptraf-3.0.1/src/othptab.c.old	2007-09-25 11:47:35.000000000 +0200
++++ iptraf-3.0.1/src/othptab.c	2007-11-02 12:28:24.000000000 +0100
+@@ -19,10 +19,10 @@ details.
+ #include <stdlib.h>
+ #include <asm/types.h>
+ #include <sys/socket.h>
+-#include <linux/if_ether.h>
+-#include <linux/if_tr.h>
+-#include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
++#include <netinet/if_ether.h>
++#include <netinet/if_tr.h>
++#include <linux/netdevice.h>
++#include <netinet/if_fddi.h>
+ #include <winops.h>
+ #include "arphdr.h"
+ #include "options.h"
+diff -up iptraf-3.0.1/src/Makefile.old iptraf-3.0.1/src/Makefile
+--- iptraf-3.0.1/src/Makefile.old	2007-11-02 12:27:07.000000000 +0100
++++ iptraf-3.0.1/src/Makefile	2007-11-02 12:29:50.000000000 +0100
+@@ -18,7 +18,7 @@ VERSION 	= -DVERSION=\"$(VERNUMBER)\"
+ BINDIR		= ../../iptraf-$(VERNUMBER).bin.$(ARCH)
+ 
+ CC		= gcc
+-LIBS		= -L../support -ltextbox -lpanel -lncurses   # in this order!
++LIBS		= -L../support -ltextbox -lpanelw -lncursesw   # in this order!
+ 
+ # comment this one out to omit debug code when done.
+ 
+@@ -39,7 +39,7 @@ LDOPTS		= #-static
+ # you may want to change this to point to your ncurses include directory
+ # if the ncurses include files are not in the default location.
+ 
+-INCLUDEDIR	= -I/usr/include/ncurses -I../support
++INCLUDEDIR	= -I/usr/include/ncursesw -I../support
+ 
+ # You can uncomment this one to disable the backspace key in input fields.
+ # This means you must use the Del key or Ctrl+H combination to erase the
+@@ -162,7 +162,7 @@ install:
+ # and the compiled programs for release as a ready-to-run distribution.
+ 
+ dist-bin: all
+-	$(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) -L../support -ltextbox /usr/lib/libpanel.a /usr/lib/libncurses.a
++	$(CC) $(LDOPTS) $(PROF) -o iptraf $(OBJS) -L../support -ltextbox /usr/lib/libpanelw.a /usr/lib/libncursesw.a
+ 	rm -rf $(BINDIR)
+ 	mkdir $(BINDIR)
+ 	/bin/cp -p ../CHANGES ../LICENSE ../FAQ ../INSTALL ../README* \
+@@ -178,7 +178,7 @@ dist-bin: all
+ # Just in case anyone needs to link a static binary
+ #
+ static: $(OBJS)
+-	$(CC) -static $(PROC) -o iptraf $(OBJS) ../support/libtextbox.a -lpanel -lncurses
++	$(CC) -static $(PROC) -o iptraf $(OBJS) ../support/libtextbox.a -lpanelw -lncursesw
+ 	$(CC) -static -o rvnamed rvnamed.o getpath.o
+ 	$(CC) -static -o rawtime rawtime.c
+ 
+diff -up iptraf-3.0.1/src/tcptable.h.old iptraf-3.0.1/src/tcptable.h
+--- iptraf-3.0.1/src/tcptable.h.old	2007-09-25 11:46:03.000000000 +0200
++++ iptraf-3.0.1/src/tcptable.h	2007-11-02 12:35:56.000000000 +0100
+@@ -20,11 +20,11 @@
+ #include <arpa/inet.h>
+ #include <net/if_arp.h>
+ #include <asm/types.h>
+-#include <linux/if_packet.h>
+-#include <linux/if_ether.h>
+-#include <linux/netdevice.h>
+-#include <linux/if_fddi.h>
+-#include <linux/if_tr.h>
++#include <linux/if_packet.h>
++#include <netinet/if_ether.h>
++#include <linux/netdevice.h>
++#include <netinet/if_fddi.h>
++#include <netinet/if_tr.h>
+ // #include <net/if.h>
+ #include <netinet/ip.h>
+ #include <netinet/udp.h>

================================================================
Index: packages/iptraf/iptraf-3.0.1-ipv6-fix.patch
diff -u /dev/null packages/iptraf/iptraf-3.0.1-ipv6-fix.patch:1.1
--- /dev/null	Sun Mar 20 22:30:54 2011
+++ packages/iptraf/iptraf-3.0.1-ipv6-fix.patch	Sun Mar 20 22:30:49 2011
@@ -0,0 +1,86 @@
+--- iptraf-3.0.1/src/ifstats.c.ipv6-fix	2008-06-05 13:40:33.000000000 +0200
++++ iptraf-3.0.1/src/ifstats.c	2008-06-05 13:41:05.000000000 +0200
+@@ -294,7 +294,7 @@ void printifentry(struct iflist *ptmp, W
+     printlargenum(ptmp->ip6total, win);
+     wmove(win, target_row, 39 * COLS / 80);
+     printlargenum(ptmp->noniptotal, win);
+-    wmove(win, target_row, 29 * COLS / 80);
++    wmove(win, target_row, 49 * COLS / 80);
+     wprintw(win, "%8lu", ptmp->badtotal);
+ }
+ 
+@@ -329,10 +329,8 @@ void labelstats(WINDOW * win)
+     wmove(win, 0, 32 * COLS / 80);
+     wprintw(win, " IPv6 ");
+     wmove(win, 0, 42 * COLS / 80);
+-    wprintw(win, " IP ");
+-    wmove(win, 0, 36 * COLS / 80);
+     wprintw(win, " NonIP ");
+-    wmove(win, 0, 51 * COLS / 80);
++    wmove(win, 0, 52 * COLS / 80);
+     wprintw(win, " BadIP ");
+     wmove(win, 0, 65 * COLS / 80);
+     wprintw(win, " Activity ");
+--- iptraf-3.0.1/src/othptab.c.ipv6-fix	2008-06-05 13:42:10.000000000 +0200
++++ iptraf-3.0.1/src/othptab.c	2008-06-05 13:51:12.000000000 +0200
+@@ -189,6 +189,11 @@ struct othptabent *add_othp_entry(struct
+                     ((struct icmphdr *) packet2)->type;
+                 new_entry->un.icmp.code =
+                     ((struct icmphdr *) packet2)->code;
++            } else if (protocol == IPPROTO_ICMPV6) {
++                new_entry->un.icmp6.type =
++                    ((struct icmp6_hdr *) packet2)->icmp6_type;
++                new_entry->un.icmp6.code =
++                    ((struct icmp6_hdr *) packet2)->icmp6_code;            	
+             } else if (protocol == IPPROTO_UDP) {
+                 servlook(servnames, ((struct udphdr *) packet2)->source,
+                          IPPROTO_UDP, new_entry->un.udp.s_sname, 10);
+@@ -565,8 +570,8 @@ void printothpentry(struct othptable *ta
+                 case ICMP6_DST_UNREACH_ADMIN:
+                     strcpy(additional, "admin");
+                     break;
+-                case ICMP6_DST_UNREACH_NOTNEIGHBOR:
+-                    strcpy(additional, "not neigh");
++                case ICMP6_DST_UNREACH_BEYONDSCOPE:
++                    strcpy(additional, "not beyondsp");
+                     break;
+                 case ICMP6_DST_UNREACH_ADDR:
+                     strcpy(additional, "unreach addr");
+@@ -576,15 +581,15 @@ void printothpentry(struct othptable *ta
+                     break;
+                 }
+                 break;
+-    	    case ICMP6_PACKET_TOO_BIG:
++            case ICMP6_PACKET_TOO_BIG:
+             	strcpy(description, "pkt too big");
+                 break;
+-	    case ICMP6_TIME_EXCEEDED:
+-    	        strcpy(description, "time exceeded");
+-    		break;
++            case ICMP6_TIME_EXCEEDED:
++                strcpy(description, "time exceeded");
++                break;
+             case ICMP6_PARAM_PROB:
+-	        strcpy(description, "param prob");
+-    	        break;
++                strcpy(description, "param prob");
++                break;
+             case ICMP6_ECHO_REQUEST:
+                 strcpy(description, "echo req");
+                 break;
+@@ -597,15 +602,6 @@ void printothpentry(struct othptable *ta
+             case ND_ROUTER_ADVERT:
+                 strcpy(description, "router adv");
+                 break;
+-            case ICMP6_MEMBERSHIP_QUERY:
+-                strcpy(description, "mbrship query");
+-                break;
+-            case ICMP6_MEMBERSHIP_REPORT:
+-                strcpy(description, "mbrship report");
+-                break;
+-            case ICMP6_MEMBERSHIP_REDUCTION:
+-                strcpy(description, "mbrship reduc");
+-                break;
+             case ND_NEIGHBOR_SOLICIT:
+                 strcpy(description, "neigh sol");
+                 break;

================================================================
Index: packages/iptraf/iptraf-3.0.1-ipv6.patch
diff -u /dev/null packages/iptraf/iptraf-3.0.1-ipv6.patch:1.1
--- /dev/null	Sun Mar 20 22:30:54 2011
+++ packages/iptraf/iptraf-3.0.1-ipv6.patch	Sun Mar 20 22:30:49 2011
@@ -0,0 +1,1450 @@
+diff -up iptraf-3.0.1/src/attrs.h.ipv6 iptraf-3.0.1/src/attrs.h
+--- iptraf-3.0.1/src/attrs.h.ipv6	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.1/src/attrs.h	2008-09-02 13:57:02.000000000 +0200
+@@ -29,3 +29,5 @@ extern int ARPATTR;
+ extern int GREATTR;
+ extern int UNKNIPATTR;
+ extern int UNKNATTR;
++extern int IPV6ATTR;
++extern int ICMPV6ATTR;
+diff -up iptraf-3.0.1/src/deskman.c.ipv6 iptraf-3.0.1/src/deskman.c
+--- iptraf-3.0.1/src/deskman.c.ipv6	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.1/src/deskman.c	2008-09-02 13:57:02.000000000 +0200
+@@ -56,7 +56,8 @@ int GREATTR;
+ int ARPATTR;
+ int UNKNIPATTR;
+ int UNKNATTR;
+-
++int IPV6ATTR;
++int ICMPV6ATTR;
+ 
+ /*  draw the basic desktop common to my screen-oriented programs */
+ 
+@@ -89,7 +90,8 @@ void about()
+     PANEL *panel;
+     int ch;
+ 
+-    win = newwin(15, 50, (LINES - 15) / 2, (COLS - 50) / 2);
++    win = newwin(18, 62, (LINES - 17) / 2, (COLS - 62) / 2);
++
+     panel = new_panel(win);
+ 
+     tx_stdwinset(win);
+@@ -108,9 +110,12 @@ void about()
+     mvwprintw(win, 10, 2,
+               "Public License Version 2 or any later version.");
+     mvwprintw(win, 11, 2, "See the included LICENSE file for details.");
++    mvwprintw(win, 13, 2, "IPv6 support by Markus Ullmann <mail at markus-ullmann.de>");
++    mvwprintw(win, 14, 2, "inspired by 2.7.0 diff by Guy Martin <gmsoft at tuxicoman.be>");
+ 
+     wattrset(win, HIGHATTR);
+-    mvwprintw(win, 13, 2, ANYKEY_MSG);
++
++    mvwprintw(win, 16, 2, ANYKEY_MSG);
+ 
+     update_panels();
+     doupdate();
+@@ -252,6 +257,8 @@ void standardcolors(int color)
+         ARPATTR = COLOR_PAIR(5) | A_BOLD;
+         GREATTR = COLOR_PAIR(1);
+         UNKNIPATTR = COLOR_PAIR(19) | A_BOLD;
++	ICMPV6ATTR = COLOR_PAIR(19) | A_BOLD;
++	IPV6ATTR = COLOR_PAIR(19);
+         UNKNATTR = COLOR_PAIR(4) | A_BOLD;
+     } else {
+         STDATTR = A_REVERSE;
+@@ -281,6 +288,7 @@ void standardcolors(int color)
+         ARPATTR = A_BOLD;
+         GREATTR = A_BOLD;
+         UNKNIPATTR = A_BOLD;
++	ICMPV6ATTR = A_REVERSE;
+         UNKNATTR = A_BOLD;
+     }
+ 
+diff -up iptraf-3.0.1/src/ifstats.c.ipv6 iptraf-3.0.1/src/ifstats.c
+--- iptraf-3.0.1/src/ifstats.c.ipv6	2005-09-13 08:42:54.000000000 +0200
++++ iptraf-3.0.1/src/ifstats.c	2008-09-02 13:57:02.000000000 +0200
+@@ -1,4 +1,3 @@
+-
+ /***
+ 
+ ifstats.c	- the interface statistics module
+@@ -34,6 +33,7 @@ details.
+ #include <linux/if_packet.h>
+ #include <net/if.h>
+ #include <netinet/ip.h>
++#include <netinet/ip6.h>
+ #include <netinet/tcp.h>
+ #include <netinet/udp.h>
+ #include <linux/if_ether.h>
+@@ -252,7 +252,7 @@ void updaterates(struct iftab *table, in
+ 
+     wattrset(table->statwin, HIGHATTR);
+     do {
+-        wmove(table->statwin, ptmp->index - idx, 52 * COLS / 80);
++	wmove(table->statwin, ptmp->index - idx, 60 * COLS / 80);
+         if (unit == KBITS) {
+             ptmp->rate =
+                 ((float) (ptmp->spanbr * 8 / 1000)) /
+@@ -286,13 +286,15 @@ void printifentry(struct iflist *ptmp, W
+     wmove(win, target_row, 1);
+     wprintw(win, "%s", ptmp->ifname);
+     wattrset(win, HIGHATTR);
+-    wmove(win, target_row, 12 * COLS / 80);
++    wmove(win, target_row, 9  * COLS / 80);
+     printlargenum(ptmp->total, win);
+-    wmove(win, target_row, 22 * COLS / 80);
++    wmove(win, target_row, 19 * COLS / 80);
+     printlargenum(ptmp->iptotal, win);
+-    wmove(win, target_row, 32 * COLS / 80);
++    wmove(win, target_row, 29 * COLS / 80);
++    printlargenum(ptmp->ip6total, win);
++    wmove(win, target_row, 39 * COLS / 80);
+     printlargenum(ptmp->noniptotal, win);
+-    wmove(win, target_row, 42 * COLS / 80);
++    wmove(win, target_row, 29 * COLS / 80);
+     wprintw(win, "%8lu", ptmp->badtotal);
+ }
+ 
+@@ -320,15 +322,19 @@ void labelstats(WINDOW * win)
+ {
+     wmove(win, 0, 1);
+     wprintw(win, " Iface ");
+-    wmove(win, 0, 16 * COLS / 80);
++    wmove(win, 0, 12 * COLS / 80);
+     wprintw(win, " Total ");
+-    wmove(win, 0, 29 * COLS / 80);
++    wmove(win, 0, 22 * COLS / 80);
++    wprintw(win, " IPv4 ");
++    wmove(win, 0, 32 * COLS / 80);
++    wprintw(win, " IPv6 ");
++    wmove(win, 0, 42 * COLS / 80);
+     wprintw(win, " IP ");
+     wmove(win, 0, 36 * COLS / 80);
+     wprintw(win, " NonIP ");
+-    wmove(win, 0, 45 * COLS / 80);
++    wmove(win, 0, 51 * COLS / 80);
+     wprintw(win, " BadIP ");
+-    wmove(win, 0, 55 * COLS / 80);
++    wmove(win, 0, 65 * COLS / 80);
+     wprintw(win, " Activity ");
+ }
+ 
+@@ -422,6 +428,8 @@ void ifstats(const struct OPTIONS *optio
+     char *packet;
+     int pkt_result = 0;
+ 
++    unsigned int iphlen;
++
+     struct sockaddr_ll fromaddr;
+     unsigned short linktype;
+ 
+@@ -590,6 +598,18 @@ void ifstats(const struct OPTIONS *optio
+                     && pkt_result != MORE_FRAGMENTS)
+                     continue;
+ 
++		if ((options->v6inv4asv6) && (fromaddr.sll_protocol == ETH_P_IP)
++                    && ((struct iphdr *) packet)->protocol == IPPROTO_IPV6 ) {
++	                iphlen = ((struct iphdr *) packet)->ihl * 4;
++    	                fromaddr.sll_protocol = htons(ETH_P_IPV6);
++        	        memmove(buf, buf + iphlen, MAX_PACKET_SIZE - iphlen);
++            	        // Reprocess the IPv6 packet
++                        pkt_result = processpacket(buf, &packet, &br, NULL, NULL, NULL,
++                                  &fromaddr, &linktype, ofilter, MATCH_OPPOSITE_USECONFIG, ifname, NULL);
++	                if (pkt_result != PACKET_OK
++    	                && pkt_result != MORE_FRAGMENTS)
++        	        continue;
++    	        }
+                 positionptr(&table, &ptmp, ifname);
+ 
+                 ptmp->total++;
+@@ -604,6 +624,8 @@ void ifstats(const struct OPTIONS *optio
+                         (ptmp->badtotal)++;
+                         continue;
+                     }
++                } else if (fromaddr.sll_protocol == ETH_P_IPV6) {
++                    ptmp->ip6total++;
+                 } else {
+                     (ptmp->noniptotal)++;
+                 }
+@@ -654,19 +676,20 @@ void printdetlabels(WINDOW * win, struct
+               "Packets      Bytes     Packets      Bytes     Packets      Bytes");
+     wattrset(win, STDATTR);
+     mvwprintw(win, 4, 2, "Total:");
+-    mvwprintw(win, 5, 2, "IP:");
+-    mvwprintw(win, 6, 2, "TCP:");
+-    mvwprintw(win, 7, 2, "UDP:");
+-    mvwprintw(win, 8, 2, "ICMP:");
+-    mvwprintw(win, 9, 2, "Other IP:");
+-    mvwprintw(win, 10, 2, "Non-IP:");
+-    mvwprintw(win, 13, 2, "Total rates:");
+-    mvwprintw(win, 16, 2, "Incoming rates:");
+-    mvwprintw(win, 19, 2, "Outgoing rates:");
+-
+-    mvwprintw(win, 13, 45, "Broadcast packets:");
+-    mvwprintw(win, 14, 45, "Broadcast bytes:");
+-    mvwprintw(win, 18, 45, "IP checksum errors:");
++    mvwprintw(win, 5, 2, "IPv4:");
++    mvwprintw(win, 6, 2, "IPv6:");
++    mvwprintw(win, 7, 2, "TCP:");
++    mvwprintw(win, 8, 2, "UDP:");
++    mvwprintw(win, 9, 2, "ICMP:");
++    mvwprintw(win, 10, 2, "Other IP:");
++    mvwprintw(win, 11, 2, "Non-IP:");
++    mvwprintw(win, 14, 2, "Total rates:");
++    mvwprintw(win, 17, 2, "Incoming rates:");
++    mvwprintw(win, 20, 2, "Outgoing rates:");
++
++    mvwprintw(win, 14, 45, "Broadcast packets:");
++    mvwprintw(win, 15, 45, "Broadcast bytes:");
++    mvwprintw(win, 19, 45, "IP checksum errors:");
+ 
+     update_panels();
+     doupdate();
+@@ -707,38 +730,41 @@ void printdetails(struct iftotals *total
+                  totals->iptotal_in, totals->ipbtotal_in,
+                  totals->iptotal_out, totals->ipbtotal_out);
+ 
+-    printstatrow(win, 6, totals->tcptotal, totals->tcpbtotal,
++    printstatrow(win, 6, totals->ip6total, totals->ip6btotal,
++                 totals->ip6total_in, totals->ip6btotal_in,
++                 totals->ip6total_out, totals->ip6btotal_out);  
++  
++    printstatrow(win, 7, totals->tcptotal, totals->tcpbtotal,
+                  totals->tcptotal_in, totals->tcpbtotal_in,
+-                 totals->tcptotal_out, totals->tcpbtotal_out);
++		 totals->tcptotal_out, totals->tcpbtotal_out);
+ 
+-    printstatrow(win, 7, totals->udptotal, totals->udpbtotal,
++    printstatrow(win, 8, totals->udptotal, totals->udpbtotal,
+                  totals->udptotal_in, totals->udpbtotal_in,
+                  totals->udptotal_out, totals->udpbtotal_out);
+ 
+-    printstatrow(win, 8, totals->icmptotal, totals->icmpbtotal,
++    printstatrow(win, 9, totals->icmptotal, totals->icmpbtotal,
+                  totals->icmptotal_in, totals->icmpbtotal_in,
+                  totals->icmptotal_out, totals->icmpbtotal_out);
+ 
+-    printstatrow(win, 9, totals->othtotal, totals->othbtotal,
++    printstatrow(win, 10, totals->othtotal, totals->othbtotal,
+                  totals->othtotal_in, totals->othbtotal_in,
+                  totals->othtotal_out, totals->othbtotal_out);
+ 
+     /* Print non-IP totals */
+ 
+-    printstatrow(win, 10, totals->noniptotal, totals->nonipbtotal,
++    printstatrow(win, 11, totals->noniptotal, totals->nonipbtotal,
+                  totals->noniptotal_in, totals->nonipbtotal_in,
+                  totals->noniptotal_out, totals->nonipbtotal_out);
+ 
+     /* Broadcast totals */
+-
+-    wmove(win, 13, 67);
+-    printlargenum(totals->bcast, win);
+     wmove(win, 14, 67);
++    printlargenum(totals->bcast, win);
++    wmove(win, 15, 67);
+     printlargenum(totals->bcastbytes, win);
+ 
+     /* Bad packet count */
+ 
+-    mvwprintw(win, 18, 68, "%8lu", totals->badtotal);
++    mvwprintw(win, 19, 68, "%8lu", totals->badtotal);
+ }
+ 
+ 
+@@ -757,6 +783,7 @@ void detstats(char *iface, const struct 
+     char buf[MAX_PACKET_SIZE];
+     char *packet;
+     struct iphdr *ipacket = NULL;
++    struct ip6_hdr *ip6packet = NULL;
+     char *tpacket;
+     unsigned int iphlen;
+ 
+@@ -962,15 +989,15 @@ void detstats(char *iface, const struct 
+             starttime = now;
+ 
+             wattrset(statwin, HIGHATTR);
+-            mvwprintw(statwin, 13, 19, "%8.1f %s/sec", activity,
++            mvwprintw(statwin, 14, 19, "%8.1f %s/sec", activity,
+                       unitstring);
+-            mvwprintw(statwin, 14, 19, "%8.1f packets/sec", pps);
+-            mvwprintw(statwin, 16, 19, "%8.1f %s/sec", activity_in,
++            mvwprintw(statwin, 15, 19, "%8.1f packets/sec", pps);
++            mvwprintw(statwin, 17, 19, "%8.1f %s/sec", activity_in,
+                       unitstring);
+-            mvwprintw(statwin, 17, 19, "%8.1f packets/sec", pps_in);
+-            mvwprintw(statwin, 19, 19, "%8.1f %s/sec", activity_out,
++            mvwprintw(statwin, 18, 19, "%8.1f packets/sec", pps_in);
++            mvwprintw(statwin, 20, 19, "%8.1f %s/sec", activity_out,
+                       unitstring);
+-            mvwprintw(statwin, 20, 19, "%8.1f packets/sec", pps_out);
++            mvwprintw(statwin, 21, 19, "%8.1f packets/sec", pps_out);
+ 
+             if (activity > peakactivity)
+                 peakactivity = activity;
+@@ -1077,6 +1104,18 @@ void detstats(char *iface, const struct 
+             if (pkt_result != PACKET_OK && pkt_result != MORE_FRAGMENTS)
+                 continue;
+ 
++            if ((options->v6inv4asv6) && (fromaddr.sll_protocol == ETH_P_IP)
++                && ((struct iphdr *) packet)->protocol == IPPROTO_IPV6 ) {
++                    iphlen = ((struct iphdr *) packet)->ihl * 4;
++                    fromaddr.sll_protocol = htons(ETH_P_IPV6);
++                    memmove(buf, buf + iphlen, MAX_PACKET_SIZE - iphlen);
++                    // Reprocess the IPv6 packet
++                    pkt_result = processpacket(buf, &packet, &br, NULL, NULL, NULL,
++                              &fromaddr, &linktype, ofilter, MATCH_OPPOSITE_USECONFIG, ifname, NULL);
++                    if (pkt_result != PACKET_OK && pkt_result != MORE_FRAGMENTS)
++                        continue;
++            }
++
+             totals.total++;
+             totals.bytestotal += framelen;
+ 
+@@ -1185,8 +1224,73 @@ void detstats(char *iface, const struct 
+                     }
+                     break;
+                 }
++            } else if (fromaddr.sll_protocol == ETH_P_IPV6) {
++ 
++                ip6packet = (struct ip6_hdr *) packet;
++                iplen = ntohs(ip6packet->ip6_plen);
++ 
++                totals.ip6total++;
++                totals.ip6btotal += iplen;
++ 
++                if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
++                    totals.ip6total_out++;
++                    totals.ip6btotal_out += iplen;
++                } else {
++                    totals.ip6total_in++;
++                    totals.ip6btotal_in += iplen;
++                }
++ 
++                switch (ip6packet->ip6_nxt) {
++                case IPPROTO_TCP:
++                    totals.tcptotal++;
++                    totals.tcpbtotal += iplen;
++ 
++                    if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
++                        totals.tcptotal_out++;
++                        totals.tcpbtotal_out += iplen;
++                    } else {
++                        totals.tcptotal_in++;
++                        totals.tcpbtotal_in += iplen;
++                    }
++                    break;
++                case IPPROTO_UDP:
++                    totals.udptotal++;
++                    totals.udpbtotal += iplen;
++ 
++                    if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
++                        totals.udptotal_out++;
++                        totals.udpbtotal_out += iplen;
++                    } else {
++                        totals.udptotal_in++;
++                        totals.udpbtotal_in += iplen;
++                    }
++                    break;
++                case IPPROTO_ICMPV6:
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/iptraf/iptraf.spec?r1=1.65&r2=1.66&f=u



More information about the pld-cvs-commit mailing list