Changed color order at colorized output.

Remove index cache zombies when unloading CAN drivers.
Modified index cache failure message.
pull/7/head
Oliver Hartkopp 2007-11-20 18:37:30 +00:00
parent 12f9170338
commit e47a1b4b26
1 changed files with 11 additions and 2 deletions

View File

@ -79,7 +79,7 @@
#define MAGENTA ATTBOLD FGMAGENTA #define MAGENTA ATTBOLD FGMAGENTA
#define CYAN ATTBOLD FGCYAN #define CYAN ATTBOLD FGCYAN
const char col_on [MAXDEV][19] = {BOLD, MAGENTA, GREEN, BLUE, CYAN, RED}; const char col_on [MAXDEV][19] = {BLUE, RED, GREEN, BOLD, MAGENTA, CYAN};
const char col_off [] = ATTRESET; const char col_off [] = ATTRESET;
static char devname[MAXDEV][IFNAMSIZ+1]; static char devname[MAXDEV][IFNAMSIZ+1];
@ -132,12 +132,21 @@ int idx2dindex(int ifidx, int socket) {
/* create new interface index cache entry */ /* create new interface index cache entry */
/* remove index cache zombies first */
for (i=0; i < MAXDEV; i++) {
if (dindex[i]) {
ifr.ifr_ifindex = dindex[i];
if (ioctl(socket, SIOCGIFNAME, &ifr) < 0)
dindex[i] = 0;
}
}
for (i=0; i < MAXDEV; i++) for (i=0; i < MAXDEV; i++)
if (!dindex[i]) /* free entry */ if (!dindex[i]) /* free entry */
break; break;
if (i == MAXDEV) { if (i == MAXDEV) {
printf("BUG in interface index cache! MAXDEV?\n"); printf("Interface index cache only supports %d interfaces.\n", MAXDEV);
exit(1); exit(1);
} }