Re: [Openvpn-devel] [V2.4 0/4] tun cleanups

2012-06-18 Thread Arne Schwabe
Am 18.06.12 20:42, schrieb Alon Bar-Lev:
> On Mon, Jun 18, 2012 at 9:21 PM, Arne Schwabe  wrote:
>> Am 12.05.12 21:31, schrieb Alon Bar-Lev:
>>> Platform independent interface for tun provider.
>>>
>>> Split the long tun.c into platform specific files using
>>> tun_engine interface.
>>>
>>> Functionality is the same.
>>>
>>> Maintenance will be much easier! new options, like stacking
>>> several interfaces and delegate partial control to plugin.
>>>
>> I have looked at your patchset. It going in the right direction I think.
> Thanks!
> But as time goes by it becomes harder to rebase... and the 2.4 branch
> is not created... so I don't know what is the future of this patchset.
> Although I invested a lot of time in it and it has huge potential of
> eliminating duplicate code from the code base. I think this is simple
> enough to be in 2.3, but we had this discussion already.
>
>> For "my platform" I would like to have/implement a persisent tun which
>> works as follows:
>>
>> - proivde tun configuration including routes and ifconfig
>> - open tun with the information
>> - keep tun open
>> - on reconect: compare new configuration with old configuration.
>>  - if nothing has changed keep the old tun
>>  - otherwise first open the new tun then close the old tun
> From the Android discussion I thought that the best will be to write a
> plugin "platform", delegate the ip configuration to the openvpn plugin
> interface.
>
> Then you can implement whatever logic you need, if I understand
> correctly, delegate ip management to the UI.
>
Yes. I wanted to outline what I want to able to do so the tun framework
can support what I am trying to do.

Arne



Re: [Openvpn-devel] [V2.4 0/4] tun cleanups

2012-06-18 Thread Alon Bar-Lev
On Mon, Jun 18, 2012 at 9:21 PM, Arne Schwabe  wrote:
> Am 12.05.12 21:31, schrieb Alon Bar-Lev:
>> Platform independent interface for tun provider.
>>
>> Split the long tun.c into platform specific files using
>> tun_engine interface.
>>
>> Functionality is the same.
>>
>> Maintenance will be much easier! new options, like stacking
>> several interfaces and delegate partial control to plugin.
>>
> I have looked at your patchset. It going in the right direction I think.

Thanks!
But as time goes by it becomes harder to rebase... and the 2.4 branch
is not created... so I don't know what is the future of this patchset.
Although I invested a lot of time in it and it has huge potential of
eliminating duplicate code from the code base. I think this is simple
enough to be in 2.3, but we had this discussion already.

> For "my platform" I would like to have/implement a persisent tun which
> works as follows:
>
> - proivde tun configuration including routes and ifconfig
> - open tun with the information
> - keep tun open
> - on reconect: compare new configuration with old configuration.
>  - if nothing has changed keep the old tun
>  - otherwise first open the new tun then close the old tun

>From the Android discussion I thought that the best will be to write a
plugin "platform", delegate the ip configuration to the openvpn plugin
interface.

Then you can implement whatever logic you need, if I understand
correctly, delegate ip management to the UI.

> If we redesign the tun interface I would like to support this as well.
> Having this interface would also make implementing platform specific
> redirect-gateway and so easier. Also the redirect variant used by
> Android (binding a socket to an interface) could be implemented as a
> alternative.

I think this should also be done in the plugin, using an inherited
unix domain socket to pass the fd.
I explain this more at the Android thread if I remember correctly.

Thanks!
Alon.



Re: [Openvpn-devel] [V2.4 0/4] tun cleanups

2012-06-18 Thread Arne Schwabe
Am 12.05.12 21:31, schrieb Alon Bar-Lev:
> Platform independent interface for tun provider.
>
> Split the long tun.c into platform specific files using
> tun_engine interface.
>
> Functionality is the same.
>
> Maintenance will be much easier! new options, like stacking
> several interfaces and delegate partial control to plugin.
>
I have looked at your patchset. It going in the right direction I think.

For "my platform" I would like to have/implement a persisent tun which
works as follows:

- proivde tun configuration including routes and ifconfig
- open tun with the information
- keep tun open
- on reconect: compare new configuration with old configuration.
  - if nothing has changed keep the old tun
  - otherwise first open the new tun then close the old tun

