miniupnpd/pcp: Send PCP announcment at startup

fixes #254
This commit is contained in:
Thomas Bernard 2018-05-08 23:06:19 +02:00
parent b3849ef311
commit e11bbf0bc0
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
3 changed files with 22 additions and 2 deletions

View File

@ -2081,6 +2081,18 @@ main(int argc, char * * argv)
tomato_helper();
#endif
#ifdef ENABLE_PCP
if(GETFLAG(ENABLENATPMPMASK))
{
/* Send PCP startup announcements */
#ifdef ENABLE_IPV6
PCPSendUnsolicitedAnnounce(snatpmp, addr_count, spcp_v6);
#else /* IPv4 only */
PCPSendUnsolicitedAnnounce(snatpmp, addr_count);
#endif
}
#endif
/* main loop */
while(!quitting)
{

View File

@ -1637,9 +1637,9 @@ int OpenAndConfPCPv6Socket(void)
#endif /*ENABLE_IPV6*/
#ifdef ENABLE_IPV6
static void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets, int socket6)
void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets, int socket6)
#else /* IPv4 only */
static void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets)
void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets)
#endif
{
int i;

View File

@ -52,6 +52,14 @@ int ProcessIncomingPCPPacket(int s, unsigned char *msg_buff, int len,
*/
int OpenAndConfPCPv6Socket(void);
/*
* Send Unsolicited ANNOUNCE Message
*/
#ifdef ENABLE_IPV6
void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets, int socket6);
#else /* IPv4 only */
void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets);
#endif
/*
* To be called when Public IP address changed (IPv4)