miniupnpd/portinuse.c/iptcrdr.c: cosmetic changes

This commit is contained in:
Thomas Bernard 2014-03-13 14:49:05 +01:00
parent c4e63048c4
commit 15a2320c86
2 changed files with 12 additions and 5 deletions

View File

@ -285,8 +285,12 @@ get_redirect_rule(const char * ifname, unsigned short eport, int proto,
unsigned int * timestamp, unsigned int * timestamp,
u_int64_t * packets, u_int64_t * bytes) u_int64_t * packets, u_int64_t * bytes)
{ {
return get_nat_redirect_rule(miniupnpd_nat_chain, ifname, eport, proto, iaddr, iaddrlen, iport, return get_nat_redirect_rule(miniupnpd_nat_chain,
desc, desclen, rhost, rhostlen,timestamp, packets, bytes); ifname, eport, proto,
iaddr, iaddrlen, iport,
desc, desclen,
rhost, rhostlen,
timestamp, packets, bytes);
} }
int int

View File

@ -32,15 +32,18 @@
char *chains_to_check[] = { "PREROUTING" , 0 }; char *chains_to_check[] = { "PREROUTING" , 0 };
#endif #endif
int port_in_use(const char *if_name, unsigned eport, int proto, const char *iaddr, unsigned iport) int
port_in_use(const char *if_name,
unsigned eport, int proto,
const char *iaddr, unsigned iport)
{ {
char line[256]; char line[256];
FILE *f; FILE *f;
int found = 0; int found = 0;
char ip_addr_str[INET_ADDRSTRLEN]; char ip_addr_str[INET_ADDRSTRLEN];
struct in_addr ip_addr; struct in_addr ip_addr;
const char tcpfile[] = "/proc/net/tcp"; const char * tcpfile = "/proc/net/tcp";
const char udpfile[] = "/proc/net/udp"; const char * udpfile = "/proc/net/udp";
f = fopen((proto==IPPROTO_TCP)?tcpfile:udpfile, "r"); f = fopen((proto==IPPROTO_TCP)?tcpfile:udpfile, "r");
if (!f) return 0; if (!f) return 0;