On Mon, Mar 12, 2012 at 08:19:27AM -0300, Danilo Câmara wrote:
Hi
I have my Ethernet host descriptions listed in
"Configure.../Ethernet/PLIP host descriptions..." but I can't have
them to show in "LAN station monitor". In the original iptraf they
work fine. I noticed that iptraf-ng changed the configuration to
include ":" (colon) in the MAC address input.
Does the attached patch fix it?
Cheers,
Vita
diff --git a/src/hostmon.c b/src/hostmon.c
index 53d1d8e..5790bc7 100644
--- a/src/hostmon.c
+++ b/src/hostmon.c
@@ -139,16 +139,15 @@ struct ethtabent *addethnode(struct ethtab *table, int *nomem)
void convmacaddr(char *addr, char *result)
{
- unsigned int i;
u_int8_t *ptmp = (u_int8_t *) addr;
- char hexbyte[3];
- strcpy(result, "");
- for (i = 0; i <= 5; i++) {
- sprintf(hexbyte, "%02x", *ptmp);
- strcat(result, hexbyte);
- ptmp++;
- }
+ sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
+ *ptmp,
+ *(ptmp + 1),
+ *(ptmp + 2),
+ *(ptmp + 3),
+ *(ptmp + 4),
+ *(ptmp + 5));
}
struct ethtabent *addethentry(struct ethtab *table, unsigned int linktype,
@@ -172,8 +171,8 @@ struct ethtabent *addethentry(struct ethtab *table, unsigned int
linktype,
struct eth_desc *desc = NULL;
list_for_each_entry(desc, &list->hd_list, hd_list)
- if (!strcmp(desc->hd_mac, ptemp->un.desc.ascaddr))
- strcpy(ptemp->un.desc.ascaddr, ptemp->un.desc.desc);
+ if (!strcasecmp(desc->hd_mac, ptemp->un.desc.ascaddr))
+ strcpy(ptemp->un.desc.desc, desc->hd_desc);
strcpy(ptemp->un.desc.ifname, ifname);
diff --git a/src/hostmon.h b/src/hostmon.h
index 34251dc..983ff99 100644
--- a/src/hostmon.h
+++ b/src/hostmon.h
@@ -26,7 +26,7 @@ struct ethtabent {