P2P: Add support for cross connection
If enabled, cross connection allows GO to forward IPv4 packets using masquerading NAT from the P2P clients in the group to an uplink WLAN connection. This is disabled by default and can be enabled with "wpa_cli p2p_set cross_connect 1" on the P2P device interface.
This commit is contained in:
parent
6c6915f3db
commit
72044390f3
15 changed files with 289 additions and 5 deletions
|
@ -54,3 +54,24 @@ if [ "$CMD" = "P2P-GROUP-REMOVED" ]; then
|
|||
ifconfig $GIFNAME 0.0.0.0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CMD" = "P2P-CROSS-CONNECT-ENABLE" ]; then
|
||||
GIFNAME=$3
|
||||
UPLINK=$4
|
||||
# enable NAT/masquarade $GIFNAME -> $UPLINK
|
||||
iptables -P FORWARD DROP
|
||||
iptables -t nat -A POSTROUTING -o $UPLINK -j MASQUERADE
|
||||
iptables -A FORWARD -i $UPLINK -o $GIFNAME -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -A FORWARD -i $GIFNAME -o $UPLINK -j ACCEPT
|
||||
sysctl net.ipv4.ip_forward=1
|
||||
fi
|
||||
|
||||
if [ "$CMD" = "P2P-CROSS-CONNECT-DISABLE" ]; then
|
||||
GIFNAME=$3
|
||||
UPLINK=$4
|
||||
# disable NAT/masquarade $GIFNAME -> $UPLINK
|
||||
sysctl net.ipv4.ip_forward=0
|
||||
iptables -t nat -D POSTROUTING -o $UPLINK -j MASQUERADE
|
||||
iptables -D FORWARD -i $UPLINK -o $GIFNAME -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
iptables -D FORWARD -i $GIFNAME -o $UPLINK -j ACCEPT
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue