testnftpinhole: call init_redirect() / shutdown_redirect()
This commit is contained in:
parent
b3b5dd16d2
commit
25206a7a3f
|
@ -21,7 +21,7 @@ config.h:
|
|||
|
||||
testnftnlrdr: nftnlrdr.o nftnlrdr_misc.o testnftnlrdr.o $(LIBS)
|
||||
|
||||
testnftpinhole: nftpinhole.o nftnlrdr_misc.o testnftpinhole.o \
|
||||
testnftpinhole: nftpinhole.o nftnlrdr.o nftnlrdr_misc.o testnftpinhole.o \
|
||||
../upnputils.o ../linux/getroute.o $(LIBS)
|
||||
|
||||
test_nfct_get: test_nfct_get.o test_nfct_get.o -lmnl -lnetfilter_conntrack
|
||||
|
|
|
@ -47,7 +47,7 @@ static void print_infos(unsigned short uid)
|
|||
|
||||
int main(int argc, char * * argv)
|
||||
{
|
||||
int uid;
|
||||
int uid, r;
|
||||
const char * ifname = "eth0";
|
||||
const char * rem_host = "2a00::dead:beaf";
|
||||
unsigned short rem_port = 1911;
|
||||
|
@ -58,6 +58,12 @@ int main(int argc, char * * argv)
|
|||
|
||||
openlog("testnftpinhole", LOG_PERROR|LOG_CONS, LOG_LOCAL0);
|
||||
|
||||
r = init_redirect();
|
||||
if (r < 0) {
|
||||
syslog(LOG_ERR, "init_redirect() failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
uid = add_pinhole(ifname, rem_host, rem_port, int_client, int_port, IPPROTO_TCP,
|
||||
"dummy description", upnp_time() + 60 /* timestamp */);
|
||||
syslog(LOG_INFO, "add_pinhole(): uid=%d", uid);
|
||||
|
@ -68,7 +74,6 @@ int main(int argc, char * * argv)
|
|||
syslog(LOG_INFO, "find_pinhole(): uid=%d desc=\"%s\" timestamp=%u", uid, desc, timestamp);
|
||||
|
||||
if (uid >= 0) {
|
||||
int r;
|
||||
print_infos(uid);
|
||||
|
||||
r = update_pinhole(uid, upnp_time() + 3600);
|
||||
|
@ -79,6 +84,8 @@ int main(int argc, char * * argv)
|
|||
syslog(LOG_INFO, "delete_pinhole(%d) returned %d", uid, r);
|
||||
}
|
||||
|
||||
shutdown_redirect();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue