[Ns-developers] gsoc summary reports[quagga-porting]

Liu Jian liujatp at gmail.com
Mon Aug 18 07:02:54 PDT 2008


hi all,

my Gsoc project is porting quagga routes to ns-3 and summarize some
experience about how to integrate real world application with ns-3. 
During this three months of period, i learnd a lot, increase my code read
/write experience. (more details about my project process at:
http://www.nsnam.org/wiki/index.php/Real_World_Application_Integration )

1, netlink sockets implementation
Before step into porting, netlink socket was needed, since quagga rely
on it. my repo at http://code.nsnam.org/lj/ns-3-netlink.
netlink files at src/node/netlink-xxx.h/cc.

NetlinkSocket is subclass of Socket, and has the similar strcture and implementation. 
files:netlink-socket-address.h/cc, netlink-socket-factory.h/cc,
netlink-socket-helper.h/cc, netlink-socket.h/cc;

The 2 main points of the NetlinkSocket implementation were   
a)netlink message serilize and desirilize
b)netlink message handling.

For a): NetlinkMessage body has different payload due to different message type,
when do this, learn some experience from Header class, adopt simliar interface
functions to implement. 
files:netlink-message.h/cc,netlink-message-route.h/cc 

For b): To simulate how the linux kernel handle the netlink messages, I learn
from linux kernel code and just simply implement the part of the netlink 
mechanism. how the linux do is: user socket send an request to kernel, 
the kernel netlink socket recv it and handle it, then send ack back to 
user-space socket. where in my NetlinkSocket, there was no kernel socket 
exist, when user NetlinkSocket call send() to transfer an message, NetlinkSocket
::HandleMessage do it directly as kernel, then send the ack/response message
back to its own recv-queue, and it can be got when recv() called. 
files:netlink-socket.h/cc.

Netlink was big and complicated, here i just implemented what the quagga used.
Focusing on netlink route protocol: interface address dump/add/del, route entry 
dump/add/del/get, link dump. To show how the netlink message be built in ns-3, 
and to test the socket running, testing codes is at netlink-socket-test.cc.

2,porting(repo at http://code.nsnam.org/lj/quagga-porting.)
the porting is based on ns-3-simu, using the process model. There are two way which 
i do the porting. Before the elfloader, the simu_xxx funtion mapping method is what
i use to port libnl/quagga. at that time, libnl run successfully on ns-3-simu. 
when i was focusing porting zebra, mathieu implement the elfloader, which is genius.
it make porting much easier, just compile real-world program with -fpie, -pie option
and fill the actually function simu_xxx. now i have run libnl successfully on ns-test/
quagga-porting. In the next few days,i will try to run quagga. 

>From the porting process, i tested the netlink socket with the realworld application, 
and studied some skills from the great code. For code wrriting. i just wrote a few 
code:some simu_xx function and definition for porting.
my test at ns-test:/lj/quagga-porting, it run as:
 ./waf --shell;
./build/debug/example/process-libnl nl-addr-dump xml

Before merge the NetlinkSocket, code review/clean is needed, which will also be done
next days. i wish my code will be some useful to ns-3. 

>From this gsoc exprience, i rally learned a lot about code writing and technique, which 
will be my great fortune in the future. At the end of the Gsoc project, i want to thank
ns-3 community give me the chance to do the project, and i would appreciate mathieu for 
helping me a lot and fixing me many problem and explaining me many boring questions. 
Also i will thanks tomh,gjc,joe,fw,etc. they all gave me many good suggestions when 
i met difficulty. 





Liu Jian
2008-08-18


More information about the Ns-developers mailing list