Skip to contentSkip to conversation

--dev and --dev-name under linux 2.4+

Openvpn-devel James Yonan 3 participants 5 messages Jun 2, 2003 – Jun 3, 2003

lore
Share & tools
lore
#0 lore raw

A debian bug report was submitted that inspired me to look deeper into the operation of --dev and the new --dev-name flag.

--dev-name was a patch for tun.c which I received a few months ago, which only really does anything for linux 2.4. On first glance it appeared nominally useful, so I merged it, but on further inspection it appears to be mostly redundant with --dev.

It appears that the motivation for implementing --dev-name was that --dev assumes its argument is either "tun", "tap", "null", or tun/tap with a unit number (e.g. "tun4"). But --dev is limited in that it doesn't allow arbitrary renaming.

In OpenVPN 1.3.2, if the --dev argument was larger than 3 chars, it was assumed that a unit number was present. In 1.4.1 that test was changed so that an ascii digit needed to be present to assume a unit number. If a unit number was present, then the name of the device (as it appears in ifconfig) would be changed to reflect the explicit unit number. What I think probably inspired the debian bug report is that in 1.3.2 if you said "--dev foobar --dev-type tun", openvpn would have renamed the tun device to foobar, because foobar is > 3 characters. In 1.4.1, no rename would occur because "foobar" doesn't contain any numerical digits. In 1.4.1, you would need to say "--dev tun --dev-name foobar" to get the same effect. This seems somewhat arbitrary and confusing.

My conclusion is that the implementation of --dev and --dev-name is mostly redundant because --dev can just as easily set the device name based on its argument, if that argument is something other than "tun", "tap", "null". The current operation of "--dev tun" or "--dev tap" would be preserved so that a dynamic unit number would be allocated if, for example, "--dev tun4" is given.
But you could also specify "--dev foo --dev-type tun" and a tun device named
foo would be created.

I've patched the current development release to remove --dev-name, and to allow --dev to set a specific device name as in the above paragraph.

Download:

http://openvpn.sourceforge.net/beta/openvpn-1.4.1.4.tar.gz (or CVS)

James

#1 lore raw

Hi James,

The original reason for the new option for me was the ability to move the device file away from /dev.

This was of cource a really special need to help me porting openvpn to an embedded platform.

How about if --dev would check if the given device name begins with / and if so it would use given string as a complete path to the device file?

And --dev /dev/tun would be equivalent with --dev tun ?

Best regards,
Sampo

Quoted 53 lines

A debian bug report was submitted that inspired me to look deeper into the operation of --dev and the new --dev-name flag.

--dev-name was a patch for tun.c which I received a few months ago, which only really does anything for linux 2.4. On first glance it appeared nominally useful, so I merged it, but on further inspection it appears to be mostly redundant with --dev.

It appears that the motivation for implementing --dev-name was that --dev assumes its argument is either "tun", "tap", "null", or tun/tap with a unit number (e.g. "tun4"). But --dev is limited in that it doesn't allow arbitrary renaming.

In OpenVPN 1.3.2, if the --dev argument was larger than 3 chars, it was assumed that a unit number was present. In 1.4.1 that test was changed so that an ascii digit needed to be present to assume a unit number. If a unit number was present, then the name of the device (as it appears in ifconfig) would be changed to reflect the explicit unit number. What I think probably inspired the debian bug report is that in 1.3.2 if you said "--dev foobar --dev-type tun", openvpn would have renamed the tun device to foobar, because foobar is > 3 characters. In 1.4.1, no rename would occur because "foobar" doesn't contain any numerical digits. In 1.4.1, you would need to say "--dev tun --dev-name foobar" to get the same effect. This seems somewhat arbitrary and confusing.

My conclusion is that the implementation of --dev and --dev-name is mostly redundant because --dev can just as easily set the device name based on its argument, if that argument is something other than "tun", "tap", "null". The current operation of "--dev tun" or "--dev tap" would be preserved so that a dynamic unit number would be allocated if, for example, "--dev tun4" is given.
But you could also specify "--dev foo --dev-type tun" and a tun device named
foo would be created.

I've patched the current development release to remove --dev-name, and to allow --dev to set a specific device name as in the above paragraph.

Download:

http://openvpn.sourceforge.net/beta/openvpn-1.4.1.4.tar.gz (or CVS)

James

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#2 lore raw

Hi Sampo,

See comments inline...

Quoted 5 lines · Sampo Nurmentaus

Hi James,

The original reason for the new option for me was the ability to move the device file away from /dev.

Why not use --dev-node?

Quoted 8 lines

This was of cource a really special need to help me porting openvpn to an embedded platform.

How about if --dev would check if the given device name begins with / and if so it would use given string as a complete path to the device file?

And --dev /dev/tun would be equivalent with --dev tun ?

--dev doesn't really deal with path names of device nodes, that's --dev-node's purview. Instead --dev sets the name for the device unit allocated, as it appears under ifconfig, or if the name is generic, such as "--dev tun", chooses a dynamic name such as tun4.

In my latest patch which merges --dev-name functionality with --dev, these are our options for dealing with tun/tap naming:

--dev : sets the device name as it appears under ifconfig --dev-node : sets the device file for tun/tap device --dev-type : sets the device type "tun|tap" if it cannot be inferred from --dev or --dev-node

So, for example, under linux 2.4, "--dev-node /dev/net/tun" is equivalent to "--dev tun".

James

Quoted 61 lines

Best regards,
Sampo

Quoted 53 lines

A debian bug report was submitted that inspired me to look deeper into the operation of --dev and the new --dev-name flag.

--dev-name was a patch for tun.c which I received a few months ago, which only really does anything for linux 2.4. On first glance it appeared nominally useful, so I merged it, but on further inspection it appears to be mostly redundant with --dev.

It appears that the motivation for implementing --dev-name was that --dev assumes its argument is either "tun", "tap", "null", or tun/tap with a unit number (e.g. "tun4"). But --dev is limited in that it doesn't allow arbitrary renaming.

In OpenVPN 1.3.2, if the --dev argument was larger than 3 chars, it was assumed that a unit number was present. In 1.4.1 that test was changed so that an ascii digit needed to be present to assume a unit number. If a unit number was present, then the name of the device (as it appears in ifconfig) would be changed to reflect the explicit unit number. What I think probably inspired the debian bug report is that in 1.3.2 if you said "--dev foobar --dev-type tun", openvpn would have renamed the tun device to foobar, because foobar is > 3 characters. In 1.4.1, no rename would occur because "foobar" doesn't contain any numerical digits. In 1.4.1, you would need to say "--dev tun --dev-name foobar" to get the same effect. This seems somewhat arbitrary and confusing.

My conclusion is that the implementation of --dev and --dev-name is mostly redundant because --dev can just as easily set the device name based on its argument, if that argument is something other than "tun", "tap", "null". The current operation of "--dev tun" or "--dev tap" would be preserved so that a dynamic unit number would be allocated if, for example, "--dev tun4" is given.
But you could also specify "--dev foo --dev-type tun" and a tun device named
foo would be created.

I've patched the current development release to remove --dev-name, and to allow --dev to set a specific device name as in the above paragraph.

Download:

http://openvpn.sourceforge.net/beta/openvpn-1.4.1.4.tar.gz (or CVS)

James

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#3 lore raw

Hi,

Sounds very reasonable to me.

And again, my needs on a special embedded hardware with /dev on read-only flash partition are of special kind, so it is perfectly ok for me to use openvpn in a bit hacked manner. I think the main goal is that command line options for a regular user remains as simple as possible.

So to put it short, I do agree with you.

SaBe

Quoted 105 lines

Hi Sampo,

See comments inline...

Quoted 5 lines · Sampo Nurmentaus

Hi James,

The original reason for the new option for me was the ability to move the device file away from /dev.

Why not use --dev-node?

Quoted 8 lines

This was of cource a really special need to help me porting openvpn to an embedded platform.

How about if --dev would check if the given device name begins with / and if so it would use given string as a complete path to the device file?

And --dev /dev/tun would be equivalent with --dev tun ?

--dev doesn't really deal with path names of device nodes, that's --dev-node's purview. Instead --dev sets the name for the device unit allocated, as it appears under ifconfig, or if the name is generic, such as "--dev tun", chooses a dynamic name such as tun4.

In my latest patch which merges --dev-name functionality with --dev, these are our options for dealing with tun/tap naming:

--dev : sets the device name as it appears under ifconfig --dev-node : sets the device file for tun/tap device --dev-type : sets the device type "tun|tap" if it cannot be inferred from --dev or --dev-node

So, for example, under linux 2.4, "--dev-node /dev/net/tun" is equivalent to "--dev tun".

James

Quoted 61 lines

Best regards,
Sampo

Quoted 53 lines

A debian bug report was submitted that inspired me to look deeper into the operation of --dev and the new --dev-name flag.

--dev-name was a patch for tun.c which I received a few months ago, which only really does anything for linux 2.4. On first glance it appeared nominally useful, so I merged it, but on further inspection it appears to be mostly redundant with --dev.

It appears that the motivation for implementing --dev-name was that --dev assumes its argument is either "tun", "tap", "null", or tun/tap with a unit number (e.g. "tun4"). But --dev is limited in that it doesn't allow arbitrary renaming.

In OpenVPN 1.3.2, if the --dev argument was larger than 3 chars, it was assumed that a unit number was present. In 1.4.1 that test was changed so that an ascii digit needed to be present to assume a unit number. If a unit number was present, then the name of the device (as it appears in ifconfig) would be changed to reflect the explicit unit number. What I think probably inspired the debian bug report is that in 1.3.2 if you said "--dev foobar --dev-type tun", openvpn would have renamed the tun device to foobar, because foobar is > 3 characters. In 1.4.1, no rename would occur because "foobar" doesn't contain any numerical digits. In 1.4.1, you would need to say "--dev tun --dev-name foobar" to get the same effect. This seems somewhat arbitrary and confusing.

My conclusion is that the implementation of --dev and --dev-name is mostly redundant because --dev can just as easily set the device name based on its argument, if that argument is something other than "tun", "tap", "null". The current operation of "--dev tun" or "--dev tap" would be preserved so that a dynamic unit number would be allocated if, for example, "--dev tun4" is given.
But you could also specify "--dev foo --dev-type tun" and a tun device named
foo would be created.

I've patched the current development release to remove --dev-name, and to allow --dev to set a specific device name as in the above paragraph.

Download:

http://openvpn.sourceforge.net/beta/openvpn-1.4.1.4.tar.gz (or CVS)

James

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#4 lore raw
In reply to James Yonan

On Tue, 3 Jun 2003 01:36:55 -0000
"James Yonan" <[email protected]...> wrote:

Hi, James,

I wrote this --dev-name - patch. I'm sorry, if I oversaw the interference with --dev.

What I need is the posibility to group my different openvpn-interfaces by name, so I can assign firewall-rules more generally using wildcards for interface-names (like "iptables --in-interface office+ ..." or "... --in-interface customer+").

If --dev renames the interfaces (--dev "office01" or --dev "customer4711"), that perfectly fits my needs.

Thank you for your great software!

Regards, Christian.

Quoted 53 lines

A debian bug report was submitted that inspired me to look deeper into the operation of --dev and the new --dev-name flag.

--dev-name was a patch for tun.c which I received a few months ago, which only really does anything for linux 2.4. On first glance it appeared nominally useful, so I merged it, but on further inspection it appears to be mostly redundant with --dev.

It appears that the motivation for implementing --dev-name was that --dev assumes its argument is either "tun", "tap", "null", or tun/tap with a unit number (e.g. "tun4"). But --dev is limited in that it doesn't allow arbitrary renaming.

In OpenVPN 1.3.2, if the --dev argument was larger than 3 chars, it was assumed that a unit number was present. In 1.4.1 that test was changed so that an ascii digit needed to be present to assume a unit number. If a unit number was present, then the name of the device (as it appears in ifconfig) would be changed to reflect the explicit unit number. What I think probably inspired the debian bug report is that in 1.3.2 if you said "--dev foobar --dev-type tun", openvpn would have renamed the tun device to foobar, because foobar is > 3 characters. In 1.4.1, no rename would occur because "foobar" doesn't contain any numerical digits. In 1.4.1, you would need to say "--dev tun --dev-name foobar" to get the same effect. This seems somewhat arbitrary and confusing.

My conclusion is that the implementation of --dev and --dev-name is mostly redundant because --dev can just as easily set the device name based on its argument, if that argument is something other than "tun", "tap", "null". The current operation of "--dev tun" or "--dev tap" would be preserved so that a dynamic unit number would be allocated if, for example, "--dev tun4" is given.
But you could also specify "--dev foo --dev-type tun" and a tun device named
foo would be created.

I've patched the current development release to remove --dev-name, and to allow --dev to set a specific device name as in the above paragraph.

Download:

http://openvpn.sourceforge.net/beta/openvpn-1.4.1.4.tar.gz (or CVS)

James

-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel