kohler / click

The Click modular router: fast modular packet processing and analysis
Other
747 stars 321 forks source link

How to log NAT state on ClickOS #226

Open doantungbk opened 8 years ago

doantungbk commented 8 years ago

Hi Click team,

Currently, I am focusing on NAT state migration between two virtual machines. I work with MazuNAT on Click. I have some questions and really hope your help. The problem is How I can see what is really happening when a flow accesses on translation table. I mean if I can capture or get some information related packet processing such as which shared variables (in multicore processor) are processing a packet and how I can know where translation table is stored. Actually, I tried to capture actions from IPRewriter function but may be it is not solution.

Could anyone have any suggestion in this case? Thank in advance!

ahenning commented 8 years ago

NAT state information should be available in the IPRewriter and TCPRewriter read handlers? read rw.tcp_mappings read rw_tcp.mappings

If those handlers are not sufficient, extend them for your needs.

To add simple 'debug' logging capability to the elements use click_chatter

bcronje commented 8 years ago

Some common tools to help with logging and debugging.

Elements: Print, IPPrint, ToDump, FromDump Also as Antonie mentioned, look at each elements read handlers, most elements contain handlers to view internal state at runtime.

In code: click_chatter Attach a debugger and step through userlevel Click. This way you can step through the entire packet processing chain.

clifffrey commented 8 years ago

You should be able to get click_chatter to work from linuxmodule (specifically, it should turn into a call to printk) However, I don't know what it is you are trying to log. It might make more sense to extend the existing "mappings" handlers to include the information that you want, or you could add a new handler that specifically listed a log of the entries that you were interested in.

On Mon, Dec 21, 2015 at 10:33 PM, doantungbk notifications@github.com wrote:

Thank you for your useful respone, Ahenning and Bcronje! I also knew some files such as rw.tcp_mappings and rw.udp_mappings in the IPRewriter and TCPRewriter read handlers. But actually as you said, I need to get more information.

I used click_chatter but may be click_chatter only works well in user mode. while I am working with NAT in kernel mode and I want to get information from IPRewriter. So, does it have any way to replace click_chatter? Or I need to change to work with NAT in user mode, right?

Thank in advance!

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/226#issuecomment-166529730.

doantungbk commented 8 years ago

Hi Ahhenning, BeyersCronje and Cliff Frey,

I am sorry for bothering you! Simply, I just want to log how NAT translation table is stored in memory and what is really happening when a flow accesses on translation table. I also used click_chatter in linux module. But until now, I have not found yet what variable is managing NAT table which I can use click_chatter to get. Similarly, it is not clear to me what variable is managing flows when accessing translation table. Off course, if I know both of them, all things I need are resolved. :D

Thank you for your help! I wish you merry christmas and happy new year!

2015-12-24 4:09 GMT+09:00 Cliff Frey notifications@github.com:

You should be able to get click_chatter to work from linuxmodule (specifically, it should turn into a call to printk) However, I don't know what it is you are trying to log. It might make more sense to extend the existing "mappings" handlers to include the information that you want, or you could add a new handler that specifically listed a log of the entries that you were interested in.

On Mon, Dec 21, 2015 at 10:33 PM, doantungbk notifications@github.com wrote:

Thank you for your useful respone, Ahenning and Bcronje! I also knew some files such as rw.tcp_mappings and rw.udp_mappings in the IPRewriter and TCPRewriter read handlers. But actually as you said, I need to get more information.

I used click_chatter but may be click_chatter only works well in user mode. while I am working with NAT in kernel mode and I want to get information from IPRewriter. So, does it have any way to replace click_chatter? Or I need to change to work with NAT in user mode, right?

Thank in advance!

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/226#issuecomment-166529730.

— Reply to this email directly or view it on GitHub https://github.com/kohler/click/issues/226#issuecomment-166972863.

Name: Doan Van Tung (두 안 반 퉁) Phone number: 010-6463-9576 Email: tungdoan@dcn.ssu.ac.kr Information and Telecommunication Soongsil University, Seoul, Korea