... to place where it is actually used
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/itrafmon.c | 5 ++---
src/othptab.c | 10 ++++------
src/othptab.h | 3 +--
src/tcptable.c | 10 +++++-----
src/tcptable.h | 2 +-
5 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/src/itrafmon.c b/src/itrafmon.c
index a048374..d902407 100644
--- a/src/itrafmon.c
+++ b/src/itrafmon.c
@@ -647,7 +647,7 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
instance_id = adjust_instance_count(ITRAFMONCOUNTFILE, 1);
init_tcp_table(&table);
- init_othp_table(&othptbl, options.mac);
+ init_othp_table(&othptbl);
statwin = newwin(1, COLS, LINES - 2, 0);
statpanel = new_panel(statwin);
@@ -1111,8 +1111,7 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
strcat(msgstring, " (SYN)");
writetcplog(logging, logfile, tcpentry,
- pkt.pkt_len, options.mac,
- msgstring);
+ pkt.pkt_len, msgstring);
}
if ((revlook)
diff --git a/src/othptab.c b/src/othptab.c
index e75f07d..142c9c2 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -86,7 +86,7 @@ static void writeothplog(int logging, FILE *fd, char *protname,
}
}
-void init_othp_table(struct othptable *table, int mac)
+void init_othp_table(struct othptable *table)
{
unsigned int winht;
unsigned int wintop;
@@ -117,8 +117,6 @@ void init_othp_table(struct othptable *table, int mac)
tx_stdwinset(table->othpwin);
getmaxyx(table->borderwin, table->obmaxy, obmaxx);
table->oimaxy = table->obmaxy - 2;
-
- table->mac = mac;
}
void process_dest_unreach(struct tcptable *table, char *packet, char *ifname)
@@ -183,7 +181,7 @@ struct othptabent *add_othp_entry(struct othptable *table, struct
pkt_hdr *pkt,
new_entry->is_ip = is_ip;
new_entry->fragment = fragment;
- if ((table->mac) || (!is_ip)) {
+ if (options.mac || !is_ip) {
if (pkt->pkt_hatype == ARPHRD_ETHER) {
convmacaddr((char *) pkt->ethhdr->h_source, new_entry->smacaddr);
convmacaddr((char *) pkt->ethhdr->h_dest, new_entry->dmacaddr);
@@ -718,7 +716,7 @@ void printothpentry(struct othptable *table, struct othptabent
*entry,
strcat(msgstring, scratchpad);
- if (((entry->smacaddr)[0] != '\0') && (table->mac)) {
+ if (((entry->smacaddr)[0] != '\0') && options.mac) {
snprintf(scratchpad, MSGSTRING_MAX, " (src HWaddr %s)",
entry->smacaddr);
strcat(msgstring, scratchpad);
@@ -736,7 +734,7 @@ void printothpentry(struct othptable *table, struct othptabent
*entry,
if (logging)
writeothplog(logging, logfile, protname, description,
- additional, 1, table->mac, entry);
+ additional, 1, options.mac, entry);
}
void refresh_othwindow(struct othptable *table)
diff --git a/src/othptab.h b/src/othptab.h
index 0143c81..1987ea7 100644
--- a/src/othptab.h
+++ b/src/othptab.h
@@ -82,7 +82,6 @@ struct othptable {
int htstat;
unsigned int obmaxy; /* number of lines in the border window */
unsigned int oimaxy; /* number of lines inside the border */
- int mac;
WINDOW *othpwin;
PANEL *othppanel;
WINDOW *borderwin;
@@ -117,7 +116,7 @@ struct ospfhdr {
u_short ospf_authtype;
};
-void init_othp_table(struct othptable *table, int mac);
+void init_othp_table(struct othptable *table);
void process_dest_unreach(struct tcptable *table, char *packet, char *ifname);
diff --git a/src/tcptable.c b/src/tcptable.c
index 8a08d1d..d88dc6b 100644
--- a/src/tcptable.c
+++ b/src/tcptable.c
@@ -657,7 +657,7 @@ void updateentry(struct tcptable *table, struct tcptableent
*tableentry,
if (logging) {
writetcplog(logging, logfile, tableentry,
- tableentry->psize, options.mac,
+ tableentry->psize,
"FIN acknowleged");
}
}
@@ -709,7 +709,7 @@ void updateentry(struct tcptable *table, struct tcptableent
*tableentry,
tcplog_flowrate_msg(tableentry));
writetcplog(logging, logfile, tableentry,
- tableentry->psize, options.mac, msgstring);
+ tableentry->psize, msgstring);
}
}
if (transpacket->rst) {
@@ -726,7 +726,7 @@ void updateentry(struct tcptable *table, struct tcptableent
*tableentry,
tableentry->oth_connection->bcount,
tcplog_flowrate_msg(tableentry->oth_connection));
writetcplog(logging, logfile, tableentry,
- tableentry->psize, options.mac, msgstring);
+ tableentry->psize, msgstring);
}
}
if (transpacket->psh)
@@ -1167,12 +1167,12 @@ void flushclosedentries(struct tcptable *table, unsigned long
*screen_idx,
}
void writetcplog(int logging, FILE *fd, struct tcptableent *entry,
- unsigned int pktlen, int mac, char *message)
+ unsigned int pktlen, char *message)
{
char msgbuf[MSGSTRING_MAX];
if (logging) {
- if (mac) {
+ if (options.mac) {
snprintf(msgbuf, MSGSTRING_MAX,
"TCP; %s; %u bytes; from %s:%s to %s:%s (source MAC addr %s); %s",
entry->ifname, pktlen, entry->s_fqdn,
diff --git a/src/tcptable.h b/src/tcptable.h
index cc32fae..d0f5253 100644
--- a/src/tcptable.h
+++ b/src/tcptable.h
@@ -130,7 +130,7 @@ void flushclosedentries(struct tcptable *table, unsigned long
*screen_idx,
void write_timeout_log(int logging, FILE *logfile, struct tcptableent *tcpnode);
void writetcplog(int logging, FILE *fd, struct tcptableent *entry,
- unsigned int pktlen, int mac, char *message);
+ unsigned int pktlen, char *message);
void write_tcp_unclosed(int logging, FILE *fd, struct tcptable *table);
--
1.7.8.4