libpcp / pcp Goto Github PK
View Code? Open in Web Editor NEWPCP client library
License: BSD 2-Clause "Simplified" License
PCP client library
License: BSD 2-Clause "Simplified" License
Hi
I'd like to propose setting the debug verbosity by a env variable such as PCP_DEBUG , then anyone can change the debug verbosity instead of hard coding it inside an application.
The https://github.com/miniupnp/libnatpmp is seems like a developed from scratch and not related to the libpcp.
It doesn't supports IPv6 and code looks much simpler.
But it's already used by transmission, jammi and have a python and java bindings. In the same time search by libpcp in Debian repo shows me some unrelated software.
From the patches to the ticket https://trac.transmissionbt.com/ticket/5415 I see that for transmission changes aren't so big.
So my question is: maybe you can merge this two libraries? Is it possible? Because this will allow to avoid confusion of developers about what to chose: libpcp or libnatpmp
pcp/libpcp/include/pcp.h 254:
// Allocates info_buf by malloc, has to be freed by client when longer needed.
Is it meant to be "no longer needed"?
If I run pcp_app/pcp -i :12345
it loops forever and output the following :
1s 280ms 407us DEBUG : FILE: src/pcp_event_handler.c:1183; Func: run_server_state_machine: END
1s 280ms 420us DEBUG : FILE: src/pcp_event_handler.c:1158; Func: run_server_state_machine: BEGIN
1s 280ms 433us DEBUG : FILE: src/pcp_event_handler.c:1172; Func: run_server_state_machine:
Executing server state handler log_unexepected_state_event
server : fe80::f6ca:e5ff:fe45:5e1a (index 1)
state : pss_allocated
event : pcpe_timeout
1s 280ms 457us ERROR : FILE: src/pcp_event_handler.c:1105; Func: log_unexepected_state_event:
Event happened in the state 1 on PCP server fe80::f6ca:e5ff:fe45:5e1a and there is no event handler defined.
1s 280ms 471us DEBUG : FILE: src/pcp_event_handler.c:1178; Func: run_server_state_machine:
Return from server state handler's log_unexepected_state_event
result state: pss_allocated
yves@yves-virt-7-2:~/pcp$ ./autogen.sh
Running aclocal...
Running autoheader...
Running autoconf...
configure.ac:2: warning: The macro `AC_CANONICAL_SYSTEM' is obsolete.
configure.ac:2: You should run autoupdate.
./lib/autoconf/general.m4:2081: AC_CANONICAL_SYSTEM is expanded from...
configure.ac:2: the top level
configure.ac:100: warning: The macro `AC_TRY_COMPILE' is obsolete.
configure.ac:100: You should run autoupdate.
./lib/autoconf/general.m4:2847: AC_TRY_COMPILE is expanded from...
configure.ac:100: the top level
configure.ac:189: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
yves@yves-virt-7-2:~/pcp$
And, for information:
yves@yves-virt-7-2:~/pcp$ autoconf --version
autoconf (GNU Autoconf) 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>, <https://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
yves@yves-virt-7-2:~/pcp$
I can install a virtual machine with a specific version of a specific linux distribution. Which one should I use?
Dear @libpcp team, @ptatrai, @olesalscheider, @fingon, @BenderScript, @alexmgr, @shadeslayer, @AmarOk1412, @MartinPulec,
It is possible to migrate the personal account to organization?
Converting:
It is possible to rename this account and create the organization and move/transfer the repository to the organization.
Rename account:
Create an organization:
Transfer a repository:
Like:
In the readme,
Supported platforms are Linux, MS Windows Vista and later, OS X.
might be explained as OS X will be supported "later".
Maybe you can rephrase it to "MS Windows(Vista and later), OS X"?
Just a thought.
This doesn't seem to compile on OSX. When using autogen.sh it's looking for libtoolize which seems to be glibtoolize from macports. When using cmake the file pcp_app.c seems to include getopt.h which is in the win_utils directory which references windows.h. When moving getopt.h in to the #ifdef WIN32 section it seems pcp_gettimeofday.c still gets pulled in somehow which is also in the windows directory.
I'm dealing mostly with multi-prefix home networks. In that case, on e.g. eth0, you may have 2001:db8:1::1/64 and 2001:db8:2::1/64 addresses on that same interface.
The pcp_server_discovery.c seems to assume that you can use exactly one address to communicate with a server (which is not obviously true). Any insight on how this could be fixed?
From my point of view, the correct way to handle this would be to bind to any socket, but then use specific from address that matches the 'internal' IP address; if that's not possible, avoid using that server.
Code:
pcp_ctx_t *pcpCTX = pcp_init(ENABLE_AUTODISCOVERY);
Error:
pcp.c:6:52: error: too few arguments to function call, expected 2, have 1
pcp_ctx_t *pcpCXT = pcp_init(ENABLE_AUTODISCOVERY);
~~~~~~~~ ^
But in pcp.h the second argument is marked optional.
Did I miss something here?
I get this error when running autogen.sh. Tried on a couple different distros. Is it possible that this file missed its commit?
Running automake...
configure.ac:9: required file `libpcp/libpcp.pc.in' not found
When compiling this on Ubuntu, I get the following error messages:
$ make
(CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/me/pcp/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/bash ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make all-recursive
make[1]: Entering directory '/home/me/pcp'
Making all in libpcp
make[2]: Entering directory '/home/me/pcp/libpcp'
CC src/pcp_logger.lo
CC src/pcp_server_discovery.lo
In file included from src/pcp_server_discovery.c:47:0:
src/pcp_utils.h:247:0: error: "strndup" redefined [-Werror]
#define strndup pcp_strndup
^
In file included from /usr/include/string.h:634:0,
from src/pcp_server_discovery.c:35:
/usr/include/x86_64-linux-gnu/bits/string2.h:1319:0: note: this is the location of the previous definition
# define strndup(s, n) __strndup (s, n)
^
src/pcp_server_discovery.c: In function 'psd_fill_pcp_server_src':
src/pcp_server_discovery.c:107:5: error: implicit declaration of function 'pcp_fill_sockaddr' [-Werror=implicit-function-declaration]
pcp_fill_sockaddr((struct sockaddr *)&s->pcp_server_saddr,
^
cc1: all warnings being treated as errors
Makefile:508: recipe for target 'src/pcp_server_discovery.lo' failed
make[2]: *** [src/pcp_server_discovery.lo] Error 1
make[2]: Leaving directory '/home/me/pcp/libpcp'
Makefile:656: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/me/pcp'
Makefile:587: recipe for target 'all' failed
make: *** [all] Error 2
What might be the reason?
Your pcp_app seems to send the IPv6 zero address (::) rather than the IPv4 zero address (::ffff:0.0.0.0) as the suggested external address even for requests from IPv4 internal addresses to IPv4 PCP servers.
RFC6887 Section 10 suggests that using the other family's zero address makes it a request for NAT64/NAT46, which is probably not what you want as the default.
Hi,
I have a question about pcp MAP lifetimes. According to https://www.rfc-editor.org/rfc/rfc6887#section-15 the lifetime is the duration that the port mapping is active. This also matches the documentation of the flow API. However I observe that the behavior of libpcp is to renew the mapping by sending a new MAP request at lifetime/2 seconds. There is no end to this mapping.
Should the documentation be updated or is this a bug in the implementation?
Kind regards,
Boris
////////////////////////////////////////////////////////////////////////////////
// Flow API
/*
* Creates new PCP message from parameters parsed to this function:
* src_addr source IP/port
* dst_addr destination IP/port - optional
* ext_addr sugg. ext. IP/port - optional
* protocol protocol associated with flow
* lifetime time in seconds how long should mapping last
* userdata pointer to user data associated with a new flow
*
* return value
* pcp_flow_t *used in other functions to reference this flow.
*/
pcp_flow_t *pcp_new_flow(pcp_ctx_t *ctx, struct sockaddr *src_addr,
struct sockaddr *dst_addr, struct sockaddr *ext_addr, uint8_t protocol,
uint32_t lifetime, void *userdata);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.