Network internals of Plan 9
Week 2:-
Most of this week’s work was to understand how network works in Plan 9 ( See here ).
There is a /net/cs file which is basically the Connection Server. This file does DNS translation. When we write “net!www.google.com!http”, we get back – “/net/tcp/clone 74.125.67.100!80″.
There are many other files and folders inside the /net directory. The /net in my virtual machine looks like this:
> term% ls /net
/net/arp
/net/bootp
/net/cs
/net/dns
/net/ether0
/net/icmp
/net/icmpv6
/net/ipifc
/net/iproute
/net/ipselftab
/net/log
/net/ndb
/net/tcp
/net/udp
After getting back the IP address of the server we are trying to connect to, we need to pass the command “connect 74.125.67.100!80″ command to /net/tcp/clone file. Doing this will return a folder under /net, say /net/ether0/6 .
NOTE:- The above drill of writing to /net/cs and subsequently writing to the clone file has to be done using the “dial” function in C programs, or using the program ndb/csquery, because per-processes namespaces in Plan 9 will otherwise result in returning nothing to a new process started by a shell command like “cat”.
Inside that numbered connection folder under the interface, there are files named data and ctrl among others. When we write to that data file, we send the text to the server, and reading from it will return information received from the otehr end.
Anant and I believe that starting at /net/cs is a good approach. There is a function gethostbyname() in Linux, which is used for DNS. It must be latching on to the Linux kernel DNS module. I must instead do the same using /net/cs .
But step 1, create /net/cs to return the same data that we give it, without resolving anything.
No comments yet.
Leave a Reply
-
Recent
- A test script to fetch over HTTP on command-line
- Where to hook onto the tcp stack?
- Basic framework ready!
- “fsnet_create” a good plan?
- Glendix on Routers?
- DNS: A hard to crack nut!
- My first /net code commited!
- Learning to write a Systhetic Filesystem on Linux
- Discussion on 9Fans
- Plan 9 Cheat Sheet
- Network internals of Plan 9
- Initial reading and analysis
-
Links
-
Archives
- April 2009 (3)
- March 2009 (3)
- February 2009 (5)
- January 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS