miniupnpd: set SNAT to support bidirectional mapping
we cannot expect that iport == eport on all the case in firewall. Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
This commit is contained in:
parent
db82286683
commit
e49d44f700
|
@ -224,17 +224,13 @@ add_redirect_rule2(const char * ifname,
|
||||||
if(r >= 0) {
|
if(r >= 0) {
|
||||||
add_redirect_desc(eport, proto, desc, timestamp);
|
add_redirect_desc(eport, proto, desc, timestamp);
|
||||||
#ifdef ENABLE_PORT_TRIGGERING
|
#ifdef ENABLE_PORT_TRIGGERING
|
||||||
/* http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-6.html#ss6.3
|
/* we now always setup SNAT to support bidirectional mapping
|
||||||
* The default behavior is to alter the connection as little
|
* we cannot expect that iport == eport on all the firewall.
|
||||||
* as possible, within the constraints of the rule given by
|
*/
|
||||||
* the user.
|
/* TODO : check if this should be done only with UDP */
|
||||||
* This means we won't remap ports unless we have to. */
|
r = addmasqueraderule(proto, eport, iaddr, iport, rhost/*, ifname*/);
|
||||||
if(iport != eport) {
|
if(r < 0) {
|
||||||
/* TODO : check if this should be done only with UDP */
|
syslog(LOG_NOTICE, "add_redirect_rule2(): addmasqueraderule returned %d", r);
|
||||||
r = addmasqueraderule(proto, eport, iaddr, iport, rhost/*, ifname*/);
|
|
||||||
if(r < 0) {
|
|
||||||
syslog(LOG_NOTICE, "add_redirect_rule2(): addmasqueraderule returned %d", r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_PORT_TRIGGERING */
|
#endif /* ENABLE_PORT_TRIGGERING */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue