Giter VIP home page Giter VIP logo

Comments (13)

wongsyrone avatar wongsyrone commented on September 27, 2024

I will do this myself

from badvpn.

ambrop72 avatar ambrop72 commented on September 27, 2024

Sorry I don't maintain this code regularly anymore. Note that the vanilla lwip is probably not okay, tun2socks needs changes to support binding to all addresses and all ports, in my adaptation that is tcp_bind_to_netif(). Probably the fork by VirtualBox has equivalent changes but I don't know how up to date it is.

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

Thanks for the information. I found the diff based on lwip-base-version file: https://gist.github.com/wongsyrone/2a2c134e8f927364e598d2a6e706f4a8

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

Hi, I modified twip latest git HEAD to make it work on tun2socks.

Here goes the commits:

simple copy and paste and updated lwip-base-version to give clear instruction which point we are located
wongsyrone@0c08474

update custom folder and drop outdated defs
wongsyrone@2422fc5

the most important changes to lwip to let us be able to bind to all addresses and all ports
wongsyrone@8a77977

finally, update tun2socks source code to make it working, please ignore some out-of-tree android changes
wongsyrone@3d2e394

another boring change to keep updated, especially for ip addr macro change, since we only need raw api
wongsyrone@3ce4233

Other files are not modified, twip sources list can be obtained via newly added src/Filelists.mk

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

There is a new opt called LWIP_SINGLE_NETIF, we can define this to reduce code footprint further.

tun2socks only use one netif named "ho0"; this option might be designed for tun2socks. :)

from badvpn.

ambrop72 avatar ambrop72 commented on September 27, 2024

I tried to incorporate these changes but upon testing with Valgrind I'm seeing what might be memory leaks (TCP PCBs seems to be leaking, Valgrind claims "definitely lost"). I will investigate and push once that is resolved.

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

TCP PCBs seems to be leaking

might in tcp_in.c, but not sure

from badvpn.

ambrop72 avatar ambrop72 commented on September 27, 2024

I analyzed this further and there is indeed a real leak. I filed a but report at lwIP: https://savannah.nongnu.org/bugs/index.php?52112

Technically it seems possible to work around it by avoiding calling tcp_close from lwIP callbacks but I hope it is fixed soon so I won't have to do that.

from badvpn.

ambrop72 avatar ambrop72 commented on September 27, 2024

By the way, I am currently developing my own TCP/IP stack and at some point I will just replace lwIP with that for tun2socks - hopefully that will be the end of having to deal with lwIP bugs and updates.

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

it seems that leaking issue doesn't exist. Developing your own won't be a good idea, there is fewer people working on bugs and security flaws.

from badvpn.

ambrop72 avatar ambrop72 commented on September 27, 2024

The leak definitely exists in the code you have, if you don't see it you have not tested enough. I found out it was caused by tun2socks code too often returning ERR_ABRT from callbacks. This was a workaround for an old lwIP bug which has since been fixed and the workaround was now causing the leak. I have fixed the issue and pushed the updated code to this repository. You probably want to sync at least the tun2socks.c changes.

Developing your own won't be a good idea, there is fewer people working on bugs and security flaws.

My thing (which is already very functional) likely has orders of magnitude less bugs than lwIP, so I'll just keep working on it :) It doesn't yet have the "bind to all" function that is needed for tun2socks but that can be added easily.

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

Well. I'm not able to write my own TCP/IP stack. As long as you keep maintaining this, there is no issue at all, but one day you stop supporting, only you can understand the whole thing.

from badvpn.

wongsyrone avatar wongsyrone commented on September 27, 2024

This was a workaround for an old lwIP bug

I have little knowledge on tun2socks, I even don't know it was a workaround. My intention is just to make it work not bug-free since you said "Sorry I don't maintain this code regularly anymore."

I think it worth noting about the mechanism tun2socks uses, such as binding to all addresses and ports, etc. In this way, others can keep going if one day you decide to drop it. It is just a suggestion.

from badvpn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.