netfilter_nft: improve testnftpinhole.c to test find_pinhole()
This commit is contained in:
parent
2e7bfb1e31
commit
80d628fa59
|
@ -1,7 +1,7 @@
|
||||||
/* $Id: testnftpinhole.c,v 1.2 2019/06/30 19:49:18 nanard Exp $ */
|
/* $Id: testnftpinhole.c,v 1.2 2019/06/30 19:49:18 nanard Exp $ */
|
||||||
/* MiniUPnP project
|
/* MiniUPnP project
|
||||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
* http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
||||||
* (c) 2012-2020 Thomas Bernard
|
* (c) 2012-2023 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed
|
* This software is subject to the conditions detailed
|
||||||
* in the LICENCE file provided within the distribution */
|
* in the LICENCE file provided within the distribution */
|
||||||
|
|
||||||
|
@ -22,12 +22,23 @@ time_t startup_time = 0;
|
||||||
int main(int argc, char * * argv)
|
int main(int argc, char * * argv)
|
||||||
{
|
{
|
||||||
int uid;
|
int uid;
|
||||||
|
const char * ifname = "eth0";
|
||||||
|
const char * rem_host = "2a00::dead:beaf";
|
||||||
|
unsigned short rem_port = 1911;
|
||||||
|
const char * int_client = "fe80::1023:4095";
|
||||||
|
unsigned short int_port = 34952;
|
||||||
|
char desc[1024] = { 0 };
|
||||||
|
unsigned int timestamp = 0;
|
||||||
|
|
||||||
openlog("testnftpinhole", LOG_PERROR|LOG_CONS, LOG_LOCAL0);
|
openlog("testnftpinhole", LOG_PERROR|LOG_CONS, LOG_LOCAL0);
|
||||||
|
|
||||||
uid = add_pinhole("eth0", NULL, 0, "ff::123", 54321, IPPROTO_TCP,
|
uid = add_pinhole(ifname, rem_host, rem_port, int_client, int_port, IPPROTO_TCP,
|
||||||
"dummy description", upnp_time() + 60 /* timestamp */);
|
"dummy description", upnp_time() + 60 /* timestamp */);
|
||||||
syslog(LOG_INFO, "uid=%d", uid);
|
syslog(LOG_INFO, "add_pinhole(): uid=%d", uid);
|
||||||
|
|
||||||
|
uid = find_pinhole(ifname, rem_host, rem_port, int_client, int_port, IPPROTO_TCP,
|
||||||
|
desc, sizeof(desc), ×tamp);
|
||||||
|
syslog(LOG_INFO, "find_pinhole(): uid=%d desc=\"%s\" timestamp=%u", uid, desc, timestamp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue