Change in openvpn[master]: dco-win: add SET_MODE ioctl call
A message that is not in the archive (sent off-list or not yet received): gerrit.1725622029000.Ifec08fea26ff6fd9e22f18cab0ac71c1dda8fe8e@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/734?usp=email
to review the following change.
Change subject: dco-win: add SET_MODE ioctl call
......................................................................
dco-win: add SET_MODE ioctl call
This is used to set client (OVPN_MODE_P2P, default)
or server (OVPN_MODE_MP) mode. Requires dco driver version >= 2.
---
M src/openvpn/dco_win.c
M src/openvpn/ovpn_dco_win.h
2 files changed, 56 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/34/734/1
src/openvpn/dco_win.c +46 -2
@@ -93,15 +93,59 @@return (version->Major >1 ) || (version->Minor >=4 ); } +static inline +bool +dco_version_supports_mp (OVPN_VERSION *version) +{ +return version->Major >=2 ; +} + +bool +dco_set_mode (dco_context_t *dco,int mode) +{ +msg (D_DCO_DEBUG ,"%s: mode %d" , __func__, mode); + +OVPN_MODE ovpn_mode; +switch (mode) + { +case CM_TOP : + ovpn_mode =OVPN_MODE_MP ; +break ; + +case CM_P2P : + ovpn_mode =OVPN_MODE_P2P ; +break ; + +default : +ASSERT (false); + } + +DWORD bytes_returned =0 ; +if (!DeviceIoControl (dco->tt->hand,OVPN_IOCTL_SET_MODE , &ovpn_mode, +sizeof (ovpn_mode),NULL ,0 , &bytes_returned,NULL )) + { +msg (M_WARN |M_ERRNO ,"DeviceIoControl(OVPN_IOCTL_SET_MODE) failed" ); +return -1 ; + } +return 0 ; +} +bool ovpn_dco_init (int mode,dco_context_t *dco) { +int res = true; +dco_get_version (&dco->version); + dco->supports_data_v3 =dco_version_supports_data_v3 (&dco->version); +if (dco_version_supports_mp (&dco->version)) + { + res =dco_set_mode (dco, mode); + } -msg (D_DCO_DEBUG ,"dco data_v3: %d" , dco->supports_data_v3); +msg (D_DCO_DEBUG ,"dco mode: %d, data_v3: %d" , mode, dco->supports_data_v3); -return true; +return res; }int
src/openvpn/ovpn_dco_win.h +10 -0
@@ -114,6 +114,15 @@LONG Patch; }OVPN_VERSION , *POVPN_VERSION ; +typedef enum { +OVPN_MODE_P2P , +OVPN_MODE_MP +}OVPN_MODE ; + +typedef struct _OVPN_SET_MODE { +OVPN_MODE Mode; +}OVPN_SET_MODE , *POVPN_SET_MODE ; +#define OVPN_IOCTL_NEW_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_GET_STATS CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_NEW_KEY CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
@@ -123,3 +132,4 @@#define OVPN_IOCTL_DEL_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_NEW_KEY_V2 CTL_CODE(FILE_DEVICE_UNKNOWN, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define OVPN_IOCTL_SET_MODE CTL_CODE(FILE_DEVICE_UNKNOWN, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/734?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifec08fea26ff6fd9e22f18cab0ac71c1dda8fe8e
Gerrit-Change-Number: 734
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/734?usp=email
to look at the new patch set (#2).
Change subject: dco-win: add SET_MODE ioctl call
......................................................................
dco-win: add SET_MODE ioctl call
This is used to set client (OVPN_MODE_P2P, default)
or server (OVPN_MODE_MP) mode. Requires dco driver version >= 2.
---
M src/openvpn/dco_win.c
M src/openvpn/ovpn_dco_win.h
2 files changed, 57 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/34/734/2
src/openvpn/dco_win.c +47 -2
@@ -110,15 +110,60 @@return (version->Major >1 ) || (version->Minor >=4 ); } +static inline +bool +dco_version_supports_mp (OVPN_VERSION *version) +{ +return version->Major >=2 ; +} + +bool +dco_set_mode (dco_context_t *dco,int mode) +{ +msg (D_DCO_DEBUG ,"%s: mode %d" , __func__, mode); + +OVPN_MODE ovpn_mode; +switch (mode) + { +case CM_TOP : + ovpn_mode =OVPN_MODE_MP ; +break ; + +case CM_P2P : + ovpn_mode =OVPN_MODE_P2P ; +break ; + +default : +ASSERT (false); + } + +DWORD bytes_returned =0 ; +if (!DeviceIoControl (dco->tt->hand,OVPN_IOCTL_SET_MODE , &ovpn_mode, +sizeof (ovpn_mode),NULL ,0 , &bytes_returned,NULL )) + { +msg (M_WARN |M_ERRNO ,"DeviceIoControl(OVPN_IOCTL_SET_MODE) failed" ); +return -1 ; + } +return 0 ; +} +bool ovpn_dco_init (int mode,dco_context_t *dco) { +int res = true; + (void )dco_get_version (&dco->version); + dco->supports_data_v3 =dco_version_supports_data_v3 (&dco->version); +bool mp =dco_version_supports_mp (&dco->version); +if (mp) + { + res =dco_set_mode (dco, mode); + } -msg (D_DCO_DEBUG ,"dco supports data_v3: %d" , dco->supports_data_v3); +msg (D_DCO_DEBUG ,"dco supports multipeer: %d, data_v3: %d" , mp, dco->supports_data_v3); -return true; +return res; }int
src/openvpn/ovpn_dco_win.h +10 -0
@@ -114,6 +114,15 @@LONG Patch; }OVPN_VERSION , *POVPN_VERSION ; +typedef enum { +OVPN_MODE_P2P , +OVPN_MODE_MP +}OVPN_MODE ; + +typedef struct _OVPN_SET_MODE { +OVPN_MODE Mode; +}OVPN_SET_MODE , *POVPN_SET_MODE ; +#define OVPN_IOCTL_NEW_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_GET_STATS CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_NEW_KEY CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
@@ -123,3 +132,4 @@#define OVPN_IOCTL_DEL_PEER CTL_CODE(FILE_DEVICE_UNKNOWN, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)#define OVPN_IOCTL_NEW_KEY_V2 CTL_CODE(FILE_DEVICE_UNKNOWN, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define OVPN_IOCTL_SET_MODE CTL_CODE(FILE_DEVICE_UNKNOWN, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/734?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifec08fea26ff6fd9e22f18cab0ac71c1dda8fe8e
Gerrit-Change-Number: 734
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
stipa has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/734?usp=email )
Change subject: dco-win: add SET_MODE ioctl call
......................................................................
Abandoned
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/734?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ifec08fea26ff6fd9e22f18cab0ac71c1dda8fe8e
Gerrit-Change-Number: 734
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon