Plan 9カーネルにおけるTCP/IP実装(未完)
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 2,453 views

 

Statistics

Views

Total Views
2,453
Views on SlideShare
2,453
Embed Views
0

Actions

Likes
1
Downloads
7
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

  • Plan 9 TCP/IP oraccha Plan9 http://d.hatena.ne.jp/oraccha/ 2010 3 31
  • /net • net ether0 tcp udp cs dns 0 1 clone stats ctl data err listen local remote status
  • • • NW /net bind % ns : bind -a '#l' /net /net/ether bind -a '#I' /net IP /net/ipifc,arp,icmp,udp,tcp,...
  • 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
  • Queue Block • struct Queue: • • Block • struct Block: • BSD mbuf Linux sk_buff • Block 64KB
  • 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[]
  • 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 */ };
  • • namec ipattach • Fs ipprotoinit[] e.g. tcpinit Fs *ipfs[Nfs] Fs Proto dev dev “tcp” *p[] IP_TCPPROTO IP_TCPPROTO *t2p[] *f ipprotoinit[]
  • 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); }
  • 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 ※
  • update: • Tcpctl: TCP TCB • • cwnd: • window: • Limbo: listener
  • • TCP • Reno Tahoe • • Window scaling option
  • • tcpackproc #I0tcpack • 50 expire • • tcb->timer: tcptimeout • tcb->acktimer: tcpacktimer • tcb->katimer: tcpkeepalive • tcb->rtt_timer: RTT
  • • • /net/tcp/*/state • IPv4 IPv4-mapped IPv6
  • qid • • UNIX inode