1 diff -ruN iptraf-2.7.0-old/src/dirs.h iptraf-2.7.0-new/src/dirs.h
2 --- iptraf-2.7.0-old/src/dirs.h 2001-05-03 12:44:11.000000000 +0200
3 +++ iptraf-2.7.0-new/src/dirs.h 2005-10-04 21:51:26.000000000 +0200
5 #define PORTFILE get_path(T_WORKDIR, "ports.dat")
8 - * The Ethernet and FDDI host description files
9 + * The Ethernet host description files
12 #define ETHFILE get_path(T_WORKDIR, "ethernet.desc")
13 -#define FDDIFILE get_path(T_WORKDIR, "fddi.desc")
16 * The rvnamed program file
17 diff -ruN iptraf-2.7.0-old/src/hostmon.c iptraf-2.7.0-new/src/hostmon.c
18 --- iptraf-2.7.0-old/src/hostmon.c 2002-04-16 04:15:25.000000000 +0200
19 +++ iptraf-2.7.0-new/src/hostmon.c 2005-10-04 21:52:02.000000000 +0200
21 #include <netinet/in.h>
22 #include <linux/if_packet.h>
23 #include <linux/if_ether.h>
24 -#include <linux/if_fddi.h>
25 #include <linux/if_tr.h>
26 #include <net/if_arp.h>
29 wprintw(table->tabwin, "Ethernet");
30 else if (entry->un.desc.linktype == LINK_PLIP)
31 wprintw(table->tabwin, "PLIP");
32 - else if (entry->un.desc.linktype == LINK_FDDI)
33 - wprintw(table->tabwin, "FDDI");
35 wprintw(table->tabwin, " HW addr: %s", entry->un.desc.ascaddr);
39 initethtab(&table, options->actmode);
40 loaddesclist(&elist, LINK_ETHERNET, WITHETCETHERS);
41 - loaddesclist(&flist, LINK_FDDI, WITHETCETHERS);
44 if (strcmp(current_logfile, "") == 0)
47 linktype = getlinktype(fromaddr.sll_hatype, ifname, -1, NULL);
49 - if ((linktype == LINK_ETHERNET) || (linktype == LINK_FDDI)
50 + if ((linktype == LINK_ETHERNET)
51 || (linktype == LINK_PLIP) || (linktype == LINK_TR)) {
52 if (fromaddr.sll_protocol == htons(ETH_P_IP))
55 memcpy(scratch_daddr, ((struct ethhdr *) buf)->h_dest,
58 - } else if (linktype == LINK_FDDI) {
59 - memcpy(scratch_saddr, ((struct fddihdr *) buf)->saddr,
61 - memcpy(scratch_daddr, ((struct fddihdr *) buf)->daddr,
64 } else if (linktype == LINK_TR) {
65 memcpy(scratch_saddr, ((struct trh_hdr *) buf)->saddr,
67 diff -ruN iptraf-2.7.0-old/src/ifaces.c iptraf-2.7.0-new/src/ifaces.c
68 --- iptraf-2.7.0-old/src/ifaces.c 2002-05-08 11:43:27.000000000 +0200
69 +++ iptraf-2.7.0-new/src/ifaces.c 2005-10-04 21:54:00.000000000 +0200
71 extern int daemonized;
74 - { "lo", "eth", "sl", "ppp", "ippp", "plip", "fddi", "isdn", "dvb",
75 + { "lo", "eth", "sl", "ppp", "ippp", "plip", "isdn", "dvb",
76 "pvc", "hdlc", "ipsec", "sbni", "tr", "wvlan", "wlan", "sm2", "sm3",
78 + "pent", "lec", "vlan" };
80 char *ltrim(char *buf)
82 diff -ruN iptraf-2.7.0-old/src/landesc.c iptraf-2.7.0-new/src/landesc.c
83 --- iptraf-2.7.0-old/src/landesc.c 2001-11-27 11:23:32.000000000 +0100
84 +++ iptraf-2.7.0-new/src/landesc.c 2005-10-04 21:57:33.000000000 +0200
87 if (linktype == LINK_ETHERNET)
88 fd = fopen(ETHFILE, "r");
89 - else if (linktype == LINK_FDDI)
90 - fd = fopen(FDDIFILE, "r");
96 if (linktype == LINK_ETHERNET)
97 fd = fopen(ETHFILE, "w");
98 - else if (linktype == LINK_FDDI)
99 - fd = fopen(FDDIFILE, "w");
103 diff -ruN iptraf-2.7.0-old/src/links.h iptraf-2.7.0-new/src/links.h
104 --- iptraf-2.7.0-old/src/links.h 2001-12-18 03:45:16.000000000 +0100
105 +++ iptraf-2.7.0-new/src/links.h 2005-10-04 21:57:17.000000000 +0200
107 #define LINK_LOOPBACK 5
108 #define LINK_ISDN_RAWIP 6
109 #define LINK_ISDN_CISCOHDLC 7
114 diff -ruN iptraf-2.7.0-old/src/log.c iptraf-2.7.0-new/src/log.c
115 --- iptraf-2.7.0-old/src/log.c 2002-04-22 05:59:15.000000000 +0200
116 +++ iptraf-2.7.0-new/src/log.c 2005-10-04 21:57:51.000000000 +0200
118 ptmp->un.desc.ascaddr);
119 else if (ptmp->un.desc.linktype == LINK_PLIP)
120 fprintf(fd, "\nPLIP address: %s", ptmp->un.desc.ascaddr);
121 - else if (ptmp->un.desc.linktype == LINK_FDDI)
122 - fprintf(fd, "\nFDDI address: %s", ptmp->un.desc.ascaddr);
124 if (ptmp->un.desc.withdesc)
125 fprintf(fd, " (%s)", ptmp->un.desc.desc);
126 diff -ruN iptraf-2.7.0-old/src/options.c iptraf-2.7.0-new/src/options.c
127 --- iptraf-2.7.0-old/src/options.c 2001-12-28 10:39:15.000000000 +0100
128 +++ iptraf-2.7.0-new/src/options.c 2005-10-04 21:58:15.000000000 +0200
130 tx_additem(menu, NULL, NULL);
131 tx_additem(menu, " ^E^thernet/PLIP host descriptions...",
132 "Manages descriptions for Ethernet and PLIP addresses");
133 - tx_additem(menu, " ^F^DDI/Token Ring host descriptions...",
134 - "Manages descriptions for FDDI and FDDI addresses");
135 tx_additem(menu, NULL, NULL);
136 tx_additem(menu, " E^x^it configuration", "Returns to main menu");
140 ethdescmgr(LINK_ETHERNET);
143 - ethdescmgr(LINK_FDDI);
147 indicatesetting(row, options, statwin);
148 diff -ruN iptraf-2.7.0-old/src/othptab.c iptraf-2.7.0-new/src/othptab.c
149 --- iptraf-2.7.0-old/src/othptab.c 2001-12-28 03:23:59.000000000 +0100
150 +++ iptraf-2.7.0-new/src/othptab.c 2005-10-04 21:58:33.000000000 +0200
152 #include <asm/types.h>
153 #include <linux/if_ether.h>
154 #include <linux/if_tr.h>
155 -#include <linux/if_fddi.h>
160 new_entry->smacaddr);
161 convmacaddr(((struct ethhdr *) packet)->h_dest,
162 new_entry->dmacaddr);
163 - } else if (linkproto == LINK_FDDI) {
164 - convmacaddr(((struct fddihdr *) packet)->saddr,
165 - new_entry->smacaddr);
166 - convmacaddr(((struct fddihdr *) packet)->daddr,
167 - new_entry->dmacaddr);
168 } else if (linkproto == LINK_TR) {
169 convmacaddr(((struct trh_hdr *) packet)->saddr,
170 new_entry->smacaddr);
172 strcat(msgstring, scratchpad);
174 if ((entry->linkproto == LINK_ETHERNET) ||
175 - (entry->linkproto == LINK_PLIP) ||
176 - (entry->linkproto == LINK_FDDI)) {
177 + (entry->linkproto == LINK_PLIP)) {
178 sprintf(scratchpad, " from %s to %s on %s",
179 entry->smacaddr, entry->dmacaddr, entry->iface);
181 diff -ruN iptraf-2.7.0-old/src/packet.c iptraf-2.7.0-new/src/packet.c
182 --- iptraf-2.7.0-old/src/packet.c 2002-05-08 11:44:08.000000000 +0200
183 +++ iptraf-2.7.0-new/src/packet.c 2005-10-04 21:59:12.000000000 +0200
185 #include <sys/ioctl.h>
186 #include <linux/if_packet.h>
187 #include <linux/if_ether.h>
188 -#include <linux/if_fddi.h>
189 #include <linux/if_tr.h>
190 #include <linux/isdn.h>
191 #include <linux/sockios.h>
194 if (strncmp(ifname, "eth", 3) == 0)
195 result = LINK_ETHERNET;
196 + else if (strncmp(ifname, "vlan", 4) == 0)
197 + result = LINK_ETHERNET;
198 else if (strncmp(ifname, "plip", 4) == 0)
200 - else if (strncmp(ifname, "fddi", 4) == 0) /* For some Ethernet- */
201 - result = LINK_ETHERNET; /* emulated FDDI ifaces */
202 else if (strncmp(ifname, "dvb", 3) == 0)
203 result = LINK_ETHERNET;
204 else if (strncmp(ifname, "sbni", 4) == 0)
210 - result = LINK_FDDI;
213 case ARPHRD_IEEE802_TR:
216 *packet = tpacket + 4;
220 - *packet = tpacket + sizeof(struct fddihdr);
221 - *readlen -= sizeof(struct fddihdr);
224 - * Move IP data into an aligned buffer. 96 bytes should be sufficient
225 - * for IP and TCP headers with reasonable numbers of options and some
229 - memmove(aligned_buf, *packet, min(SNAPSHOT_LEN, *readlen));
230 - *packet = aligned_buf;
234 * Token Ring patch supplied by Tomas Dvorak
235 diff -ruN iptraf-2.7.0-old/src/promisc.c iptraf-2.7.0-new/src/promisc.c
236 --- iptraf-2.7.0-old/src/promisc.c 2002-01-16 02:51:03.000000000 +0100
237 +++ iptraf-2.7.0-new/src/promisc.c 2005-10-04 22:05:25.000000000 +0200
241 if ((strncmp(buf, "eth", 3) == 0) ||
242 - (strncmp(buf, "fddi", 4) == 0) ||
243 + (strncmp(buf, "vlan", 4) == 0) ||
244 (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
245 (strncmp(ptmp->params.ifname, "lec", 3) == 0) ||
246 (accept_unsupported_interfaces)) {
249 while (ptmp != NULL) {
250 if (((strncmp(ptmp->params.ifname, "eth", 3) == 0) ||
251 - (strncmp(ptmp->params.ifname, "fddi", 4) == 0) ||
252 + (strncmp(ptmp->params.ifname, "vlan", 4) == 0) ||
253 (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
254 (strncmp(ptmp->params.ifname, "lec", 3) == 0)) &&
255 (ptmp->params.state_valid)) {
256 diff -ruN iptraf-2.7.0-old/src/promisc.~c iptraf-2.7.0-new/src/promisc.~c
257 --- iptraf-2.7.0-old/src/promisc.~c 1970-01-01 01:00:00.000000000 +0100
258 +++ iptraf-2.7.0-new/src/promisc.~c 2005-10-04 22:00:02.000000000 +0200
262 +promisc.c - handles the promiscuous mode flag for the Ethernet/FDDI
265 +Written by Gerard Paul Java
266 +Copyright (c) Gerard Paul Java 1997, 1998
268 +This module contains functions that manage the promiscuous states of
271 +This software is open source; you can redistribute it and/or modify
272 +it under the terms of the GNU General Public License as published by
273 +the Free Software Foundation; either version 2 of the License, or
274 +(at your option) any later version.
276 +This program is distributed WITHOUT ANY WARRANTY; without even the
277 +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
278 +See the GNU General Public License in the included COPYING file for
285 +#include <sys/ioctl.h>
286 +#include <sys/socket.h>
287 +#include <sys/types.h>
288 +#include <sys/stat.h>
293 +#include <netinet/in.h>
295 +#include <linux/if_ether.h>
296 +#include "ifstats.h"
299 +#include "promisc.h"
302 +#define PROMISC_MSG_MAX 80
304 +extern int daemonized;
305 +extern int accept_unsupported_interfaces;
307 +void init_promisc_list(struct promisc_states **list)
312 + struct promisc_states *ptmp;
313 + struct promisc_states *tail = NULL;
318 + ifd = socket(PF_INET, SOCK_DGRAM, 0);
321 + fd = open_procnetdev();
324 + get_next_iface(fd, buf);
326 + if (strcmp(buf, "") != 0) {
327 + ptmp = malloc(sizeof(struct promisc_states));
328 + strcpy(ptmp->params.ifname, buf);
330 + if (*list == NULL) {
333 + tail->next_entry = ptmp;
336 + ptmp->next_entry = NULL;
339 + * Retrieve and save interface flags
342 + if ((strncmp(buf, "eth", 3) == 0) ||
343 + (strncmp(buf, "vlan", 4) == 0) ||
344 + (strncmp(buf, "fddi", 4) == 0) ||
345 + (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
346 + (strncmp(ptmp->params.ifname, "lec", 3) == 0) ||
347 + (accept_unsupported_interfaces)) {
348 + strcpy(ifr.ifr_name, buf);
350 + istat = ioctl(ifd, SIOCGIFFLAGS, &ifr);
354 + "Unable to obtain interface parameters for %s",
356 + write_error(err_msg, daemonized);
357 + ptmp->params.state_valid = 0;
359 + ptmp->params.saved_state = ifr.ifr_flags;
360 + ptmp->params.state_valid = 1;
364 + } while (strcmp(buf, "") != 0);
368 + * Save interfaces and their states to a temporary file. Used only by the
369 + * first IPTraf instance. Needed in case there are subsequent, simultaneous
370 + * instances of IPTraf, which may still need promiscuous mode even after
371 + * the first instance exits. These subsequent instances will need to restore
372 + * the promiscuous state from this file.
375 +void save_promisc_list(struct promisc_states *list)
378 + struct promisc_states *ptmp = list;
380 + fd = open(PROMISCLISTFILE, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
383 + write_error("Unable to save interface flags", daemonized);
387 + while (ptmp != NULL) {
388 + write(fd, &(ptmp->params), sizeof(struct promisc_params));
389 + ptmp = ptmp->next_entry;
396 + * Load promiscuous states into list
399 +void load_promisc_list(struct promisc_states **list)
402 + struct promisc_states *ptmp = NULL;
403 + struct promisc_states *tail = NULL;
406 + fd = open(PROMISCLISTFILE, O_RDONLY);
409 + write_error("Unable to retrieve saved interface flags",
416 + ptmp = malloc(sizeof(struct promisc_states));
417 + br = read(fd, &(ptmp->params), sizeof(struct promisc_params));
421 + tail->next_entry = ptmp;
425 + ptmp->next_entry = NULL;
435 + * Set/restore interface promiscuous mode.
438 +void srpromisc(int mode, struct promisc_states *list)
442 + struct promisc_states *ptmp;
444 + char fullmsg[PROMISC_MSG_MAX];
448 + fd = socket(PF_INET, SOCK_DGRAM, 0);
451 + write_error("Unable to open socket for flag change", daemonized);
455 + while (ptmp != NULL) {
456 + if (((strncmp(ptmp->params.ifname, "eth", 3) == 0) ||
457 + (strncmp(ptmp->params.ifname, "vlan", 4) == 0) ||
458 + (strncmp(ptmp->params.ifname, "wvlan", 4) == 0) ||
459 + (strncmp(ptmp->params.ifname, "lec", 3) == 0)) &&
460 + (ptmp->params.state_valid)) {
462 + strcpy(ifr.ifr_name, ptmp->params.ifname);
465 + ifr.ifr_flags = ptmp->params.saved_state | IFF_PROMISC;
467 + ifr.ifr_flags = ptmp->params.saved_state;
469 + istat = ioctl(fd, SIOCSIFFLAGS, &ifr);
472 + sprintf(fullmsg, "Promisc change failed for %s",
473 + ptmp->params.ifname);
474 + write_error(fullmsg, daemonized);
477 + ptmp = ptmp->next_entry;
483 +void destroy_promisc_list(struct promisc_states **list)
485 + struct promisc_states *ptmp = *list;
486 + struct promisc_states *ctmp;
489 + ctmp = ptmp->next_entry;
491 + while (ptmp != NULL) {
495 + ctmp = ctmp->next_entry;
498 diff -ruN iptraf-2.7.0-old/src/rvnamed.c iptraf-2.7.0-new/src/rvnamed.c
499 --- iptraf-2.7.0-old/src/rvnamed.c 2002-05-02 03:37:34.000000000 +0200
500 +++ iptraf-2.7.0-new/src/rvnamed.c 2005-10-04 22:02:47.000000000 +0200
503 #include <sys/wait.h>
507 #define NUM_CACHE_ENTRIES 2048
508 #define TIME_TARGET_MAX 30
509 diff -ruN iptraf-2.7.0-old/src/rvnamed.h iptraf-2.7.0-new/src/rvnamed.h
510 --- iptraf-2.7.0-old/src/rvnamed.h 2002-05-02 03:36:30.000000000 +0200
511 +++ iptraf-2.7.0-new/src/rvnamed.h 2005-10-04 22:03:29.000000000 +0200
513 #include <netinet/in.h>
514 #include <arpa/inet.h>
517 -#define CHILDSOCKNAME "/dev/rvndcldcomsk"
518 -#define PARENTSOCKNAME "/dev/rvndpntcomsk"
519 -#define IPTSOCKNAME "/dev/rvndiptcomsk"
520 +#define CHILDSOCKNAME LOCKDIR "/rvndcldcomsk"
521 +#define PARENTSOCKNAME LOCKDIR "/rvndpntcomsk"
522 +#define IPTSOCKNAME LOCKDIR "/rvndiptcomsk"
524 #define SOCKET_PREFIX "isock"
526 diff -ruN iptraf-2.7.0-old/src/tcptable.c iptraf-2.7.0-new/src/tcptable.c
527 --- iptraf-2.7.0-old/src/tcptable.c 2002-05-08 03:36:27.000000000 +0200
528 +++ iptraf-2.7.0-new/src/tcptable.c 2005-10-03 19:25:55.000000000 +0200
530 if ((linkproto == LINK_ETHERNET) || (linkproto == LINK_PLIP)) {
531 convmacaddr(((struct ethhdr *) packet)->h_source,
533 - } else if (linkproto == LINK_FDDI) {
534 - convmacaddr(((struct fddihdr *) packet)->saddr,
536 } else if (linkproto == LINK_TR) {
537 convmacaddr(((struct trh_hdr *) packet)->saddr, newmacaddr);
539 diff -ruN iptraf-2.7.0-old/src/tcptable.h iptraf-2.7.0-new/src/tcptable.h
540 --- iptraf-2.7.0-old/src/tcptable.h 2001-12-28 03:16:39.000000000 +0100
541 +++ iptraf-2.7.0-new/src/tcptable.h 2005-10-03 19:26:01.000000000 +0200
543 #include <asm/types.h>
544 #include <linux/if_packet.h>
545 #include <linux/if_ether.h>
546 -#include <linux/if_fddi.h>
547 #include <linux/if_tr.h>
549 #include <netinet/ip.h>