--local, --lport and --bind
Currently, openvpn only accepts "bind" if both "lport" and "local" options are specified. Why?
Why can't I specify "local" to instruct openvpn to bind to a specific IP address or interface and leave it to decide a (random) port it binds to in the same way in which the "nobind" option currently functions? What is the reason for this unnecessary restriction?
Hi,
Quoted 7 lines · Dash Four
Currently, openvpn only accepts "bind" if both "lport" and "local" options are specified. Why?
Why can't I specify "local" to instruct openvpn to bind to a specific IP address or interface and leave it to decide a (random) port it binds to in the same way in which the "nobind" option currently functions? What is the reason for this unnecessary restriction?
If I'm not mistaken, "the C API" - bind() always takes an address *and* a port number, so you can't just bind to an address alone. (You can bind to a port alone because there's INADDR_ANY for "take any address on the system", but there's no specific "ANY_PORT"). Arne, correct me if I'm wrong.
I think OpenVPN *could* make use of the --multihome mechanism to specify a source address (--local) without binding - but the multitude of open issues in trac regarding --multihome suggests there's good reasons why this is not done today.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...2014-02-09 12:50 GMT+01:00 Gert Doering <[email protected]...>:
Quoted 28 lines
Hi,
Quoted 7 lines · Dash Four
Currently, openvpn only accepts "bind" if both "lport" and "local" options are specified. Why?
Why can't I specify "local" to instruct openvpn to bind to a specific IP address or interface and leave it to decide a (random) port it binds to in the same way in which the "nobind" option currently functions? What is the reason for this unnecessary restriction?
If I'm not mistaken, "the C API" -
bind()always takes an address *and* a port number, so you can't just bind to an address alone. (You can bind to a port alone because there'sINADDR_ANYfor "take any address on the system", but there's no specific "ANY_PORT"). Arne, correct me if I'm wrong.I think OpenVPN *could* make use of the --multihome mechanism to specify a source address (--local) without binding - but the multitude of open issues in trac regarding --multihome suggests there's good reasons why this is not done today.
gert
--
USENET is *not* the non-clickable part of WWW!//www.muc.de/~gert/Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...
Quoted 10 lines
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Hi,
Although it is not easy to find on the Internet, you can bind a client socket to a specific IP adress, while setting the port as 0, meaning "choose for me". This is the same behaviour as not calling "bind" at all and leave the kernel the choice of the port and the IP address. Evidence in the source here :
http://lxr.free-electrons.com/source/net/ipv4/af_inet.c#L175
Or more generally, in "TCP/IP Illustrated: The Implementation, Vol. 2 " by Gary R. Wright and W. Richard Stevens.
I sometimes use this mechanism (bind <myip> + lport = 0) in combination with source routing to force an OpenVPN client out a specific interface.
Cheers
Mickael
Hi,
Quoted 3 lines · Mickael Chazaux
Although it is not easy to find on the Internet, you can bind a client socket to a specific IP adress, while setting the port as 0, meaning "choose for me".
Ah, good. So there *is* a "I do not want a specific port" setting.
Seems we need to improve documentation :-) (but maybe the new code from Arne that went into 2.4-to-be already does this properly, as in, "not require --lport setting for --bind")
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Am 09.02.14 16:19, schrieb Gert Doering:
Quoted 13 lines
Hi,
Quoted 3 lines · Mickael Chazaux
Although it is not easy to find on the Internet, you can bind a client socket to a specific IP adress, while setting the port as 0, meaning "choose for me".
Ah, good. So there *is* a "I do not want a specific port" setting.
Seems we need to improve documentation :-) (but maybe the new code from Arne that went into 2.4-to-be already does this properly, as in, "not require --lport setting for --bind")
Does lport 0 work?
Arne
2014-02-09 16:34 GMT+01:00 Arne Schwabe <[email protected]...>:
Quoted 7 lines
Am 09.02.14 16:19, schrieb Gert Doering:
Quoted 6 lines
Hi,
Quoted 3 lines · Mickael Chazaux
Although it is not easy to find on the Internet, you can bind a client socket to a specific IP adress, while setting the port as 0, meaning "choose for me".
Quoted 9 lines
Quoted 7 lines
Ah, good. So there *is* a "I do not want a specific port" setting.
Seems we need to improve documentation :-) (but maybe the new code from Arne that went into 2.4-to-be already does this properly, as in, "not require --lport setting for --bind")
Does lport 0 work?
Yes. I use it (see my previous mail). But it is not documented in openVPN, and the use of a port value of 0 in bind() hardly. In the source the --lport value is sent to bind() directly, so it happens to work. It would be great if --lport 0 were mentioned in the manual, to avoid breaking this behavior in the future.
Mickael
Quoted 10 lines
Quoted 3 lines
Does lport 0 work?
Yes. I use it (see my previous mail). But it is not documented in openVPN, and the use of a port value of 0 in
bind()hardly. In the source the --lport value is sent tobind()directly, so it happens to work. It would be great if --lport 0 were mentioned in the manual, to avoid breaking this behavior in the future.
I might alread have broken this. I am not sure how getaddrinfo reacts to "0" instead of NULL of servname.
Arne
Quoted 11 lines · Arne Schwabe
Quoted 11 lines
Quoted 3 lines
Does lport 0 work?
Yes. I use it (see my previous mail). But it is not documented in openVPN, and the use of a port value of 0 in
bind()hardly. In the source the --lport value is sent tobind()directly, so it happens to work. It would be great if --lport 0 were mentioned in the manual, to avoid breaking this behavior in the future.
Quoted 3 lines
I might alread have broken this. I am not sure how getaddrinfo reacts to "0" instead of NULL of servname.
So, can I use this undocumented option to allow the OS to determine a random port for me?
2014-02-10 10:12 GMT+01:00 Dash Four <[email protected]...>:
Quoted 14 lines
Quoted 11 lines · Arne Schwabe
Quoted 11 lines
Quoted 3 lines
Does lport 0 work?
Yes. I use it (see my previous mail). But it is not documented in openVPN, and the use of a port value of 0 in
bind()hardly. In the source the --lport value is sent tobind()directly, so it happens to work. It would be great if --lport 0 were mentioned in the manual, to avoid breaking this behavior in the future.
Quoted 6 lines
Quoted 3 lines
I might alread have broken this. I am not sure how getaddrinfo reacts to "0" instead of NULL of servname.
So, can I use this undocumented option to allow the OS to determine a random port for me?
It works at least on version 2.2.1.
Mickael
Hi,
Quoted 3 lines · Mickael Chazaux
Quoted 2 lines
So, can I use this undocumented option to allow the OS to determine a random port for me?
It works at least on version 2.2.1.
Then it will also work in 2.3.x, but it might have been broken by the changes introduced by the dual stack patches in git master (-> 2.4). We need to test this.
And then document :-)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...