Plan 9
  TCP/IP

              oraccha
  Plan9   http://d.hatena.ne.jp/oraccha/

           2010    3   31
/net
     •
                             net


     ether0        tcp       udp       cs   dns


         0     1         ...
•
•   NW        /net                          bind

% ns

       :

bind -a '#l' /net                         /net/ether

...
write(2)            read(2)

  ip/devip.c              ipwrite             ipread


                   wq                 ...
Queue              Block
•   struct Queue:

    •
    •   Block

•   struct Block:

    •   BSD     mbuf Linux sk_buff

  ...
write (port/sysfile.c)
 •      fdtochan       fd         Chan *c

 •      devtab[c->type]->write

Proc         Fgrp     Ch...
Dev ipdevtab = {
	 'I',           /* dc */
	 "ip",          /* name */

	    ipreset,       /*   reset */
	    devinit,   ...
•    namec                 ipattach

•    Fs                     ipprotoinit[]
         e.g. tcpinit
    Fs *ipfs[Nfs]    ...
void tcpinit(Fs *fs) {
	 Proto *tcp;
	 Tcppriv *tpriv;
	 tcp = smalloc(sizeof(Proto));
	 tpriv = tcp->priv = smalloc(sizeo...
Closed

     passive open           appl: listen()
                                                          appl: connect...
update:
  •   Tcpctl: TCP       TCB

      •
          •   cwnd:

          •   window:

  •   Limbo: listener
•   TCP

•   Reno             Tahoe

    •
•   Window scaling option
•   tcpackproc #I0tcpack

    •   50
        expire

•
    •   tcb->timer: tcptimeout
    •   tcb->acktimer: tcpacktimer
 ...
•
    •   /net/tcp/*/state

•   IPv4              IPv4-mapped IPv6
qid


•
•   UNIX inode
Upcoming SlideShare
Loading in...5
×

Plan 9カーネルにおけるTCP/IP実装(未完)

1,881

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,881
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Plan 9カーネルにおけるTCP/IP実装(未完)

  1. 1. Plan 9 TCP/IP oraccha Plan9 http://d.hatena.ne.jp/oraccha/ 2010 3 31
  2. 2. /net • net ether0 tcp udp cs dns 0 1 clone stats ctl data err listen local remote status
  3. 3. • • NW /net bind % ns : bind -a '#l' /net /net/ether bind -a '#I' /net IP /net/ipifc,arp,icmp,udp,tcp,...
  4. 4. write(2) read(2) ip/devip.c ipwrite ipread wq rq tcpkick ip/tcp.c tcpiput tcpoutput ip/ip.c ipoput4 ipiput4 ip/ethermedium.c etherbwrite etherread4 etherbwrite pc/devether.c etheroq in oq etheriq pc/etherxxxx.c transmit interrupt
  5. 5. Queue Block • struct Queue: • • Block • struct Block: • BSD mbuf Linux sk_buff • Block 64KB
  6. 6. write (port/sysfile.c) • fdtochan fd Chan *c • devtab[c->type]->write Proc Fgrp Chan Dev devtab[] ‘l’ “IP” *fgrp **fd type &etherdevtab &ipdevtab (*write)() devtab[]
  7. 7. Dev ipdevtab = { 'I', /* dc */ "ip", /* name */ ipreset, /* reset */ devinit, /* init [Do nothing] */ devshutdown, /* shutdown [Do nothing] */ ipattach, /* attach */ ipwalk, /* walk */ ipstat, /* stat */ ipopen, /* open */ ipcreate, /* create [Eperm] */ ipclose, /* close */ ipread, /* read */ ipbread, /* block read */ ipwrite, /* write */ ipbwrite, /* block write */ ipremove, /* remove [Eperm] */ ipwstat, /* wstat */ };
  8. 8. • namec ipattach • Fs ipprotoinit[] e.g. tcpinit Fs *ipfs[Nfs] Fs Proto dev dev “tcp” *p[] IP_TCPPROTO IP_TCPPROTO *t2p[] *f ipprotoinit[]
  9. 9. void tcpinit(Fs *fs) { Proto *tcp; Tcppriv *tpriv; tcp = smalloc(sizeof(Proto)); tpriv = tcp->priv = smalloc(sizeof(Tcppriv)); tcp->name = "tcp"; tcp->connect = tcpconnect; tcp->announce = tcpannounce; tcp->ctl = tcpctl; tcp->state = tcpstate; tcp->create = tcpcreate; tcp->close = tcpclose; tcp->rcv = tcpiput; tcp->advise = tcpadvise; tcp->stats = tcpstats; tcp->inuse = tcpinuse; tcp->gc = tcpgc; tcp->ipproto = IP_TCPPROTO; tcp->nc = scalednconv(); tcp->ptclsize = sizeof(Tcpctl); tpriv->stats[MaxConn] = tcp->nc; Fsproto(fs, tcp); }
  10. 10. Closed passive open appl: listen() appl: connect() send: SYN recv: SYN send: SYN, ACK Listen active open recv: SYN Syn_received Syn_sent send: SYN, ACK recv: ACK recv: SYN, ACK Established send: ACK active close recv: FIN Close_wait send: ACK recv: FIN appl: close() Finwait1 send: ACK Closing passive close send: FIN recv: FIN, ACK recv: ACK recv: ACK Last_ack send: ACK 2MSL timeout recv: ACK recv: FIN Finwait2 Time_wait send: ACK ※
  11. 11. update: • Tcpctl: TCP TCB • • cwnd: • window: • Limbo: listener
  12. 12. • TCP • Reno Tahoe • • Window scaling option
  13. 13. • tcpackproc #I0tcpack • 50 expire • • tcb->timer: tcptimeout • tcb->acktimer: tcpacktimer • tcb->katimer: tcpkeepalive • tcb->rtt_timer: RTT
  14. 14. • • /net/tcp/*/state • IPv4 IPv4-mapped IPv6
  15. 15. qid • • UNIX inode
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×