Since all the callers have ifname NULL we can remove the params
and associated code.
In processpacket() I deleted also ifdefed code which checks for ISDN
interface (this needs to be done in other way).
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/hostmon.c | 4 ++--
src/ifstats.c | 8 ++++----
src/itrafmon.c | 4 ++--
src/packet.c | 18 ++----------------
src/packet.h | 4 ++--
src/pktsize.c | 5 ++---
src/serv.c | 4 ++--
7 files changed, 16 insertions(+), 31 deletions(-)
diff --git a/src/hostmon.c b/src/hostmon.c
index 5f3dd8a..03806de 100644
--- a/src/hostmon.c
+++ b/src/hostmon.c
@@ -814,7 +814,7 @@ void hostmon(const struct OPTIONS *options, int facilitytime, char
*ifptr,
&& (((now - statbegin) / 60) >= facilitytime))
exitloop = 1;
- getpacket(fd, buf, &fromaddr, &ch, &br, NULL, table.tabwin);
+ getpacket(fd, buf, &fromaddr, &ch, &br, table.tabwin);
if (ch != ERR) {
if (keymode == 0) {
@@ -866,7 +866,7 @@ void hostmon(const struct OPTIONS *options, int facilitytime, char
*ifptr,
processpacket(buf, &ipacket, (unsigned int *) &br,
NULL, NULL, NULL, &fromaddr,
ofilter,
- MATCH_OPPOSITE_USECONFIG, NULL,
+ MATCH_OPPOSITE_USECONFIG,
0);
if (pkt_result != PACKET_OK)
diff --git a/src/ifstats.c b/src/ifstats.c
index dbde9ea..27597f6 100644
--- a/src/ifstats.c
+++ b/src/ifstats.c
@@ -520,7 +520,7 @@ void ifstats(const struct OPTIONS *options, struct filterstate
*ofilter,
&& (((now - statbegin) / 60) >= facilitytime))
exitloop = 1;
- getpacket(fd, buf, &fromaddr, &ch, &br, NULL, table.statwin);
+ getpacket(fd, buf, &fromaddr, &ch, &br, table.statwin);
switch (ch) {
case ERR:
@@ -561,7 +561,7 @@ void ifstats(const struct OPTIONS *options, struct filterstate
*ofilter,
NULL, NULL, NULL, &fromaddr,
ofilter,
MATCH_OPPOSITE_USECONFIG,
- NULL, options->v6inv4asv6);
+ options->v6inv4asv6);
if (pkt_result != PACKET_OK
&& pkt_result != MORE_FRAGMENTS)
@@ -982,7 +982,7 @@ void detstats(char *iface, const struct OPTIONS *options, int
facilitytime,
&& (((now - statbegin) / 60) >= facilitytime))
exitloop = 1;
- getpacket(fd, buf, &fromaddr, &ch, &br, NULL, statwin);
+ getpacket(fd, buf, &fromaddr, &ch, &br, statwin);
switch (ch) {
case ERR:
@@ -1012,7 +1012,7 @@ void detstats(char *iface, const struct OPTIONS *options, int
facilitytime,
processpacket(buf, &packet, (unsigned int *) &br,
NULL, NULL, NULL, &fromaddr,
ofilter,
- MATCH_OPPOSITE_USECONFIG, NULL,
+ MATCH_OPPOSITE_USECONFIG,
options->v6inv4asv6);
if (pkt_result != PACKET_OK
diff --git a/src/itrafmon.c b/src/itrafmon.c
index c32c19d..6d555d1 100644
--- a/src/itrafmon.c
+++ b/src/itrafmon.c
@@ -835,7 +835,7 @@ void ipmon(struct OPTIONS *options, struct filterstate *ofilter,
rotate_flag = 0;
}
- getpacket(fd, tpacket, &fromaddr, &ch, &readlen, NULL,
+ getpacket(fd, tpacket, &fromaddr, &ch, &readlen,
table.tcpscreen);
if (ch == ERR)
@@ -1044,7 +1044,7 @@ void ipmon(struct OPTIONS *options, struct filterstate *ofilter,
(unsigned int *) &readlen, &br,
&sport, &dport, &fromaddr,
ofilter, MATCH_OPPOSITE_ALWAYS,
- NULL, options->v6inv4asv6);
+ options->v6inv4asv6);
if (pkt_result != PACKET_OK)
continue;
diff --git a/src/packet.c b/src/packet.c
index 0753ee0..f007b99 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -123,13 +123,12 @@ static void adjustpacket(char *tpacket, struct sockaddr_ll
*fromaddr,
*/
void getpacket(int fd, char *buf, struct sockaddr_ll *fromaddr, int *ch,
- int *br, char *ifname, WINDOW * win)
+ int *br, WINDOW * win)
{
socklen_t fromlen;
fd_set set;
struct timeval tv;
int ss;
- struct ifreq ifr;
FD_ZERO(&set);
@@ -160,11 +159,6 @@ void getpacket(int fd, char *buf, struct sockaddr_ll *fromaddr, int
*ch,
fromlen = sizeof(struct sockaddr_ll);
*br = recvfrom(fd, buf, MAX_PACKET_SIZE, 0,
(struct sockaddr *) fromaddr, &fromlen);
- if (ifname) {
- ifr.ifr_ifindex = fromaddr->sll_ifindex;
- ioctl(fd, SIOCGIFNAME, &ifr);
- strcpy(ifname, ifr.ifr_name);
- }
}
if (!daemonized && FD_ISSET(0, &set))
*ch = wgetch(win);
@@ -174,16 +168,8 @@ int processpacket(char *tpacket, char **packet, unsigned int *br,
unsigned int *total_br, unsigned int *sport,
unsigned int *dport, struct sockaddr_ll *fromaddr,
struct filterstate *filter,
- int match_opposite, char *ifname, int v6inv4asv6)
+ int match_opposite, int v6inv4asv6)
{
-#if 0 /* reenable isdn */
- /*
- * Prepare ISDN reference descriptor and table.
- */
-
- memset(&isdntable, 0, sizeof(struct isdntab));
- isdn_iface_check(&isdnfd, ifname);
-#endif
/*
* Get IPTraf link type based on returned information and move past
* data link header.
diff --git a/src/packet.h b/src/packet.h
index 22f9a67..d9a0915 100644
--- a/src/packet.h
+++ b/src/packet.h
@@ -27,12 +27,12 @@ extern int isdnfd;
void open_socket(int *fd);
void getpacket(int fd, char *buf, struct sockaddr_ll *fromaddr, int *ch,
- int *br, char *ifname, WINDOW * win);
+ int *br, WINDOW * win);
int processpacket(char *tpacket, char **packet, unsigned int *br,
unsigned int *total_br, unsigned int *sport,
unsigned int *dport, struct sockaddr_ll *fromaddr,
struct filterstate *ofilter,
- int match_opposite, char *ifname, int v6inv4asv6);
+ int match_opposite, int v6inv4asv6);
void pkt_cleanup(void);
#endif /* IPTRAF_NG_PACKET_H */
diff --git a/src/pktsize.c b/src/pktsize.c
index ce0fd78..0612fbf 100644
--- a/src/pktsize.c
+++ b/src/pktsize.c
@@ -293,7 +293,7 @@ void packet_size_breakdown(struct OPTIONS *options, char *ifname,
&& (((now - starttime) / 60) >= facilitytime))
exitloop = 1;
- getpacket(fd, buf, &fromaddr, &ch, &br, NULL, win);
+ getpacket(fd, buf, &fromaddr, &ch, &br, win);
if (ch != ERR) {
switch (ch) {
@@ -316,8 +316,7 @@ void packet_size_breakdown(struct OPTIONS *options, char *ifname,
processpacket(buf, &ipacket, (unsigned int *) &br,
NULL, NULL, NULL, &fromaddr,
ofilter,
- MATCH_OPPOSITE_USECONFIG, NULL,
- 0);
+ MATCH_OPPOSITE_USECONFIG, 0);
if (pkt_result != PACKET_OK)
continue;
diff --git a/src/serv.c b/src/serv.c
index f0cd39f..c762104 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -862,7 +862,7 @@ void servmon(char *ifname, struct porttab *ports, const struct OPTIONS
*options,
&& (((now - starttime) / 60) >= facilitytime))
exitloop = 1;
- getpacket(fd, buf, &fromaddr, &ch, &br, NULL, list.win);
+ getpacket(fd, buf, &fromaddr, &ch, &br, list.win);
if (ch == ERR)
goto no_key_ready;
@@ -997,7 +997,7 @@ void servmon(char *ifname, struct porttab *ports, const struct OPTIONS
*options,
processpacket(buf, &ipacket, (unsigned int *) &br,
&tot_br, &sport, &dport, &fromaddr,
ofilter,
- MATCH_OPPOSITE_USECONFIG, NULL,
+ MATCH_OPPOSITE_USECONFIG,
options->v6inv4asv6);
if (pkt_result != PACKET_OK)
--
1.7.8.4