[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Inconsistency in IF Name Length
Greetings,
The source for iptraf-3.0.0 contains some inconsistencies in interface
name length. Some components set it to 8 bytes, others to 10.
Here's a patch that corrects this, and increases the length to 12 bytes.
This comes in handy if you're using a large number of interfaces and a
large number of VLANs, for instance: eth12.12345
Have whatever kind of day suits you!
Dennis
--- ./src/hostmon.c.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/hostmon.c 2007-01-31 12:22:55.000000000 -0800
@@ -711,7 +711,7 @@
int is_ip;
int ch;
- char ifname[10];
+ char ifname[12];
struct timeval tv;
unsigned long starttime;
--- ./src/hostmon.h.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/hostmon.h 2007-01-31 12:22:59.000000000 -0800
@@ -25,7 +25,7 @@
char eth_addr[ETH_ALEN];
char ascaddr[15];
char desc[65];
- char ifname[10];
+ char ifname[12];
int withdesc;
int printed;
unsigned int linktype;
--- ./src/ifstats.c.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/ifstats.c 2007-01-31 12:23:03.000000000 -0800
@@ -128,7 +128,7 @@
void initiflist(struct iflist **list)
{
FILE *fd;
- char ifname[10];
+ char ifname[12];
struct iflist *itmp = NULL;
struct iflist *tail = NULL;
unsigned int index = 0;
@@ -430,7 +430,7 @@
FILE *logfile = NULL;
int br;
- char ifname[10];
+ char ifname[12];
int ch;
@@ -757,7 +757,7 @@
char *tpacket;
unsigned int iphlen;
- char ifname[10];
+ char ifname[12];
struct sockaddr_ll fromaddr;
unsigned short linktype;
--- ./src/ifstats.h.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/ifstats.h 2007-01-31 12:23:13.000000000 -0800
@@ -6,7 +6,7 @@
***/
struct iflist {
- char ifname[8];
+ char ifname[12];
unsigned int encap;
unsigned long long iptotal;
unsigned long badtotal;
--- ./src/iptraf.c.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/iptraf.c 2007-01-31 12:23:19.000000000 -0800
@@ -235,7 +235,7 @@
struct filterstate ofilter;
struct ffnode *fltfiles;
- char ifname[10];
+ char ifname[12];
char *ifptr = NULL;
struct porttab *ports;
--- ./src/isdntab.h.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/isdntab.h 2007-01-31 12:23:23.000000000 -0800
@@ -1,5 +1,5 @@
struct isdntabent {
- char ifname[10];
+ char ifname[12];
unsigned int encap;
struct isdntabent *next_entry;
};
--- ./src/itrafmon.c.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/itrafmon.c 2007-01-31 12:23:26.000000000 -0800
@@ -604,7 +604,7 @@
int curwin = 0;
int readlen;
- char ifname[10];
+ char ifname[12];
unsigned long long total_pkts = 0;
--- ./src/promisc.h.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/promisc.h 2007-01-31 12:23:29.000000000 -0800
@@ -9,7 +9,7 @@
*/
struct promisc_params {
- char ifname[8];
+ char ifname[12];
int saved_state;
int state_valid;
};
--- ./src/tcptable.h.old 2007-01-31 12:20:24.000000000 -0800
+++ ./src/tcptable.h 2007-01-31 12:23:45.000000000 -0800
@@ -64,7 +64,7 @@
unsigned long finack;
int partial;
int finsent;
- char ifname[8];
+ char ifname[12];
unsigned int index;
int reused;
int timedout;
--- ./src/ifstats.c.old 2007-01-31 12:53:22.000000000 -0800
+++ ./src/ifstats.c 2007-01-31 12:55:09.000000000 -0800
@@ -142,7 +142,7 @@
return;
}
- while (get_next_iface(fd, ifname, 8)) {
+ while (get_next_iface(fd, ifname, 12)) {
if (strcmp(ifname, "") != 0) {
if (!(iface_supported(ifname)))
continue;
--- ./src/promisc.c.old 2007-01-31 12:53:28.000000000 -0800
+++ ./src/promisc.c 2007-01-31 12:54:46.000000000 -0800
@@ -49,7 +49,7 @@
{
FILE *fd;
int ifd;
- char buf[8];
+ char buf[12];
struct promisc_states *ptmp;
struct promisc_states *tail = NULL;
struct ifreq ifr;
@@ -61,7 +61,7 @@
*list = NULL;
fd = open_procnetdev();
- while (get_next_iface(fd, buf, 8)) {
+ while (get_next_iface(fd, buf, 12)) {
if (strcmp(buf, "") != 0) {
ptmp = malloc(sizeof(struct promisc_states));
strcpy(ptmp->params.ifname, buf);
--- ./src/othptab.h.old 2007-01-31 13:04:48.000000000 -0800
+++ ./src/othptab.h 2007-01-31 13:06:17.000000000 -0800
@@ -42,7 +42,7 @@
int s_fstat;
int d_fstat;
unsigned int protocol;
- char iface[8];
+ char iface[12];
unsigned int pkt_length;
union {
--- ./src/pktsize.c.old 2007-01-31 13:05:03.000000000 -0800
+++ ./src/pktsize.c 2007-01-31 13:06:32.000000000 -0800
@@ -175,7 +175,7 @@
char buf[MAX_PACKET_SIZE];
int br;
char *ipacket;
- char iface[10];
+ char iface[12];
unsigned int mtu;
struct sockaddr_ll fromaddr;
--- ./src/serv.c.old 2007-01-31 13:05:07.000000000 -0800
+++ ./src/serv.c 2007-01-31 13:06:44.000000000 -0800
@@ -739,7 +739,7 @@
unsigned short linktype;
int br;
- char iface[8];
+ char iface[12];
unsigned int idx = 1;
unsigned int sport = 0;