Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Error code : 87 #27

Closed
wants to merge 9 commits into from
Closed

Conversation

smallru8
Copy link

Win32API ReadFile WriteFile need OVERLAPPED parameter or remove FILE_FLAG_OVERLAPPED flag.
I have tested it in win10, and it can read and write tap device normally.

@rds13
Copy link

rds13 commented Feb 17, 2020

I don't expect visual code files to be usefull for this MR, aren't they ?

@tleguern
Copy link
Member

tleguern commented Feb 17, 2020

Hello @smallru8, can you remove the build32 and build64 folders? I don't think they are needed here and they take unnecessary space in the repository.

Files allowing libtuntap to be used in another language such as Java should be located in bindings/java just like we have folders for Python and C++.
It allows to enable or disable them selectively and not clutter the main library.

I pushed two commits (8fd6125 and 173ee44) implementing just this in branch BounceGateVPN-master so you can cherry-pick them.
You can also allow me to make change directly to your PR if it is more convenient.

I implemented a third commit (ac05686) modifying the target to output a new library named libtuntap4j which includes your JNI interface.

Fix memory leak
Change reading network packets by 512-bytes to ```tuntap_get_mtu``` return value
move jni interface  to bindings
-Test.java : Test tap device.
-Tuntap.java : libtuntap java interface
@smallru8
Copy link
Author

Hello @Aversiste , I'm sorry i forgot to delete build32 and build64 folders. I have deleted them.

I have also fixed and adjusted some problems.

Fix read and write functions may cause memory leak.
Change reading network packets by 512-bytes to tuntap_get_mtu return value.
Move com_github_smallru8_driver_tuntap_TunTap and converter to bindings.
Add libtuntap4J java interface source for user to call.

@tleguern
Copy link
Member

Excellent, thank you.

If it is possible I would like to add an automatic test to our CI pipeline using your Test.java, but I fail to execute it:

$ /usr/local/jdk-11/bin/java Test.java
Test.java:13: error: cannot find symbol
        TunTap tt = new TunTap();
        ^
  symbol:   class TunTap
  location: class Test
Test.java:13: error: cannot find symbol
        TunTap tt = new TunTap();
                        ^
  symbol:   class TunTap
  location: class Test
2 errors
error: compilation failed

My Java skills are pretty much non existent, so what is going wrong?

@smallru8 smallru8 closed this Apr 19, 2020
@tleguern
Copy link
Member

Why are you closing this PR ? It seemed good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants