Added PCP third party option and made it's use an option.
This commit is contained in:
parent
6d379d54f5
commit
c801138c63
|
@ -995,6 +995,9 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
||||||
max_lifetime = 86400;
|
max_lifetime = 86400;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case UPNPPCPALLOWTHIRDPARTY:
|
||||||
|
allow_thirdparty = true;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PF_ENABLE_FILTER_RULES
|
#ifdef PF_ENABLE_FILTER_RULES
|
||||||
case UPNPQUICKRULES:
|
case UPNPQUICKRULES:
|
||||||
|
|
|
@ -65,6 +65,7 @@ static const struct {
|
||||||
#ifdef ENABLE_PCP
|
#ifdef ENABLE_PCP
|
||||||
{ UPNPPCPMINLIFETIME, "min_lifetime"},
|
{ UPNPPCPMINLIFETIME, "min_lifetime"},
|
||||||
{ UPNPPCPMAXLIFETIME, "max_lifetime"},
|
{ UPNPPCPMAXLIFETIME, "max_lifetime"},
|
||||||
|
{ UPNPPCPALLOWTHIRDPARTY, "allow_thirdparty"},
|
||||||
#endif
|
#endif
|
||||||
{ UPNPENABLE, "enable_upnp"},
|
{ UPNPENABLE, "enable_upnp"},
|
||||||
#ifdef USE_PF
|
#ifdef USE_PF
|
||||||
|
|
|
@ -44,6 +44,7 @@ enum upnpconfigoptions {
|
||||||
UPNPENABLENATPMP, /* enable_natpmp */
|
UPNPENABLENATPMP, /* enable_natpmp */
|
||||||
UPNPPCPMINLIFETIME, /* minimum lifetime for PCP mapping */
|
UPNPPCPMINLIFETIME, /* minimum lifetime for PCP mapping */
|
||||||
UPNPPCPMAXLIFETIME, /* maximum lifetime for PCP mapping */
|
UPNPPCPMAXLIFETIME, /* maximum lifetime for PCP mapping */
|
||||||
|
UPNPPCPALLOWTHIRDPARTY, /* allow third-party requests */
|
||||||
#ifdef USE_NETFILTER
|
#ifdef USE_NETFILTER
|
||||||
UPNPFORWARDCHAIN,
|
UPNPFORWARDCHAIN,
|
||||||
UPNPNATCHAIN,
|
UPNPNATCHAIN,
|
||||||
|
|
|
@ -118,7 +118,7 @@ typedef struct pcp_info {
|
||||||
#endif
|
#endif
|
||||||
uint8_t is_map_op;
|
uint8_t is_map_op;
|
||||||
uint8_t is_peer_op;
|
uint8_t is_peer_op;
|
||||||
int thirdp_present; /* indicate presence of the options */
|
const struct in6_addr *thirdp_ip;
|
||||||
int pfailure_present;
|
int pfailure_present;
|
||||||
char senderaddrstr[INET_ADDRSTRLEN]; /* only if IPv4 sender */
|
char senderaddrstr[INET_ADDRSTRLEN]; /* only if IPv4 sender */
|
||||||
|
|
||||||
|
@ -437,13 +437,13 @@ static int parsePCPOptions(void* pcp_buf, int* remainingSize,
|
||||||
syslog(LOG_DEBUG, "Third PARTY IP: \t %s\n", inet_ntop(AF_INET6,
|
syslog(LOG_DEBUG, "Third PARTY IP: \t %s\n", inet_ntop(AF_INET6,
|
||||||
&(opt_3rd->ip), third_addr, INET6_ADDRSTRLEN));
|
&(opt_3rd->ip), third_addr, INET6_ADDRSTRLEN));
|
||||||
#endif
|
#endif
|
||||||
if (pcp_msg_info->thirdp_present != 0 ) {
|
if (pcp_msg_info->thirdp_ip ) {
|
||||||
|
|
||||||
syslog(LOG_ERR, "PCP: THIRD PARTY OPTION was already present. \n");
|
syslog(LOG_ERR, "PCP: THIRD PARTY OPTION was already present. \n");
|
||||||
pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION;
|
pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pcp_msg_info->thirdp_present = 1;
|
pcp_msg_info->thirdp_ip = &opt_3rd -> ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
processed += sizeof(pcp_3rd_party_option_t);
|
processed += sizeof(pcp_3rd_party_option_t);
|
||||||
|
|
|
@ -34,6 +34,7 @@ time_t startup_time = 0;
|
||||||
/* for PCP */
|
/* for PCP */
|
||||||
unsigned long int min_lifetime = 120;
|
unsigned long int min_lifetime = 120;
|
||||||
unsigned long int max_lifetime = 86400;
|
unsigned long int max_lifetime = 86400;
|
||||||
|
int allow_thirdparty = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int runtime_flags = 0;
|
int runtime_flags = 0;
|
||||||
|
|
|
@ -34,7 +34,7 @@ extern time_t startup_time;
|
||||||
|
|
||||||
extern unsigned long int min_lifetime;
|
extern unsigned long int min_lifetime;
|
||||||
extern unsigned long int max_lifetime;
|
extern unsigned long int max_lifetime;
|
||||||
|
extern int allow_thirdparty;
|
||||||
|
|
||||||
/* runtime boolean flags */
|
/* runtime boolean flags */
|
||||||
extern int runtime_flags;
|
extern int runtime_flags;
|
||||||
|
|
Loading…
Reference in New Issue