@@ -26,10 +26,10 @@ def initialize(info={})
26
26
27
27
register_options (
28
28
[
29
- OptAddress . new ( 'LADDRESS ' , [ true , 'IPv4/IPv6 address to which to listen.' ] ) ,
30
- OptAddress . new ( 'CADDRESS ' , [ true , 'IPv4/IPv6 address to which to connect.' ] ) ,
31
- OptInt . new ( 'CPORT ' , [ true , 'Port number to which to connect.' ] ) ,
32
- OptInt . new ( 'LPORT ' , [ true , 'Port number to which to listen.' ] ) ,
29
+ OptAddress . new ( 'LOCAL_ADDRESS ' , [ true , 'IPv4/IPv6 address to which to listen.' ] ) ,
30
+ OptAddress . new ( 'CONNECT_ADDRESS ' , [ true , 'IPv4/IPv6 address to which to connect.' ] ) ,
31
+ OptInt . new ( 'CONNECT_PORT ' , [ true , 'Port number to which to connect.' ] ) ,
32
+ OptInt . new ( 'LOCAL_PORT ' , [ true , 'Port number to which to listen.' ] ) ,
33
33
OptBool . new ( 'IPV6_XP' , [ true , 'Install IPv6 on Windows XP (needed for v4tov4).' , true ] ) ,
34
34
OptEnum . new ( 'TYPE' , [ true , 'Type of forwarding' , 'v4tov4' , [ 'v4tov4' , 'v6tov6' , 'v6tov4' , 'v4tov6' ] ] )
35
35
] , self . class )
@@ -62,10 +62,10 @@ def enable_portproxy
62
62
print_status ( "Setting PortProxy ..." )
63
63
netsh_args = "interface portproxy "
64
64
netsh_args << "add #{ datastore [ 'TYPE' ] } "
65
- netsh_args << "listenport=#{ datastore [ 'LPORT ' ] } "
66
- netsh_args << "listenaddress=#{ datastore [ 'LADDRESS ' ] } "
67
- netsh_args << "connectport=#{ datastore [ 'CPORT ' ] } "
68
- netsh_args << "connectaddress=#{ datastore [ 'CADDRESS ' ] } "
65
+ netsh_args << "listenport=#{ datastore [ 'LOCAL_PORT ' ] } "
66
+ netsh_args << "listenaddress=#{ datastore [ 'LOCAL_ADDRESS ' ] } "
67
+ netsh_args << "connectport=#{ datastore [ 'CONNECT_PORT ' ] } "
68
+ netsh_args << "connectaddress=#{ datastore [ 'CONNECT_ADDRESS ' ] } "
69
69
output = cmd_exec ( "netsh" , netsh_args )
70
70
if output . size > 2
71
71
print_error ( "Setup error. Verify parameters and syntax." )
@@ -113,16 +113,16 @@ def check_ipv6
113
113
end
114
114
115
115
def fw_enable_ports
116
- print_status ( "Setting port #{ datastore [ 'LPORT ' ] } in Windows Firewall ..." )
116
+ print_status ( "Setting port #{ datastore [ 'LOCAL_PORT ' ] } in Windows Firewall ..." )
117
117
begin
118
118
if sysinfo [ "OS" ] =~ /Windows 7|Vista|2008|2012/
119
- cmd_exec ( "netsh" , "advfirewall firewall add rule name=\" Windows Service\" dir=in protocol=TCP action=allow localport=\" #{ datastore [ 'LPORT ' ] } \" " )
119
+ cmd_exec ( "netsh" , "advfirewall firewall add rule name=\" Windows Service\" dir=in protocol=TCP action=allow localport=\" #{ datastore [ 'LOCAL_PORT ' ] } \" " )
120
120
else
121
- cmd_exec ( "netsh" , "firewall set portopening protocol=TCP port=\" #{ datastore [ 'LPORT ' ] } \" " )
121
+ cmd_exec ( "netsh" , "firewall set portopening protocol=TCP port=\" #{ datastore [ 'LOCAL_PORT ' ] } \" " )
122
122
end
123
123
output = cmd_exec ( "netsh" , "firewall show state" )
124
124
125
- if output =~ /^#{ datastore [ 'LPORT ' ] } /
125
+ if output =~ /^#{ datastore [ 'LOCAL_PORT ' ] } /
126
126
print_good ( "Port opened in Windows Firewall." )
127
127
else
128
128
print_error ( "There was an error enabling the port." )
0 commit comments