If we redesign the tun interface I would like to support this as well.
Having this interface would also make implementing platform specific
redirect-gateway and so easier. Also the redirect variant used by
Android (binding a socket to an interface) could be implemented as a
alternative.

Arne




[Openvpn-devel] [V2.4 0/4] tun cleanups

2012-05-12 Thread Alon Bar-Lev
Platform independent interface for tun provider.

Split the long tun.c into platform specific files using
tun_engine interface.

Functionality is the same.

Maintenance will be much easier! new options, like stacking
several interfaces and delegate partial control to plugin.

There is more to be done in order to clean up the code,
however this is a good starting point.

Some more minor cleanups.

Tested on Linux, FreeBSD, Windows.

Branch should be merge after syshead[1].
Most probably patch exceeds list limitation, review is available[2].

This is for 2.4, please review quickly this so won't need to rebase.

Special thanks to Eric Crist for his FreeBSD help.

[1] https://github.com/alonbl/openvpn/compare/build...syshead
[2] https://github.com/alonbl/openvpn/compare/syshead...tun

Alon Bar-Lev (4):
  cleanup: remove check_subnet_conflict
  cleanup: move warn_on_use_of_common_subnets to init.c
  cleanup: remove tun_adjust_frame_parameters
  cleanup: tun: tun_engine interface

 configure.ac |6 +
 src/openvpn/Makefile.am  |   12 +
 src/openvpn/error.c  |2 +-
 src/openvpn/forward.c|   28 +-
 src/openvpn/helper.c |2 +-
 src/openvpn/init.c   |   61 +-
 src/openvpn/multi.c  |2 +-
 src/openvpn/options.c|   20 +-
 src/openvpn/options.h|5 +-
 src/openvpn/route.c  |2 +-
 src/openvpn/sig.c|4 +-
 src/openvpn/syshead.h|   56 -
 src/openvpn/tun-engine-common-bsd.c  |  103 +
 src/openvpn/tun-engine-common-bsd.h  |   34 +
 src/openvpn/tun-engine-common.c  |  518 +++
 src/openvpn/tun-engine-common.h  |   85 +
 src/openvpn/tun-engine-darwin.c  |  226 ++
 src/openvpn/tun-engine-dragonfly.c   |  193 ++
 src/openvpn/tun-engine-freebsd.c |  229 ++
 src/openvpn/tun-engine-generic.c |   97 +
 src/openvpn/tun-engine-linux-options.h   |   37 +
 src/openvpn/tun-engine-linux.c   |  515 +++
 src/openvpn/tun-engine-netbsd.c  |  318 ++
 src/openvpn/tun-engine-openbsd.c |  259 ++
 src/openvpn/tun-engine-options.h |   37 +
 src/openvpn/tun-engine-solaris.c |  491 +++
 src/openvpn/tun-engine-windows-options.h |   92 +
 src/openvpn/tun-engine-windows-util.h|   83 +
 src/openvpn/tun-engine-windows.c | 2757 
 src/openvpn/tun-engine.h |   95 +
 src/openvpn/tun.c| 5053 ++
 src/openvpn/tun.h|  469 +---
 32 files changed, 6548 insertions(+), 5343 deletions(-)
 create mode 100644 src/openvpn/tun-engine-common-bsd.c
 create mode 100644 src/openvpn/tun-engine-common-bsd.h
 create mode 100644 src/openvpn/tun-engine-common.c
 create mode 100644 src/openvpn/tun-engine-common.h
 create mode 100644 src/openvpn/tun-engine-darwin.c
 create mode 100644 src/openvpn/tun-engine-dragonfly.c
 create mode 100644 src/openvpn/tun-engine-freebsd.c
 create mode 100644 src/openvpn/tun-engine-generic.c
 create mode 100644 src/openvpn/tun-engine-linux-options.h
 create mode 100644 src/openvpn/tun-engine-linux.c
 create mode 100644 src/openvpn/tun-engine-netbsd.c
 create mode 100644 src/openvpn/tun-engine-openbsd.c
 create mode 100644 src/openvpn/tun-engine-options.h
 create mode 100644 src/openvpn/tun-engine-solaris.c
 create mode 100644 src/openvpn/tun-engine-windows-options.h
 create mode 100644 src/openvpn/tun-engine-windows-util.h
 create mode 100644 src/openvpn/tun-engine-windows.c
 create mode 100644 src/openvpn/tun-engine.h

-- 
1.7.3.4