Page 1 of 1
A good sample of porting FreeBSD protocol stack
Posted: Wed Oct 21, 2009 7:40 am
by higepon
Hi folks.
We have a plan to port FreeBSD protocol stack to out operating system Mona (
http://www.monaos.org).
Although we have already ported uIP protocol stack, it is not enough, uIP is not BSD socket.
We are looking for a good sample of porting the stack.
We found ReactOS uses OSkitcp which is based on the stack.
But "ReactOS-0.3.10/lib/drivers/oskittcp/notes.txt" says it didn't work well.
If you know a good sample, please let us know.
Thank you.
---
Taro Minowa(Higepon)
http://www.monaos.org/
http://code.google.com/p/mosh-scheme/
Re: A good sample of porting FreeBSD protocol stack
Posted: Wed Oct 21, 2009 9:14 am
by Brynet-Inc
QNX uses a lot of BSD code, including the network stack.. their latest release also seems to include an older version of OpenBSD's pf (..packet filter/firewall), likely the same ancient code that's in FreeBSD.
I'm not sure of any hobby projects that have ported it, it is rather dependent on the BSD kernel.. and you will most likely end up with something that is full of kludges.
But good luck, you might be able to pull it off.
Re: A good sample of porting FreeBSD protocol stack
Posted: Wed Oct 21, 2009 10:33 am
by fronty
Why do you need an example? Just grab the source and write the functions the stack uses to interact with other parts of system, possibly as a wrapper for native functions.
Re: A good sample of porting FreeBSD protocol stack
Posted: Thu Oct 22, 2009 2:51 am
by higepon
Brynet-Inc wrote:
> QNX uses a lot of BSD code, including the network stack.. their latest release also seems to include an older version of OpenBSD's pf (..packet filter/firewall), likely the same ancient code that's in FreeBSD.
Thank you. I will check QNX.
> you will most likely end up with something that is full of kludges.
That is the reason why I'm looking for good samples
fronty wrote:
> Why do you need an example?
Good point.
A good example tells us a lot, when we get a trouble.
(1) What wrapper/stub functions do we need to implment? and how do they work?
(2) Using a debugger, we can know expected values on some variables related to the trouble.
Cheers.
Re: A good sample of porting FreeBSD protocol stack
Posted: Thu Oct 22, 2009 6:27 am
by fronty
Quick and not-very-good way for finding functions you need to implement is to just add the stack to your kernel and try to compile. You will get frigging many errors about missing functions. Better way is to read the source code and find out how it interacts with other parts of system and which of them aren't available currently in your kernel. Then just get hacking. If you don't know what some function does, check FreeBSD's source.
Re: A good sample of porting FreeBSD protocol stack
Posted: Thu Oct 22, 2009 4:38 pm
by pcmattman
it is not enough, uIP is not BSD socket.
Hmm, I'm not certain (so by all means prove me wrong), but wouldn't the BSD protocol stack be separate from the BSD sockets interface? My understanding is that sockets are built on top of the stack - so no matter what stack you port, whether it be the BSD stack or uIP, you're not going to get free sockets.
Re: A good sample of porting FreeBSD protocol stack
Posted: Thu Oct 22, 2009 4:59 pm
by Brynet-Inc
The person before me makes a point, most TCP/IP implementations use the BSD socket interface without actually copying the original BSD kernel code.
I don't really understand why you used uIP, it looks like it was intended for embedded devices.. often with no concept of a userland.
lwIP might be slightly more appropriate:
http://savannah.nongnu.org/projects/lwip/
Re: A good sample of porting FreeBSD protocol stack
Posted: Sat Oct 24, 2009 2:42 am
by higepon
Thank you for your advice!