A good sample of porting FreeBSD protocol stack

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
higepon
Posts: 4
Joined: Mon Jul 02, 2007 11:20 pm

A good sample of porting FreeBSD protocol stack

Post 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/
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: A good sample of porting FreeBSD protocol stack

Post 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.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
fronty
Member
Member
Posts: 188
Joined: Mon Jan 14, 2008 5:53 am
Location: Helsinki

Re: A good sample of porting FreeBSD protocol stack

Post 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.
higepon
Posts: 4
Joined: Mon Jul 02, 2007 11:20 pm

Re: A good sample of porting FreeBSD protocol stack

Post 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 :D


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.
fronty
Member
Member
Posts: 188
Joined: Mon Jan 14, 2008 5:53 am
Location: Helsinki

Re: A good sample of porting FreeBSD protocol stack

Post 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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: A good sample of porting FreeBSD protocol stack

Post 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.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: A good sample of porting FreeBSD protocol stack

Post 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/
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
higepon
Posts: 4
Joined: Mon Jul 02, 2007 11:20 pm

Re: A good sample of porting FreeBSD protocol stack

Post by higepon »

Thank you for your advice!
Post Reply