... to places where it is actually used
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/itrafmon.c | 16 ++++++----------
src/othptab.c | 9 +++------
src/othptab.h | 3 +--
src/serv.c | 14 ++++++--------
src/servname.c | 6 +++---
src/servname.h | 3 +--
src/tcptable.c | 6 +++---
src/tcptable.h | 2 +-
8 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/src/itrafmon.c b/src/itrafmon.c
index fe1771a..a048374 100644
--- a/src/itrafmon.c
+++ b/src/itrafmon.c
@@ -1024,8 +1024,7 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
NOT_IP,
pkt.pkt_protocol,
pkt.pkt_payload, ifname, 0,
- 0, logging, logfile,
- options.servnames, 0);
+ 0, logging, logfile, 0);
continue;
}
@@ -1056,8 +1055,7 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
wasempty = (table.head == NULL);
tcpentry = addentry(&table, &saddr, &daddr,
pkt_ip_protocol(&pkt),
- ifname, &revlook, rvnfd,
- options.servnames);
+ ifname, &revlook, rvnfd);
if (tcpentry != NULL) {
printentry(&table, tcpentry->oth_connection, screen_idx,
mode);
@@ -1166,10 +1164,9 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
}
add_othp_entry(&othptbl, &pkt, &saddr, &daddr,
IS_IP, pkt_ip_protocol(&pkt),
- (char *) transpacket,
- ifname, &revlook, rvnfd,
- logging, logfile,
- options.servnames, fragment);
+ (char *) transpacket, ifname,
+ &revlook, rvnfd, logging, logfile,
+ fragment);
} else {
if (pkt_ip_protocol(&pkt) == IPPROTO_ICMPV6
@@ -1180,8 +1177,7 @@ void ipmon(struct filterstate *ofilter, time_t facilitytime, char
*ifptr)
add_othp_entry(&othptbl, &pkt, &saddr, &daddr,
IS_IP, pkt_ip_protocol(&pkt),
(char *) transpacket, ifname,
- &revlook, rvnfd,
- logging, logfile, options.servnames,
+ &revlook, rvnfd, logging, logfile,
fragment);
}
}
diff --git a/src/othptab.c b/src/othptab.c
index 1eed363..e75f07d 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -173,8 +173,7 @@ struct othptabent *add_othp_entry(struct othptable *table, struct
pkt_hdr *pkt,
int protocol,
char *packet2,
char *ifname, int *rev_lookup, int rvnfd,
- int logging, FILE * logfile,
- int servnames, int fragment)
+ int logging, FILE *logfile, int fragment)
{
struct othptabent *new_entry;
struct othptabent *temp;
@@ -215,12 +214,10 @@ struct othptabent *add_othp_entry(struct othptable *table, struct
pkt_hdr *pkt,
new_entry->un.icmp6.code =
((struct icmp6_hdr *) packet2)->icmp6_code;
} else if (protocol == IPPROTO_UDP) {
- servlook(servnames,
- ntohs(((struct udphdr *) packet2)->source),
+ servlook(ntohs(((struct udphdr *) packet2)->source),
IPPROTO_UDP, new_entry->un.udp.s_sname,
10);
- servlook(servnames,
- ntohs(((struct udphdr *) packet2)->dest),
+ servlook(ntohs(((struct udphdr *) packet2)->dest),
IPPROTO_UDP, new_entry->un.udp.d_sname,
10);
} else if (protocol == IPPROTO_OSPFIGP) {
diff --git a/src/othptab.h b/src/othptab.h
index 153d013..0143c81 100644
--- a/src/othptab.h
+++ b/src/othptab.h
@@ -128,8 +128,7 @@ struct othptabent *add_othp_entry(struct othptable *table, struct
pkt_hdr *pkt,
int protocol,
char *packet2,
char *ifname, int *rev_lookup, int rvnamedon,
- int logging, FILE * logfile,
- int servnames, int fragment);
+ int logging, FILE *logfile, int fragment);
void printothpentry(struct othptable *table, struct othptabent *entry,
unsigned int screen_idx, int logging, FILE * logfile);
diff --git a/src/serv.c b/src/serv.c
index 738c7ec..1491ae5 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -190,7 +190,7 @@ static void initportlist(struct portlist *list)
static struct portlistent *addtoportlist(struct portlist *list,
unsigned int protocol,
- unsigned int port, int servnames)
+ unsigned int port)
{
struct portlistent *ptemp;
@@ -218,7 +218,7 @@ static struct portlistent *addtoportlist(struct portlist *list,
* Obtain appropriate service name
*/
- servlook(servnames, port, protocol, ptemp->servname, 10);
+ servlook(port, protocol, ptemp->servname, 10);
memset(&ptemp->serv_count, 0, sizeof(ptemp->serv_count));
@@ -349,8 +349,7 @@ static void destroyportlist(struct portlist *list)
static void updateportent(struct portlist *list, unsigned int protocol,
unsigned int sport, unsigned int dport, int br,
- unsigned int idx, struct porttab *ports,
- int servnames)
+ unsigned int idx, struct porttab *ports)
{
struct portlistent *sport_listent = NULL;
struct portlistent *dport_listent = NULL;
@@ -364,7 +363,7 @@ static void updateportent(struct portlist *list, unsigned int
protocol,
if (!sport_listent)
sport_listent =
- addtoportlist(list, protocol, sport, servnames);
+ addtoportlist(list, protocol, sport);
if (sport_listent == NULL)
return;
@@ -378,7 +377,7 @@ static void updateportent(struct portlist *list, unsigned int
protocol,
if (!dport_listent)
dport_listent =
- addtoportlist(list, protocol, dport, servnames);
+ addtoportlist(list, protocol, dport);
if (dport_listent == NULL)
return;
@@ -1072,8 +1071,7 @@ void servmon(char *ifname, time_t facilitytime, struct filterstate
*ofilter)
case IPPROTO_TCP:
case IPPROTO_UDP:
updateportent(&list, ip_protocol, ntohs(sport),
- ntohs(dport), iplen, idx, ports,
- options.servnames);
+ ntohs(dport), iplen, idx, ports);
break;
default:
/* unknown L4 protocol */
diff --git a/src/servname.c b/src/servname.c
index 658a1c0..989c395 100644
--- a/src/servname.c
+++ b/src/servname.c
@@ -9,15 +9,15 @@ servname.c - lookup module for TCP and UDP service names based on
***/
#include "iptraf-ng-compat.h"
+#include "options.h"
-void servlook(int servnames, in_port_t port, unsigned int protocol,
- char *target, int maxlen)
+void servlook(in_port_t port, unsigned int protocol, char *target, int maxlen)
{
static struct servent *sve;
memset(target, 0, maxlen + 1);
- if (servnames) {
+ if (options.servnames) {
if (protocol == IPPROTO_TCP)
sve = getservbyport(htons(port), "tcp");
else
diff --git a/src/servname.h b/src/servname.h
index 7fc4fed..eae53bb 100644
--- a/src/servname.h
+++ b/src/servname.h
@@ -7,7 +7,6 @@ servname.h - function prototype for service lookup
***/
-void servlook(int servnames, in_port_t port, unsigned int protocol,
- char *target, int maxlen);
+void servlook(in_port_t port, unsigned int protocol, char *target, int maxlen);
#endif /* IPTRAF_NG_SERVNAME_H */
diff --git a/src/tcptable.c b/src/tcptable.c
index 3812b86..8a08d1d 100644
--- a/src/tcptable.c
+++ b/src/tcptable.c
@@ -227,7 +227,7 @@ struct tcptableent *addentry(struct tcptable *table,
struct sockaddr_storage *saddr,
struct sockaddr_storage *daddr,
int protocol, char *ifname,
- int *rev_lookup, int rvnfd, int servnames)
+ int *rev_lookup, int rvnfd)
{
struct tcptableent *new_entry;
struct closedlist *ctemp;
@@ -356,8 +356,8 @@ struct tcptableent *addentry(struct tcptable *table,
new_entry->d_fqdn, sizeof(new_entry->d_fqdn), rvnfd);
/* set port service names (where applicable) */
- servlook(servnames, sockaddr_get_port(saddr), IPPROTO_TCP, new_entry->s_sname, 10);
- servlook(servnames, sockaddr_get_port(daddr), IPPROTO_TCP, new_entry->d_sname, 10);
+ servlook(sockaddr_get_port(saddr), IPPROTO_TCP, new_entry->s_sname, 10);
+ servlook(sockaddr_get_port(daddr), IPPROTO_TCP, new_entry->d_sname, 10);
strcpy(new_entry->oth_connection->s_sname, new_entry->d_sname);
strcpy(new_entry->oth_connection->d_sname, new_entry->s_sname);
diff --git a/src/tcptable.h b/src/tcptable.h
index 8d656cc..cc32fae 100644
--- a/src/tcptable.h
+++ b/src/tcptable.h
@@ -98,7 +98,7 @@ struct tcptableent *addentry(struct tcptable *table,
struct sockaddr_storage *saddr,
struct sockaddr_storage *daddr,
int protocol, char *ifname,
- int *rev_lookup, int rvnamedon, int servnames);
+ int *rev_lookup, int rvnamedon);
struct tcptableent *in_table(struct tcptable *table,
struct sockaddr_storage *saddr,
--
1.7.8.4