Re: UDP/TCP bind of all the ports

Gendag wrote:
Tauno Voipio wrote:

If you please would explain what for you're preparing
the program, it would maybe be easier to point to the
proper direction.

For my degree thesis I work on an application called Virtual Distributed Ethernet (VDE) ( developed by my supervising professor; in particular I worked on a utility that come with VDE, called Sliprvde. VDE permits to create virtual ethernet LAN using software that implements switch and cable. This net can comunicate wit the real one using a tun/tap interface connected to the switch, but to create the tun/tap you need root privileges.
Slirpvde permits to connect the VDE lan with the real one without having root privileges; to do so, it use a full TCP/IP stack to read and menage the packet that come from the virtual LAN and use the unix sockets to "regenerate" the connection to the "real world". It works like a NAT router but works at UDP/TCP level.
My work was to rewrite Slirpvde to add IPv6 support to the program, to do so I used a stack developed by supervising professor, a ibrid version of LwIP that support both IPv4 and IPv6. In the first version I have integrated tightly the code of Slirpvde into the Stack.

Now I'm rewriting the application and I'm try to keep separeted the code of the Stack from the one of Slirpvde. The problem is that I'm trying to mengage the UDP connection. The stack has a libary similar to the socket library of linux (bind(), connect(), listen(), ...) but with this functions I cannot say "listen to all the ports and return me a socket when a new connection arrive", in the first version it was all simpler because I could change the code of the stack.
I tell to my supervising professor the problem and he suggest me to make some changes to the stack to resolve the problem, but the point is _how_ do this change and _what_ to change, I don't want make a naive change and so I'm searching a "official" solution, something that is used, for example, also in the linux kernel.

This is whay I've made the question :-)

You'll not get all the networking packets without root privileges.
If the kernel would allow it, it would be a serious security breach.
The same applies to inserting arbitrary packets into the network.

The tun/tap interface is by far the cleanest solution for
own packet processing - it is in fact just an adapter connector
to the internals of the networking stack as a link level interface
(tap) or network level interface (tun).

If the current SLIRP-based network runs with IPV4 addresses in
the way you'd like the whole thing to work, just adapt it to accept
IPV6 address handling as well.

I did not find any documentation on Sourceforge (maybe it's in the
sources). If the protocol stack is intended to access the real
Ethernet on the computer, you cannot do it without the root privileges.
For a purely virtual network, you do not need to listen to all traffic
coming to the computer, only to the port transporting the frames of
the virtual network.


Tauno Voipio
tauno voipio (at) iki fi