/net in Linux: project log

A Glendix project

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.

February 5, 2009 - Posted by | Glendix, Networking, Plan 9 from Bell Labs

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.