Code tidying.

This commit is contained in:
pdw
2014-01-01 12:36:35 +00:00
parent 9be050ef4c
commit 59cf360690

17
iftop.c
View File

@@ -140,7 +140,6 @@ void tick(int print) {
t = time(NULL); t = time(NULL);
if(t - last_timestamp >= RESOLUTION) { if(t - last_timestamp >= RESOLUTION) {
//printf("TICKING\n");
analyse_data(); analyse_data();
ui_print(); ui_print();
history_rotate(); history_rotate();
@@ -574,9 +573,9 @@ static void handle_eth_packet(unsigned char* args, const struct pcap_pkthdr* pkt
tick(0); tick(0);
if(ether_type == ETHERTYPE_8021Q) { if(ether_type == ETHERTYPE_8021Q) {
struct vlan_8021q_header* vptr; struct vlan_8021q_header* vptr;
vptr = (struct vlan_8021q_header*)payload; vptr = (struct vlan_8021q_header*)payload;
ether_type = ntohs(vptr->ether_type); ether_type = ntohs(vptr->ether_type);
payload += sizeof(struct vlan_8021q_header); payload += sizeof(struct vlan_8021q_header);
} }
@@ -592,11 +591,11 @@ static void handle_eth_packet(unsigned char* args, const struct pcap_pkthdr* pkt
dir = 1; dir = 1;
} }
else if(have_hw_addr && memcmp(eptr->ether_dhost, if_hw_addr, 6) == 0 ) { else if(have_hw_addr && memcmp(eptr->ether_dhost, if_hw_addr, 6) == 0 ) {
/* packet entering this i/f */ /* packet entering this i/f */
dir = 0; dir = 0;
} }
else if (memcmp("\xFF\xFF\xFF\xFF\xFF\xFF", eptr->ether_dhost, 6) == 0) { else if (memcmp("\xFF\xFF\xFF\xFF\xFF\xFF", eptr->ether_dhost, 6) == 0) {
/* broadcast packet, count as incoming */ /* broadcast packet, count as incoming */
dir = 0; dir = 0;
} }