1 --- ./iptraf-3.0.0.orig/src/attrs.h 2005-09-13 08:42:54.000000000 +0200
2 +++ ./iptraf-3.0.0/src/attrs.h 2006-01-08 05:11:43.000000000 +0100
8 +extern int ICMPV6ATTR;
9 --- ./iptraf-3.0.0.orig/src/deskman.c 2005-09-13 08:42:54.000000000 +0200
10 +++ ./iptraf-3.0.0/src/deskman.c 2006-01-08 05:32:03.000000000 +0100
19 /* draw the basic desktop common to my screen-oriented programs */
25 - win = newwin(15, 50, (LINES - 15) / 2, (COLS - 50) / 2);
26 + win = newwin(18, 62, (LINES - 17) / 2, (COLS - 62) / 2);
28 panel = new_panel(win);
33 "Public License Version 2 or any later version.");
34 mvwprintw(win, 11, 2, "See the included LICENSE file for details.");
35 + mvwprintw(win, 13, 2, "IPv6 support by Markus Ullmann <mail@markus-ullmann.de>");
36 + mvwprintw(win, 14, 2, "inspired by 2.7.0 diff by Guy Martin <gmsoft@tuxicoman.be>");
38 wattrset(win, HIGHATTR);
39 - mvwprintw(win, 13, 2, ANYKEY_MSG);
41 + mvwprintw(win, 16, 2, ANYKEY_MSG);
46 ARPATTR = COLOR_PAIR(5) | A_BOLD;
47 GREATTR = COLOR_PAIR(1);
48 UNKNIPATTR = COLOR_PAIR(19) | A_BOLD;
49 + ICMPV6ATTR = COLOR_PAIR(19) | A_BOLD;
50 + IPV6ATTR = COLOR_PAIR(19);
51 UNKNATTR = COLOR_PAIR(4) | A_BOLD;
58 + ICMPV6ATTR = A_REVERSE;
62 --- ./iptraf-3.0.0.orig/src/ifstats.c 2005-09-13 08:42:54.000000000 +0200
63 +++ ./iptraf-3.0.0/src/ifstats.c 2006-01-08 05:29:30.000000000 +0100
68 ifstats.c - the interface statistics module
70 #include <linux/if_packet.h>
72 #include <netinet/ip.h>
73 +#include <netinet/ip6.h>
74 #include <netinet/tcp.h>
75 #include <netinet/udp.h>
76 #include <linux/if_ether.h>
79 wattrset(table->statwin, HIGHATTR);
81 - wmove(table->statwin, ptmp->index - idx, 52 * COLS / 80);
82 + wmove(table->statwin, ptmp->index - idx, 60 * COLS / 80);
85 ((float) (ptmp->spanbr * 8 / 1000)) /
87 wmove(win, target_row, 1);
88 wprintw(win, "%s", ptmp->ifname);
89 wattrset(win, HIGHATTR);
90 - wmove(win, target_row, 12 * COLS / 80);
91 + wmove(win, target_row, 9 * COLS / 80);
92 printlargenum(ptmp->total, win);
93 - wmove(win, target_row, 22 * COLS / 80);
94 + wmove(win, target_row, 19 * COLS / 80);
95 printlargenum(ptmp->iptotal, win);
96 - wmove(win, target_row, 32 * COLS / 80);
97 + wmove(win, target_row, 29 * COLS / 80);
98 + printlargenum(ptmp->ip6total, win);
99 + wmove(win, target_row, 39 * COLS / 80);
100 printlargenum(ptmp->noniptotal, win);
101 - wmove(win, target_row, 42 * COLS / 80);
102 + wmove(win, target_row, 29 * COLS / 80);
103 wprintw(win, "%8lu", ptmp->badtotal);
106 @@ -320,15 +322,19 @@
109 wprintw(win, " Iface ");
110 - wmove(win, 0, 16 * COLS / 80);
111 + wmove(win, 0, 12 * COLS / 80);
112 wprintw(win, " Total ");
113 - wmove(win, 0, 29 * COLS / 80);
114 + wmove(win, 0, 22 * COLS / 80);
115 + wprintw(win, " IPv4 ");
116 + wmove(win, 0, 32 * COLS / 80);
117 + wprintw(win, " IPv6 ");
118 + wmove(win, 0, 42 * COLS / 80);
119 wprintw(win, " IP ");
120 wmove(win, 0, 36 * COLS / 80);
121 wprintw(win, " NonIP ");
122 - wmove(win, 0, 45 * COLS / 80);
123 + wmove(win, 0, 51 * COLS / 80);
124 wprintw(win, " BadIP ");
125 - wmove(win, 0, 55 * COLS / 80);
126 + wmove(win, 0, 65 * COLS / 80);
127 wprintw(win, " Activity ");
134 + unsigned int iphlen;
136 struct sockaddr_ll fromaddr;
137 unsigned short linktype;
140 && pkt_result != MORE_FRAGMENTS)
143 + if ((options->v6inv4asv6) && (fromaddr.sll_protocol == ETH_P_IP)
144 + && ((struct iphdr *) packet)->protocol == IPPROTO_IPV6 ) {
145 + iphlen = ((struct iphdr *) packet)->ihl * 4;
146 + fromaddr.sll_protocol = htons(ETH_P_IPV6);
147 + memmove(buf, buf + iphlen, MAX_PACKET_SIZE - iphlen);
148 + // Reprocess the IPv6 packet
149 + pkt_result = processpacket(buf, &packet, &br, NULL, NULL, NULL,
150 + &fromaddr, &linktype, ofilter, MATCH_OPPOSITE_USECONFIG, ifname, NULL);
151 + if (pkt_result != PACKET_OK
152 + && pkt_result != MORE_FRAGMENTS)
155 positionptr(&table, &ptmp, ifname);
162 + } else if (fromaddr.sll_protocol == ETH_P_IPV6) {
165 (ptmp->noniptotal)++;
167 @@ -654,19 +676,20 @@
168 "Packets Bytes Packets Bytes Packets Bytes");
169 wattrset(win, STDATTR);
170 mvwprintw(win, 4, 2, "Total:");
171 - mvwprintw(win, 5, 2, "IP:");
172 - mvwprintw(win, 6, 2, "TCP:");
173 - mvwprintw(win, 7, 2, "UDP:");
174 - mvwprintw(win, 8, 2, "ICMP:");
175 - mvwprintw(win, 9, 2, "Other IP:");
176 - mvwprintw(win, 10, 2, "Non-IP:");
177 - mvwprintw(win, 13, 2, "Total rates:");
178 - mvwprintw(win, 16, 2, "Incoming rates:");
179 - mvwprintw(win, 19, 2, "Outgoing rates:");
181 - mvwprintw(win, 13, 45, "Broadcast packets:");
182 - mvwprintw(win, 14, 45, "Broadcast bytes:");
183 - mvwprintw(win, 18, 45, "IP checksum errors:");
184 + mvwprintw(win, 5, 2, "IPv4:");
185 + mvwprintw(win, 6, 2, "IPv6:");
186 + mvwprintw(win, 7, 2, "TCP:");
187 + mvwprintw(win, 8, 2, "UDP:");
188 + mvwprintw(win, 9, 2, "ICMP:");
189 + mvwprintw(win, 10, 2, "Other IP:");
190 + mvwprintw(win, 11, 2, "Non-IP:");
191 + mvwprintw(win, 14, 2, "Total rates:");
192 + mvwprintw(win, 17, 2, "Incoming rates:");
193 + mvwprintw(win, 20, 2, "Outgoing rates:");
195 + mvwprintw(win, 14, 45, "Broadcast packets:");
196 + mvwprintw(win, 15, 45, "Broadcast bytes:");
197 + mvwprintw(win, 19, 45, "IP checksum errors:");
201 @@ -707,38 +730,41 @@
202 totals->iptotal_in, totals->ipbtotal_in,
203 totals->iptotal_out, totals->ipbtotal_out);
205 - printstatrow(win, 6, totals->tcptotal, totals->tcpbtotal,
206 + printstatrow(win, 6, totals->ip6total, totals->ip6btotal,
207 + totals->ip6total_in, totals->ip6btotal_in,
208 + totals->ip6total_out, totals->ip6btotal_out);
210 + printstatrow(win, 7, totals->tcptotal, totals->tcpbtotal,
211 totals->tcptotal_in, totals->tcpbtotal_in,
212 - totals->tcptotal_out, totals->tcpbtotal_out);
213 + totals->tcptotal_out, totals->tcpbtotal_out);
215 - printstatrow(win, 7, totals->udptotal, totals->udpbtotal,
216 + printstatrow(win, 8, totals->udptotal, totals->udpbtotal,
217 totals->udptotal_in, totals->udpbtotal_in,
218 totals->udptotal_out, totals->udpbtotal_out);
220 - printstatrow(win, 8, totals->icmptotal, totals->icmpbtotal,
221 + printstatrow(win, 9, totals->icmptotal, totals->icmpbtotal,
222 totals->icmptotal_in, totals->icmpbtotal_in,
223 totals->icmptotal_out, totals->icmpbtotal_out);
225 - printstatrow(win, 9, totals->othtotal, totals->othbtotal,
226 + printstatrow(win, 10, totals->othtotal, totals->othbtotal,
227 totals->othtotal_in, totals->othbtotal_in,
228 totals->othtotal_out, totals->othbtotal_out);
230 /* Print non-IP totals */
232 - printstatrow(win, 10, totals->noniptotal, totals->nonipbtotal,
233 + printstatrow(win, 11, totals->noniptotal, totals->nonipbtotal,
234 totals->noniptotal_in, totals->nonipbtotal_in,
235 totals->noniptotal_out, totals->nonipbtotal_out);
237 /* Broadcast totals */
239 - wmove(win, 13, 67);
240 - printlargenum(totals->bcast, win);
242 + printlargenum(totals->bcast, win);
243 + wmove(win, 15, 67);
244 printlargenum(totals->bcastbytes, win);
246 /* Bad packet count */
248 - mvwprintw(win, 18, 68, "%8lu", totals->badtotal);
249 + mvwprintw(win, 19, 68, "%8lu", totals->badtotal);
254 char buf[MAX_PACKET_SIZE];
256 struct iphdr *ipacket = NULL;
257 + struct ip6_hdr *ip6packet = NULL;
261 @@ -962,15 +989,15 @@
264 wattrset(statwin, HIGHATTR);
265 - mvwprintw(statwin, 13, 19, "%8.1f %s/sec", activity,
266 + mvwprintw(statwin, 14, 19, "%8.1f %s/sec", activity,
268 - mvwprintw(statwin, 14, 19, "%8.1f packets/sec", pps);
269 - mvwprintw(statwin, 16, 19, "%8.1f %s/sec", activity_in,
270 + mvwprintw(statwin, 15, 19, "%8.1f packets/sec", pps);
271 + mvwprintw(statwin, 17, 19, "%8.1f %s/sec", activity_in,
273 - mvwprintw(statwin, 17, 19, "%8.1f packets/sec", pps_in);
274 - mvwprintw(statwin, 19, 19, "%8.1f %s/sec", activity_out,
275 + mvwprintw(statwin, 18, 19, "%8.1f packets/sec", pps_in);
276 + mvwprintw(statwin, 20, 19, "%8.1f %s/sec", activity_out,
278 - mvwprintw(statwin, 20, 19, "%8.1f packets/sec", pps_out);
279 + mvwprintw(statwin, 21, 19, "%8.1f packets/sec", pps_out);
281 if (activity > peakactivity)
282 peakactivity = activity;
283 @@ -1077,6 +1104,18 @@
284 if (pkt_result != PACKET_OK && pkt_result != MORE_FRAGMENTS)
287 + if ((options->v6inv4asv6) && (fromaddr.sll_protocol == ETH_P_IP)
288 + && ((struct iphdr *) packet)->protocol == IPPROTO_IPV6 ) {
289 + iphlen = ((struct iphdr *) packet)->ihl * 4;
290 + fromaddr.sll_protocol = htons(ETH_P_IPV6);
291 + memmove(buf, buf + iphlen, MAX_PACKET_SIZE - iphlen);
292 + // Reprocess the IPv6 packet
293 + pkt_result = processpacket(buf, &packet, &br, NULL, NULL, NULL,
294 + &fromaddr, &linktype, ofilter, MATCH_OPPOSITE_USECONFIG, ifname, NULL);
295 + if (pkt_result != PACKET_OK && pkt_result != MORE_FRAGMENTS)
300 totals.bytestotal += framelen;
302 @@ -1185,8 +1224,73 @@
306 + } else if (fromaddr.sll_protocol == ETH_P_IPV6) {
308 + ip6packet = (struct ip6_hdr *) packet;
309 + iplen = ntohs(ip6packet->ip6_plen);
312 + totals.ip6btotal += iplen;
314 + if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
315 + totals.ip6total_out++;
316 + totals.ip6btotal_out += iplen;
318 + totals.ip6total_in++;
319 + totals.ip6btotal_in += iplen;
322 + switch (ip6packet->ip6_nxt) {
325 + totals.tcpbtotal += iplen;
327 + if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
328 + totals.tcptotal_out++;
329 + totals.tcpbtotal_out += iplen;
331 + totals.tcptotal_in++;
332 + totals.tcpbtotal_in += iplen;
337 + totals.udpbtotal += iplen;
339 + if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
340 + totals.udptotal_out++;
341 + totals.udpbtotal_out += iplen;
343 + totals.udptotal_in++;
344 + totals.udpbtotal_in += iplen;
347 + case IPPROTO_ICMPV6:
348 + totals.icmptotal++;
349 + totals.icmpbtotal += iplen;
350 + if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
351 + totals.icmptotal_out++;
352 + totals.icmpbtotal_out += iplen;
354 + totals.icmptotal_in++;
355 + totals.icmpbtotal_in += iplen;
360 + totals.othbtotal += iplen;
362 + if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
363 + totals.othtotal_out++;
364 + totals.othbtotal_out += iplen;
366 + totals.othtotal_in++;
367 + totals.othbtotal_in += iplen;
372 - totals.noniptotal++;
373 + totals.noniptotal++;
374 totals.nonipbtotal += br;
376 if (fromaddr.sll_pkttype == PACKET_OUTGOING) {
377 --- ./iptraf-3.0.0.orig/src/ifstats.h 2005-09-13 08:42:54.000000000 +0200
378 +++ ./iptraf-3.0.0/src/ifstats.h 2006-01-08 05:17:07.000000000 +0100
382 unsigned long long iptotal;
383 + unsigned long long ip6total;
384 unsigned long badtotal;
385 unsigned long long noniptotal;
386 unsigned long long total;
388 unsigned long long ipbtotal_in;
389 unsigned long long ipbtotal_out;
391 + unsigned long long ip6total;
392 + unsigned long long ip6btotal;
393 + unsigned long long ip6total_in;
394 + unsigned long long ip6total_out;
395 + unsigned long long ip6btotal_in;
396 + unsigned long long ip6btotal_out;
398 unsigned long long noniptotal;
399 unsigned long long nonipbtotal;
400 unsigned long long noniptotal_in;
401 --- ./iptraf-3.0.0.orig/src/itrafmon.c 2005-09-13 08:42:54.000000000 +0200
402 +++ ./iptraf-3.0.0/src/itrafmon.c 2006-01-08 05:20:49.000000000 +0100
407 +#include <netinet/ip6.h>
408 +#include <netinet/icmp6.h>
410 #include "tcptable.h"
413 char tpacket[MAX_PACKET_SIZE]; /* raw packet data */
414 char *packet = NULL; /* network packet ptr */
415 struct iphdr *ippacket;
416 + struct ip6_hdr *ip6packet;
417 + unsigned int protocol;
418 + unsigned int frag_off;
419 struct tcphdr *transpacket; /* IP-encapsulated packet */
420 unsigned int sport = 0, dport = 0; /* TCP/UDP port values */
422 @@ -1046,9 +1051,9 @@
423 if (pkt_result != PACKET_OK)
426 - if (fromaddr.sll_protocol != ETH_P_IP) {
427 + if ((fromaddr.sll_protocol != ETH_P_IP) && (fromaddr.sll_protocol != ETH_P_IPV6)) {
428 othpent = add_othp_entry(&othptbl, &table,
430 + 0, 0, NULL, NULL, NOT_IP,
431 fromaddr.sll_protocol,
432 linktype, (char *) tpacket,
433 (char *) packet, br, ifname, 0, 0,
434 @@ -1056,23 +1061,52 @@
435 options->servnames, 0, &nomem);
438 + if ((options->v6inv4asv6) && (fromaddr.sll_protocol == ETH_P_IP)
439 + && ((struct iphdr *) packet)->protocol == IPPROTO_IPV6 ) {
440 + iphlen = ((struct iphdr *) packet)->ihl * 4;
441 + fromaddr.sll_protocol = htons(ETH_P_IPV6);
442 + memmove(tpacket, tpacket + iphlen, MAX_PACKET_SIZE - iphlen);
443 + // Reprocess the ipv6 packet
444 + pkt_result = processpacket((char *) tpacket, &packet, &readlen,
445 + &br, &sport, &dport, &fromaddr,
446 + &linktype, ofilter, MATCH_OPPOSITE_ALWAYS, ifname, ifptr);
447 + if (pkt_result != PACKET_OK)
450 + if (fromaddr.sll_protocol == ETH_P_IP) {
451 ippacket = (struct iphdr *) packet;
452 iphlen = ippacket->ihl * 4;
454 + protocol = ippacket->protocol;
455 + frag_off = ippacket->frag_off;
457 + ip6packet = (struct ip6_hdr *) packet;
460 + protocol = ip6packet->ip6_nxt;
463 transpacket = (struct tcphdr *) (packet + iphlen);
465 - if (ippacket->protocol == IPPROTO_TCP) {
466 + if (protocol == IPPROTO_TCP) {
468 + if (ippacket != NULL)
470 in_table(&table, ippacket->saddr, ippacket->daddr,
471 - ntohs(sport), ntohs(dport), ifname,
472 - logging, logfile, &nomem, options);
474 + ntohs(sport), ntohs(dport), ifname,
475 + logging, logfile, &nomem, options);
477 + tcpentry = in_table(&table, 0, 0, (uint8_t*)(&ip6packet->ip6_src.s6_addr), (uint8_t*)(&ip6packet->ip6_dst.s6_addr),
478 + ntohs(sport), ntohs(dport), ifname,
479 + logging, logfile, &nomem, options);
482 * Add a new entry if it doesn't exist, and,
483 * to reduce the chances of stales, not a FIN.
486 - if ((ntohs(ippacket->frag_off) & 0x3fff) == 0) { /* first frag only */
487 + if ((ntohs(frag_off) & 0x3fff) == 0) { /* first frag only */
488 totalhlen = iphlen + transpacket->doff * 4;
490 if ((tcpentry == NULL) && (!(transpacket->fin))) {
491 @@ -1084,17 +1118,26 @@
494 wasempty = (table.head == NULL);
495 + if (ippacket != NULL)
496 tcpentry = addentry(&table, (unsigned long)
499 - ippacket->daddr, sport,
510 + tcpentry = addentry(&table, 0, 0,
511 + (uint8_t*)(&ip6packet->ip6_src.s6_addr),
512 + (uint8_t*)(&ip6packet->ip6_dst.s6_addr),
513 + sport, dport, ip6packet->ip6_nxt,
515 + rvnfd, options->servnames,
517 if (tcpentry != NULL) {
519 tcpentry->oth_connection,
520 @@ -1152,12 +1195,18 @@
521 p_sstat = tcpentry->s_fstat;
522 p_dstat = tcpentry->d_fstat;
524 + if (ippacket != NULL)
525 updateentry(&table, tcpentry, transpacket,
526 tpacket, linktype, readlen, br,
527 ippacket->frag_off, logging,
528 &revlook, rvnfd, options, logfile,
532 + updateentry(&table, tcpentry, transpacket, tpacket,
534 + readlen, 0, logging,
535 + &revlook, rvnfd, options, logfile,
538 * Log first packet of a TCP connection except if
539 * it's a RST, which was already logged earlier in
540 @@ -1213,7 +1262,7 @@
544 - } else { /* now for the other IP protocols */
545 + } else if (ippacket != NULL) {
546 fragment = ((ntohs(ippacket->frag_off) & 0x1fff) != 0);
548 if (ippacket->protocol == IPPROTO_ICMP) {
549 @@ -1234,7 +1283,7 @@
552 add_othp_entry(&othptbl, &table, ippacket->saddr,
553 - ippacket->daddr, IS_IP,
554 + ippacket->daddr, NULL, NULL, IS_IP,
555 ippacket->protocol, linktype,
557 (char *) transpacket, readlen,
558 @@ -1242,6 +1291,21 @@
559 options->timeout, logging, logfile,
560 options->servnames, fragment,
564 + if (ip6packet->ip6_nxt == IPPROTO_ICMPV6) {
565 + if (((struct icmp6_hdr *) transpacket)->icmp6_type == ICMP6_DST_UNREACH)
566 + process_dest_unreach(&table, (char *) transpacket,
570 + add_othp_entry(&othptbl, &table, 0, 0, &ip6packet->ip6_src,
571 + &ip6packet->ip6_dst, IS_IP,
572 + ip6packet->ip6_nxt, linktype,
573 + (char *) tpacket, (char *) transpacket,
574 + readlen, ifname, &revlook,
575 + rvnfd, options->timeout, logging, logfile,
576 + options->servnames, fragment, &nomem);
580 --- ./iptraf-3.0.0.orig/src/landesc.c 2005-09-13 08:42:54.000000000 +0200
581 +++ ./iptraf-3.0.0/src/landesc.c 2006-01-08 05:21:02.000000000 +0100
583 else if (linktype == LINK_FDDI)
584 fd = fopen(FDDIFILE, "w");
591 --- ./iptraf-3.0.0.orig/src/options.c 2005-09-13 08:42:54.000000000 +0200
592 +++ ./iptraf-3.0.0/src/options.c 2006-01-08 05:34:56.000000000 +0100
595 void makeoptionmenu(struct MENU *menu)
597 - tx_initmenu(menu, 19, 40, (LINES - 19) / 2 - 1, (COLS - 40) / 16,
598 + tx_initmenu(menu, 20, 40, (LINES - 19) / 2 - 1, (COLS - 40) / 16,
599 BOXATTR, STDATTR, HIGHATTR, BARSTDATTR, BARHIGHATTR,
601 tx_additem(menu, " ^R^everse DNS lookups",
603 "Toggles activity indicators between kbits/s and kbytes/s");
604 tx_additem(menu, " Source ^M^AC addrs in traffic monitor",
605 "Toggles display of source MAC addresses in the IP Traffic Monitor");
606 + tx_additem(menu, " ^S^how v6-in-v4 traffic as IPv6",
607 + "Toggled display of IPv6 tunnel in IPv4 as IPv6 traffic");
608 tx_additem(menu, NULL, NULL);
609 tx_additem(menu, " ^T^imers...", "Configures timeouts and intervals");
610 tx_additem(menu, NULL, NULL);
613 printoptonoff(options->mac, win);
616 + printoptonoff(options->v6inv4asv6, win);
621 options->logspan = 3600;
622 options->updrate = 0;
623 options->closedint = 0;
624 + options->v6inv4asv6 = 1;
627 void loadoptions(struct OPTIONS *options)
628 @@ -189,17 +194,17 @@
629 void updatetimes(struct OPTIONS *options, WINDOW * win)
631 wattrset(win, HIGHATTR);
632 - mvwprintw(win, 9, 25, "%3u mins", options->timeout);
633 - mvwprintw(win, 10, 25, "%3u mins", options->logspan / 60);
634 - mvwprintw(win, 11, 25, "%3u secs", options->updrate);
635 - mvwprintw(win, 12, 25, "%3u mins", options->closedint);
636 + mvwprintw(win, 10, 25, "%3u mins", options->timeout);
637 + mvwprintw(win, 11, 25, "%3u mins", options->logspan / 60);
638 + mvwprintw(win, 12, 25, "%3u secs", options->updrate);
639 + mvwprintw(win, 13, 25, "%3u mins", options->closedint);
642 void showoptions(struct OPTIONS *options, WINDOW * win)
646 - for (i = 1; i <= 7; i++)
647 + for (i = 1; i <= 8; i++)
648 indicatesetting(i, options, win);
650 updatetimes(options, win);
651 @@ -272,13 +277,13 @@
653 makeoptionmenu(&menu);
655 - statwin = newwin(14, 35, (LINES - 19) / 2 - 1, (COLS - 40) / 16 + 40);
656 + statwin = newwin(15, 35, (LINES - 19) / 2 - 1, (COLS - 40) / 16 + 40);
657 statpanel = new_panel(statwin);
659 wattrset(statwin, BOXATTR);
660 tx_colorwin(statwin);
661 tx_box(statwin, ACS_VLINE, ACS_HLINE);
662 - wmove(statwin, 8, 1);
663 + wmove(statwin, 9, 1);
664 whline(statwin, ACS_HLINE, 33);
665 mvwprintw(statwin, 0, 1, " Current Settings ");
666 wattrset(statwin, STDATTR);
667 @@ -289,10 +294,11 @@
668 mvwprintw(statwin, 5, 2, "Logging:");
669 mvwprintw(statwin, 6, 2, "Activity mode:");
670 mvwprintw(statwin, 7, 2, "MAC addresses:");
671 - mvwprintw(statwin, 9, 2, "TCP timeout:");
672 - mvwprintw(statwin, 10, 2, "Log interval:");
673 - mvwprintw(statwin, 11, 2, "Update interval:");
674 - mvwprintw(statwin, 12, 2, "Closed/idle persist:");
675 + mvwprintw(statwin, 8, 2, "v6-in-v4 as IPv6:");
676 + mvwprintw(statwin, 10, 2, "TCP timeout:");
677 + mvwprintw(statwin, 11, 2, "Log interval:");
678 + mvwprintw(statwin, 12, 2, "Update interval:");
679 + mvwprintw(statwin, 13, 2, "Closed/idle persist:");
680 showoptions(options, statwin);
685 options->mac = ~(options->mac);
689 + options->v6inv4asv6 = ~(options->v6inv4asv6);
692 maketimermenu(&timermenu);
695 @@ -362,22 +371,22 @@
709 ethdescmgr(LINK_ETHERNET);
713 ethdescmgr(LINK_FDDI);
717 indicatesetting(row, options, statwin);
718 - } while (row != 17);
719 + } while (row != 18);
721 tx_destroymenu(&menu);
722 del_panel(statpanel);
723 --- ./iptraf-3.0.0.orig/src/options.h 2005-09-13 08:42:54.000000000 +0200
724 +++ ./iptraf-3.0.0/src/options.h 2006-01-08 05:22:16.000000000 +0100
727 unsigned int color:1,
729 - revlook:1, servnames:1, promisc:1, actmode:1, mac:1, dummy:9;
730 + revlook:1, servnames:1, promisc:1, actmode:1, mac:1, v6inv4asv6:1, dummy:8;
731 unsigned int timeout;
732 unsigned int logspan;
733 unsigned int updrate;
734 --- ./iptraf-3.0.0.orig/src/othptab.c 2006-01-07 23:27:48.000000000 +0100
735 +++ ./iptraf-3.0.0/src/othptab.c 2006-01-08 05:23:13.000000000 +0100
738 #include <linux/netdevice.h>
739 #include <linux/if_fddi.h>
740 +#include <netinet/ip6.h>
741 +#include <netinet/icmp6.h>
746 char *ifname, int *nomem)
749 + struct ip6_hdr *ip6;
751 struct tcptableent *tcpentry;
753 ip = (struct iphdr *) (packet + 8);
755 - if (ip->protocol != IPPROTO_TCP)
758 - tcp = (struct tcphdr *) (packet + 8 + (ip->ihl * 4));
761 * We really won't be making use of nomem here. Timeout checking
762 * won't be performed either, so we just pass NULL as the pointer
764 * and set its internal timeout variable to 0.
767 - tcpentry = in_table(table, ip->saddr, ip->daddr,
768 + if (ip->version == 6)
770 + ip6 = (struct ip6_hdr *) (packet + 8);
771 + if (ip6->ip6_nxt != IPPROTO_TCP)
773 + tcp = (struct tcphdr *) (packet + 48);
774 + tcpentry = in_table(table, 0, 0, ip6->ip6_src.s6_addr, ip6->ip6_dst.s6_addr,
775 ntohs(tcp->source), ntohs(tcp->dest), ifname,
776 0, NULL, nomem, NULL);
778 + if (ip->protocol != IPPROTO_TCP)
780 + tcp = (struct tcphdr *) (packet + 8 + (ip->ihl * 4));
781 + tcpentry = in_table(table, ip->saddr, ip->daddr, NULL, NULL,
782 + ntohs(tcp->source), ntohs(tcp->dest), ifname,
783 + 0, NULL, nomem, NULL);
786 if (tcpentry != NULL) {
787 tcpentry->stat = tcpentry->oth_connection->stat = FLAG_RST;
789 struct othptabent *add_othp_entry(struct othptable *table,
790 struct tcptable *tcptab,
791 unsigned long saddr, unsigned long daddr,
792 + struct in6_addr *s6addr, struct in6_addr *d6addr,
793 int is_ip, int protocol,
794 unsigned short linkproto, char *packet,
795 char *packet2, unsigned int br,
796 @@ -153,10 +166,18 @@
798 new_entry->saddr = isaddr.s_addr = saddr;
799 new_entry->daddr = idaddr.s_addr = daddr;
801 - revname(rev_lookup, &isaddr, new_entry->s_fqdn, rvnfd);
802 - revname(rev_lookup, &idaddr, new_entry->d_fqdn, rvnfd);
804 + if (s6addr != NULL)
805 + memcpy(&new_entry->s6addr, s6addr, 16);
807 + memset(&new_entry->s6addr, 0, 16);
809 + if (d6addr != NULL)
810 + memcpy(&new_entry->d6addr, d6addr, 16);
812 + memset(&new_entry->s6addr, 0, 16);
814 + revname(rev_lookup, &isaddr, s6addr, new_entry->s_fqdn, rvnfd);
815 + revname(rev_lookup, &idaddr, d6addr, new_entry->d_fqdn, rvnfd);
817 if (protocol == IPPROTO_ICMP) {
818 new_entry->un.icmp.type =
820 wattrset(table->othpwin, GREATTR);
821 strcpy(protname, "GRE");
823 + case IPPROTO_ICMPV6:
824 + wattrset(table->othpwin, ICMPV6ATTR);
825 + strcpy(protname, "ICMPv6");
828 + wattrset(table->othpwin, IPV6ATTR);
829 + strcpy(protname, "IPv6 tun");
832 wattrset(table->othpwin, UNKNIPATTR);
833 protptr = getprotobynumber(entry->protocol);
835 strcpy(description, "bad/unkn");
839 + } else if (entry->protocol == IPPROTO_ICMPV6) {
840 + switch (entry->un.icmp6.type) {
841 + case ICMP6_DST_UNREACH:
842 + strcpy(description, "dest unrch");
843 + switch (entry->un.icmp6.code) {
844 + case ICMP6_DST_UNREACH_NOROUTE:
845 + strcpy(additional, "no route");
847 + case ICMP6_DST_UNREACH_ADMIN:
848 + strcpy(additional, "admin");
850 + case ICMP6_DST_UNREACH_NOTNEIGHBOR:
851 + strcpy(additional, "not neigh");
853 + case ICMP6_DST_UNREACH_ADDR:
854 + strcpy(additional, "unreach addr");
856 + case ICMP6_DST_UNREACH_NOPORT:
857 + strcpy(additional, "no port");
861 + case ICMP6_PACKET_TOO_BIG:
862 + strcpy(description, "pkt too big");
864 + case ICMP6_TIME_EXCEEDED:
865 + strcpy(description, "time exceeded");
867 + case ICMP6_PARAM_PROB:
868 + strcpy(description, "param prob");
870 + case ICMP6_ECHO_REQUEST:
871 + strcpy(description, "echo req");
873 + case ICMP6_ECHO_REPLY:
874 + strcpy(description, "echo rply");
876 + case ND_ROUTER_SOLICIT:
877 + strcpy(description, "router sol");
879 + case ND_ROUTER_ADVERT:
880 + strcpy(description, "router adv");
882 + case ICMP6_MEMBERSHIP_QUERY:
883 + strcpy(description, "mbrship query");
885 + case ICMP6_MEMBERSHIP_REPORT:
886 + strcpy(description, "mbrship report");
888 + case ICMP6_MEMBERSHIP_REDUCTION:
889 + strcpy(description, "mbrship reduc");
891 + case ND_NEIGHBOR_SOLICIT:
892 + strcpy(description, "neigh sol");
894 + case ND_NEIGHBOR_ADVERT:
895 + strcpy(description, "neigh adv");
898 + strcpy(description, "redirect");
901 + strcpy(description, "bad/unkn");
904 } else if (entry->protocol == IPPROTO_OSPFIGP) {
905 switch (entry->un.ospf.type) {
906 case OSPF_TYPE_HELLO:
907 @@ -564,11 +657,11 @@
908 strcat(msgstring, scratchpad);
910 if ((entry->protocol == IPPROTO_UDP) && (!(entry->fragment))) {
911 - sprintf(scratchpad, "from %.25s:%s to %.25s:%s",
912 + sprintf(scratchpad, "from %.40s:%s to %.40s:%s",
913 entry->s_fqdn, entry->un.udp.s_sname,
914 entry->d_fqdn, entry->un.udp.d_sname);
916 - sprintf(scratchpad, "from %.25s to %.25s", entry->s_fqdn,
917 + sprintf(scratchpad, "from %.40s to %.40s", entry->s_fqdn,
921 --- ./iptraf-3.0.0.orig/src/othptab.h 2005-09-13 08:42:54.000000000 +0200
922 +++ ./iptraf-3.0.0/src/othptab.h 2006-01-08 05:29:02.000000000 +0100
925 unsigned long int saddr;
926 unsigned long int daddr;
927 + struct in6_addr s6addr;
928 + struct in6_addr d6addr;
931 unsigned short linkproto;
933 char src_mac_address[6];
934 char dest_mac_address[6];
944 struct othptabent *add_othp_entry(struct othptable *table,
945 struct tcptable *tcptab,
947 - unsigned long daddr, int is_ip,
948 - int protocol, unsigned short linkproto,
949 - char *packet, char *netpacket,
950 + unsigned long daddr, struct in6_addr *s6addr,
951 + struct in6_addr *d6addr, int is_ip, int protocol,
952 + unsigned short linkproto, char *packet, char *netpacket,
953 unsigned int br, char *ifname,
954 int *rev_lookup, int rvnamedon,
955 unsigned int tm, int logging,
956 --- ./iptraf-3.0.0.orig/src/packet.c 2006-01-07 23:27:48.000000000 +0100
957 +++ ./iptraf-3.0.0/src/packet.c 2006-01-08 05:23:43.000000000 +0100
959 #include <sys/socket.h>
960 #include <netinet/in.h>
961 #include <netinet/ip.h>
962 +#include <netinet/ip6.h>
963 #include <netinet/tcp.h>
964 #include <sys/time.h>
965 #include <net/if_arp.h>
968 static char aligned_buf[ALIGNED_BUF_LEN];
970 + struct ip6_hdr *ip6;
972 register int ip_checksum;
975 * Apply non-IP packet filter
978 - if (fromaddr->sll_protocol != ETH_P_IP) {
979 + if ((fromaddr->sll_protocol != ETH_P_IP) && (fromaddr->sll_protocol != ETH_P_IPV6)) {
980 if ((fromaddr->sll_protocol == ETH_P_ARP) ||
981 (fromaddr->sll_protocol == ETH_P_RARP)) {
982 if (!nonipfilter(filter, fromaddr->sll_protocol)) {
988 - * TODO: Insert IPv6 processing code here
990 + if (fromaddr->sll_protocol == ETH_P_IP) {
993 * At this point, we're now processing IP packets. Start by getting
996 hdr_check = in_cksum((u_short *) ip, iphlen);
998 - if (hdr_check != ip_checksum)
999 + if ((hdr_check != ip_checksum))
1000 return CHECKSUM_ERROR;
1002 if ((ip->protocol == IPPROTO_TCP || ip->protocol == IPPROTO_UDP) &&
1003 @@ -458,9 +458,28 @@
1004 ip->protocol, match_opposite,
1006 return PACKET_FILTERED;
1013 + else if (fromaddr->sll_protocol == ETH_P_IPV6) {
1014 + ip6 = (struct ip6_hdr *) (*packet);
1016 + //TODO: Filter packets
1017 + if (ip6->ip6_nxt == IPPROTO_TCP) {
1018 + in_ip.tcp = (struct tcphdr *) ((char *) ip6 + iphlen);
1019 + if (sport != NULL)
1020 + *sport = in_ip.tcp->source;
1021 + if (dport != NULL)
1022 + *dport = in_ip.tcp->dest;
1023 + } else if (ip6->ip6_nxt == IPPROTO_UDP) {
1024 + in_ip.udp = (struct udphdr *) ((char *) ip6 + iphlen);
1025 + if (sport != NULL)
1026 + *sport = in_ip.udp->source;
1027 + if (dport != NULL)
1028 + *dport = in_ip.udp->dest;
1034 void pkt_cleanup(void)
1035 --- ./iptraf-3.0.0.orig/src/revname.c 2005-09-13 08:42:54.000000000 +0200
1036 +++ ./iptraf-3.0.0/src/revname.c 2006-01-08 05:24:43.000000000 +0100
1041 -int revname(int *lookup, struct in_addr *saddr, char *target, int rvnfd)
1042 +int revname(int *lookup, struct in_addr *saddr, struct in6_addr *s6addr, char *target, int rvnfd)
1046 @@ -173,6 +173,11 @@
1047 rpkt.type = RVN_REQUEST;
1048 rpkt.saddr.s_addr = saddr->s_addr;
1050 + if (s6addr != NULL)
1051 + memcpy(rpkt.s6addr.s6_addr, s6addr->s6_addr, 16);
1053 + memset(rpkt.s6addr.s6_addr, 0, 4);
1055 sendto(rvnfd, &rpkt, sizeof(struct rvn), 0,
1056 (struct sockaddr *) &su,
1057 sizeof(su.sun_family) + strlen(su.sun_path));
1058 @@ -197,7 +202,10 @@
1059 } while ((br < 0) && (errno == EINTR));
1062 + if (saddr->s_addr != 0)
1063 strcpy(target, inet_ntoa(*saddr));
1065 + inet_ntop(AF_INET6, s6addr, target, 44);
1069 @@ -205,18 +213,26 @@
1070 strncpy(target, rpkt.fqdn, 44);
1071 return (rpkt.ready);
1073 - he = gethostbyaddr((char *) saddr,
1074 - sizeof(struct in_addr), AF_INET);
1075 + if (saddr->s_addr != 0)
1076 + he = gethostbyaddr((char *) saddr, sizeof(struct in_addr), AF_INET);
1078 + he = gethostbyaddr((char *) s6addr, sizeof(struct in6_addr), AF_INET6);
1082 + if (saddr->s_addr != 0)
1083 strcpy(target, inet_ntoa(*saddr));
1085 + inet_ntop(AF_INET6, s6addr, target, 44);
1087 strncpy(target, he->h_name, 44);
1093 - strcpy(target, inet_ntoa(*saddr));
1095 + if (saddr->s_addr != 0 || s6addr == NULL)
1096 + strcpy(target, inet_ntoa(*saddr));
1098 + inet_ntop(AF_INET6, s6addr, target, 44);
1101 --- ./iptraf-3.0.0.orig/src/revname.h 2005-09-13 08:42:54.000000000 +0200
1102 +++ ./iptraf-3.0.0/src/revname.h 2006-01-08 05:24:54.000000000 +0100
1105 void open_rvn_socket(int *fd);
1106 void close_rvn_socket(int fd);
1107 -int revname(int *lookup, struct in_addr *saddr, char *target, int rvnfd);
1109 +int revname(int *lookup, struct in_addr *saddr, struct in6_addr *s6addr, char *target, int rvnfd);
1110 --- ./iptraf-3.0.0.orig/src/rvnamed.c 2005-09-13 08:42:54.000000000 +0200
1111 +++ ./iptraf-3.0.0/src/rvnamed.c 2006-01-08 05:25:36.000000000 +0100
1116 + uint8_t addr6[16];
1122 ccfd = socket(PF_UNIX, SOCK_DGRAM, 0);
1124 - he = gethostbyaddr((char *) &(rvnpacket->saddr),
1125 - sizeof(struct in_addr), AF_INET);
1126 + if (rvnpacket->saddr.s_addr != 0)
1127 + he = gethostbyaddr((char *) &(rvnpacket->saddr), sizeof(struct in_addr), AF_INET);
1129 + he = gethostbyaddr((char *) &(rvnpacket->s6addr), sizeof(struct in6_addr), AF_INET6);
1133 + if (rvnpacket->saddr.s_addr != 0)
1134 strcpy(rvnpacket->fqdn, inet_ntoa(rvnpacket->saddr));
1137 + inet_ntop(AF_INET6, &(rvnpacket->s6addr), rvnpacket->fqdn, sizeof(rvnpacket->fqdn));
1139 bzero(rvnpacket->fqdn, 45);
1140 strncpy(rvnpacket->fqdn, he->h_name, 44);
1142 @@ -122,10 +128,14 @@
1145 while (i != lastfree) {
1146 + if (rvnpacket->saddr.s_addr != 0) {
1147 if ((rvnpacket->saddr.s_addr == hostlist[i].addr)
1148 && (hostlist[i].ready == RESOLVED))
1152 + if (!memcmp(rvnpacket->s6addr.s6_addr, hostlist[i].addr6, sizeof(hostlist[i].addr6)))
1161 while (hi <= lastfree) {
1162 - if (hostlist[hi].addr == rvnpacket.saddr.s_addr)
1163 + if ((hostlist[hi].addr == rvnpacket.saddr.s_addr) &&
1164 + !memcmp(rvnpacket.s6addr.s6_addr, hostlist[hi].addr6, sizeof(hostlist[hi].addr6)))
1171 hostlist[hi].addr = rvnpacket.saddr.s_addr;
1172 + memcpy(hostlist[hi].addr6, rvnpacket.s6addr.s6_addr, sizeof(hostlist[hi].addr6));
1174 strncpy(hostlist[hi].fqdn, rvnpacket.fqdn, 44);
1178 hostlist[hostindex].addr =
1179 rvnpacket.saddr.s_addr;
1180 + memcpy(hostlist[hostindex].addr6, rvnpacket.s6addr.s6_addr,
1181 + sizeof(hostlist[hostindex].addr6));
1182 hostlist[hostindex].ready = RESOLVING;
1185 @@ -455,7 +469,10 @@
1187 rvnpacket.type = RVN_REPLY;
1188 bzero(rvnpacket.fqdn, 45);
1189 + if (rvnpacket.saddr.s_addr != 0)
1190 strcpy(rvnpacket.fqdn, inet_ntoa(rvnpacket.saddr));
1192 + inet_ntop(AF_INET6, &rvnpacket.s6addr, rvnpacket.fqdn, sizeof(rvnpacket.fqdn));
1193 rvnpacket.ready = RESOLVING;
1195 br = sendto(ifd, &rvnpacket, sizeof(struct rvn), 0,
1196 --- ./iptraf-3.0.0.orig/src/rvnamed.h 2005-09-13 08:42:54.000000000 +0200
1197 +++ ./iptraf-3.0.0/src/rvnamed.h 2006-01-08 05:25:41.000000000 +0100
1201 struct in_addr saddr;
1202 + struct in6_addr s6addr;
1205 --- ./iptraf-3.0.0.orig/src/serv.c 2005-09-13 08:42:54.000000000 +0200
1206 +++ ./iptraf-3.0.0/src/serv.c 2006-01-08 05:26:03.000000000 +0100
1208 #include <sys/socket.h>
1209 #include <netinet/in.h>
1210 #include <netinet/ip.h>
1211 +#include <netinet/ip6.h>
1212 #include <netinet/udp.h>
1213 #include <linux/if_packet.h>
1214 #include <linux/if_ether.h>
1215 @@ -1032,6 +1033,8 @@
1216 if (pkt_result != PACKET_OK)
1219 + if (fromaddr.sll_protocol == ETH_P_IP) {
1221 if ((((struct iphdr *) ipacket)->protocol == IPPROTO_TCP)
1222 || (((struct iphdr *) ipacket)->protocol == IPPROTO_UDP)) {
1223 updateportent(&list, ((struct iphdr *) ipacket)->protocol,
1224 @@ -1049,6 +1052,26 @@
1229 + if ((((struct ip6_hdr *) ipacket)->ip6_nxt == IPPROTO_TCP)
1230 + || (((struct ip6_hdr *) ipacket)->ip6_nxt ==
1232 + updateportent(&list, ((struct ip6_hdr *) ipacket)->ip6_nxt,
1234 + ntohs(((struct ip6_hdr *) ipacket)->ip6_plen + 40),
1235 + idx, 0, ports, options->servnames);
1236 + updateportent(&list, ((struct ip6_hdr *) ipacket)->ip6_nxt,
1238 + ntohs(((struct ip6_hdr *) ipacket)->ip6_plen + 40),
1239 + idx, 1, ports, options->servnames);
1240 + if ((list.barptr == NULL) && (list.head != NULL)) {
1241 + set_barptr((char **) &(list.barptr), (char *) list.head,
1242 + &(list.head->starttime), (char *) &(list.head->spans),
1243 + sizeof(struct serv_spans), statwin, &statcleared, statx);
1251 --- ./iptraf-3.0.0.orig/src/tcptable.c 2005-09-13 08:42:54.000000000 +0200
1252 +++ ./iptraf-3.0.0/src/tcptable.c 2006-01-08 05:27:39.000000000 +0100
1254 * The hash function for the TCP hash table
1257 -unsigned int tcp_hash(unsigned long saddr, unsigned int sport,
1258 - unsigned long daddr, unsigned int dport,
1259 +unsigned int tcp_hash(unsigned long saddr, uint32_t *s6addr, unsigned int sport,
1260 + unsigned long daddr, uint32_t *d6addr, unsigned int dport,
1265 for (i = 0; i <= strlen(ifname) - 1; i++)
1268 + if (s6addr != 0 && d6addr != 0) {
1269 + for (i = 0; i < 4; i++) {
1270 + saddr ^= s6addr[i];
1271 + daddr ^= d6addr[i];
1275 return ((ifsum + (4 * saddr) + (3 * sport) +
1276 (2 * daddr) + dport) % ENTRIES_IN_HASH_TABLE);
1279 unsigned int hp; /* hash position in table */
1280 struct tcp_hashentry *ptmp;
1282 - hp = tcp_hash(entry->saddr.s_addr, entry->sport,
1283 - entry->daddr.s_addr, entry->dport, entry->ifname);
1284 + hp = tcp_hash(entry->saddr.s_addr, entry->s6addr.s6_addr32, entry->sport,
1285 + entry->daddr.s_addr, entry->d6addr.s6_addr32, entry->dport, entry->ifname);
1287 ptmp = malloc(sizeof(struct tcp_hashentry));
1288 bzero(ptmp, sizeof(struct tcp_hashentry));
1290 struct tcptableent *addentry(struct tcptable *table,
1291 unsigned long int saddr,
1292 unsigned long int daddr,
1295 unsigned int sport, unsigned int dport,
1297 char *ifname, int *rev_lookup,
1298 @@ -311,8 +320,22 @@
1300 new_entry->saddr.s_addr = new_entry->oth_connection->daddr.s_addr =
1302 + if (s6addr == NULL) {
1303 + memset(&new_entry->s6addr, 0, 16);
1304 + memset(&new_entry->oth_connection->d6addr, 0, 16);
1306 + memcpy(&new_entry->s6addr, s6addr, 16);
1307 + memcpy(&new_entry->oth_connection->d6addr, s6addr, 16);
1309 new_entry->daddr.s_addr = new_entry->oth_connection->saddr.s_addr =
1311 + if (d6addr == NULL) {
1312 + memset(&new_entry->d6addr, 0, 16);
1313 + memset(&new_entry->oth_connection->s6addr, 0, 16);
1315 + memcpy(&new_entry->d6addr, d6addr, 16);
1316 + memcpy(&new_entry->oth_connection->s6addr, d6addr, 16);
1318 new_entry->protocol = protocol;
1321 @@ -349,9 +372,10 @@
1323 new_entry->stat = new_entry->oth_connection->stat = 0;
1325 - new_entry->s_fstat = revname(rev_lookup, &(new_entry->saddr),
1326 + new_entry->s_fstat = revname(rev_lookup, &(new_entry->saddr), &new_entry->s6addr,
1327 new_entry->s_fqdn, rvnfd);
1328 - new_entry->d_fstat = revname(rev_lookup, &(new_entry->daddr),
1330 + new_entry->d_fstat = revname(rev_lookup, &(new_entry->daddr), &new_entry->d6addr,
1331 new_entry->d_fqdn, rvnfd);
1337 struct tcptableent *in_table(struct tcptable *table, unsigned long saddr,
1338 - unsigned long daddr, unsigned int sport,
1339 + unsigned long daddr, uint8_t *s6addr,
1340 + uint8_t *d6addr, unsigned int sport,
1341 unsigned int dport, char *ifname,
1342 int logging, FILE * logfile,
1343 int *nomem, struct OPTIONS *opts)
1352 timeout = opts->timeout;
1354 @@ -515,12 +543,24 @@
1355 * Determine hash table index for this set of addresses and ports
1358 - hp = tcp_hash(saddr, sport, daddr, dport, ifname);
1359 + hp = tcp_hash(saddr, (uint32_t*) s6addr, sport, daddr, (uint32_t*) d6addr, dport, ifname);
1360 hashptr = table->hash_table[hp];
1362 + if (s6addr == NULL) {
1363 + s6addr = malloc(sizeof(struct in6_addr));
1364 + memset(s6addr, 0, 16);
1367 + if (d6addr == NULL) {
1368 + d6addr = malloc(sizeof(struct in6_addr));
1369 + memset(d6addr, 0, 16);
1372 while (hashptr != NULL) {
1373 if ((hashptr->tcpnode->saddr.s_addr == saddr) &&
1374 + (!memcmp(&hashptr->tcpnode->s6addr.s6_addr, s6addr, 16)) &&
1375 (hashptr->tcpnode->daddr.s_addr == daddr) &&
1376 + (!memcmp(&hashptr->tcpnode->d6addr.s6_addr, d6addr, 16)) &&
1377 (hashptr->tcpnode->sport == sport) &&
1378 (hashptr->tcpnode->dport == dport) &&
1379 (strcmp(hashptr->tcpnode->ifname, ifname) == 0))
1381 hashptr = hashptr->next_entry;
1384 + if (sfree) free(s6addr);
1385 + if (dfree) free(d6addr);
1387 if (hashptr != NULL) { /* needed to avoid SIGSEGV */
1388 if ((((hashptr->tcpnode->finsent == 2) &&
1389 (hashptr->tcpnode->oth_connection->finsent == 2))) ||
1390 @@ -579,13 +622,13 @@
1391 char newmacaddr[15];
1393 if (tableentry->s_fstat != RESOLVED) {
1394 - tableentry->s_fstat = revname(revlook, &(tableentry->saddr),
1395 + tableentry->s_fstat = revname(revlook, &(tableentry->saddr), &(tableentry->s6addr),
1396 tableentry->s_fqdn, rvnfd);
1397 strcpy(tableentry->oth_connection->d_fqdn, tableentry->s_fqdn);
1398 tableentry->oth_connection->d_fstat = tableentry->s_fstat;
1400 if (tableentry->d_fstat != RESOLVED) {
1401 - tableentry->d_fstat = revname(revlook, &(tableentry->daddr),
1402 + tableentry->d_fstat = revname(revlook, &(tableentry->daddr), &(tableentry->d6addr),
1403 tableentry->d_fqdn, rvnfd);
1404 strcpy(tableentry->oth_connection->s_fqdn, tableentry->d_fqdn);
1405 tableentry->oth_connection->s_fstat = tableentry->d_fstat;
1406 --- ./iptraf-3.0.0.orig/src/tcptable.h 2006-01-07 23:27:48.000000000 +0100
1407 +++ ./iptraf-3.0.0/src/tcptable.h 2006-01-08 05:27:52.000000000 +0100
1409 struct tcptableent {
1410 struct in_addr saddr;
1411 struct in_addr daddr;
1412 + struct in6_addr s6addr;
1413 + struct in6_addr d6addr;
1414 char s_fqdn[45]; /* fully-qualified domain names */
1418 struct tcptableent *addentry(struct tcptable *table,
1419 unsigned long int saddr,
1420 unsigned long int daddr,
1421 + uint8_t *s6addr, uint8_t *d6addr,
1422 unsigned int sport, unsigned int dport,
1424 char *ifname, int *rev_lookup, int rvnamedon,
1427 struct tcptableent *in_table(struct tcptable *table,
1428 unsigned long saddr, unsigned long daddr,
1429 + uint8_t *s6addr, uint8_t *d6addr,
1430 unsigned int sport, unsigned int dport,
1432 int logging, FILE * logfile, int *nomem,