ip.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. typedef struct Conv Conv;
  2. typedef struct Fs Fs;
  3. typedef union Hwaddr Hwaddr;
  4. typedef struct IP IP;
  5. typedef struct IPaux IPaux;
  6. typedef struct Ipself Ipself;
  7. typedef struct Ipselftab Ipselftab;
  8. typedef struct Iplink Iplink;
  9. typedef struct Iplifc Iplifc;
  10. typedef struct Ipmulti Ipmulti;
  11. typedef struct Ipifc Ipifc;
  12. typedef struct Iphash Iphash;
  13. typedef struct Ipht Ipht;
  14. typedef struct Netlog Netlog;
  15. typedef struct Medium Medium;
  16. typedef struct Proto Proto;
  17. typedef struct Arpent Arpent;
  18. typedef struct Arp Arp;
  19. typedef struct Route Route;
  20. typedef struct Routerparams Routerparams;
  21. typedef struct Hostparams Hostparams;
  22. typedef struct v6router v6router;
  23. typedef struct v6params v6params;
  24. #pragma incomplete Arp
  25. #pragma incomplete Ipself
  26. #pragma incomplete Ipselftab
  27. #pragma incomplete IP
  28. #pragma incomplete Netlog
  29. enum
  30. {
  31. Addrlen= 64,
  32. Maxproto= 20,
  33. Nhash= 64,
  34. Maxincall= 5,
  35. Nchans= 1024,
  36. MAClen= 16, /* longest mac address */
  37. MAXTTL= 255,
  38. DFLTTOS= 0,
  39. IPaddrlen= 16,
  40. IPv4addrlen= 4,
  41. IPv4off= 12,
  42. IPllen= 4,
  43. /* ip versions */
  44. V4= 4,
  45. V6= 6,
  46. IP_VER4= 0x40,
  47. IP_VER6= 0x60,
  48. IP_HLEN4= 5, /* v4: Header length in words */
  49. IP_DF= 0x4000, /* v4: Don't fragment */
  50. IP_MF= 0x2000, /* v4: More fragments */
  51. IP4HDR= 20, /* sizeof(Ip4hdr) */
  52. IP_MAX= 64*1024, /* Max. Internet packet size, v4 & v6 */
  53. /* 2^Lroot trees in the root table */
  54. Lroot= 10,
  55. Maxpath = 64,
  56. };
  57. enum
  58. {
  59. Idle= 0,
  60. Announcing= 1,
  61. Announced= 2,
  62. Connecting= 3,
  63. Connected= 4,
  64. };
  65. /* on the wire packet header */
  66. typedef struct Ip4hdr Ip4hdr;
  67. struct Ip4hdr
  68. {
  69. uchar vihl; /* Version and header length */
  70. uchar tos; /* Type of service */
  71. uchar length[2]; /* packet length */
  72. uchar id[2]; /* ip->identification */
  73. uchar frag[2]; /* Fragment information */
  74. uchar ttl; /* Time to live */
  75. uchar proto; /* Protocol */
  76. uchar cksum[2]; /* Header checksum */
  77. uchar src[4]; /* IP source */
  78. uchar dst[4]; /* IP destination */
  79. };
  80. /*
  81. * one per conversation directory
  82. */
  83. struct Conv
  84. {
  85. QLock;
  86. int x; /* conversation index */
  87. Proto* p;
  88. int restricted; /* remote port is restricted */
  89. uint ttl; /* max time to live */
  90. uint tos; /* type of service */
  91. int ignoreadvice; /* don't terminate connection on icmp errors */
  92. uchar ipversion;
  93. uchar laddr[IPaddrlen]; /* local IP address */
  94. uchar raddr[IPaddrlen]; /* remote IP address */
  95. ushort lport; /* local port number */
  96. ushort rport; /* remote port number */
  97. char *owner; /* protections */
  98. int perm;
  99. int inuse; /* opens of listen/data/ctl */
  100. int length;
  101. int state;
  102. /* udp specific */
  103. int headers; /* data src/dst headers in udp */
  104. int reliable; /* true if reliable udp */
  105. Conv* incall; /* calls waiting to be listened for */
  106. Conv* next;
  107. Queue* rq; /* queued data waiting to be read */
  108. Queue* wq; /* queued data waiting to be written */
  109. Queue* eq; /* returned error packets */
  110. Queue* sq; /* snooping queue */
  111. Ref snoopers; /* number of processes with snoop open */
  112. QLock car;
  113. Rendez cr;
  114. char cerr[ERRMAX];
  115. QLock listenq;
  116. Rendez listenr;
  117. Ipmulti *multi; /* multicast bindings for this interface */
  118. void* ptcl; /* protocol specific stuff */
  119. Route *r; /* last route used */
  120. ulong rgen; /* routetable generation for *r */
  121. };
  122. struct Medium
  123. {
  124. char *name;
  125. int hsize; /* medium header size */
  126. int mintu; /* default min mtu */
  127. int maxtu; /* default max mtu */
  128. int maclen; /* mac address length */
  129. void (*bind)(Ipifc*, int, char**);
  130. void (*unbind)(Ipifc*);
  131. void (*bwrite)(Ipifc *ifc, Block *b, int version, uchar *ip);
  132. /* for arming interfaces to receive multicast */
  133. void (*addmulti)(Ipifc *ifc, uchar *a, uchar *ia);
  134. void (*remmulti)(Ipifc *ifc, uchar *a, uchar *ia);
  135. /* process packets written to 'data' */
  136. void (*pktin)(Fs *f, Ipifc *ifc, Block *bp);
  137. /* routes for router boards */
  138. void (*addroute)(Ipifc *ifc, int, uchar*, uchar*, uchar*, int);
  139. void (*remroute)(Ipifc *ifc, int, uchar*, uchar*);
  140. void (*flushroutes)(Ipifc *ifc);
  141. /* for routing multicast groups */
  142. void (*joinmulti)(Ipifc *ifc, uchar *a, uchar *ia);
  143. void (*leavemulti)(Ipifc *ifc, uchar *a, uchar *ia);
  144. /* address resolution */
  145. void (*ares)(Fs*, int, uchar*, uchar*, int, int); /* resolve */
  146. void (*areg)(Ipifc*, uchar*); /* register */
  147. /* v6 address generation */
  148. void (*pref2addr)(uchar *pref, uchar *ea);
  149. int unbindonclose; /* if non-zero, unbind on last close */
  150. };
  151. /* logical interface associated with a physical one */
  152. struct Iplifc
  153. {
  154. uchar local[IPaddrlen];
  155. uchar mask[IPaddrlen];
  156. uchar remote[IPaddrlen];
  157. uchar net[IPaddrlen];
  158. uchar tentative; /* =1 => v6 dup disc on, =0 => confirmed unique */
  159. uchar onlink; /* =1 => onlink, =0 offlink. */
  160. uchar autoflag; /* v6 autonomous flag */
  161. long validlt; /* v6 valid lifetime */
  162. long preflt; /* v6 preferred lifetime */
  163. long origint; /* time when addr was added */
  164. Iplink *link; /* addresses linked to this lifc */
  165. Iplifc *next;
  166. };
  167. /* binding twixt Ipself and Iplifc */
  168. struct Iplink
  169. {
  170. Ipself *self;
  171. Iplifc *lifc;
  172. Iplink *selflink; /* next link for this local address */
  173. Iplink *lifclink; /* next link for this ifc */
  174. ulong expire;
  175. Iplink *next; /* free list */
  176. int ref;
  177. };
  178. /* rfc 2461, pp.40—43. */
  179. /* default values, one per stack */
  180. struct Routerparams {
  181. int mflag; /* flag: managed address configuration */
  182. int oflag; /* flag: other stateful configuration */
  183. int maxraint; /* max. router adv interval (ms) */
  184. int minraint; /* min. router adv interval (ms) */
  185. int linkmtu; /* mtu options */
  186. int reachtime; /* reachable time */
  187. int rxmitra; /* retransmit interval */
  188. int ttl; /* cur hop count limit */
  189. int routerlt; /* router lifetime */
  190. };
  191. struct Hostparams {
  192. int rxmithost;
  193. };
  194. struct Ipifc
  195. {
  196. RWlock;
  197. Conv *conv; /* link to its conversation structure */
  198. char dev[64]; /* device we're attached to */
  199. Medium *m; /* Media pointer */
  200. int maxtu; /* Maximum transfer unit */
  201. int mintu; /* Minumum tranfer unit */
  202. int mbps; /* megabits per second */
  203. void *arg; /* medium specific */
  204. int reassemble; /* reassemble IP packets before forwarding */
  205. /* these are used so that we can unbind on the fly */
  206. Lock idlock;
  207. uchar ifcid; /* incremented each 'bind/unbind/add/remove' */
  208. int ref; /* number of proc's using this ipifc */
  209. Rendez wait; /* where unbinder waits for ref == 0 */
  210. int unbinding;
  211. uchar mac[MAClen]; /* MAC address */
  212. Iplifc *lifc; /* logical interfaces on this physical one */
  213. ulong in, out; /* message statistics */
  214. ulong inerr, outerr; /* ... */
  215. uchar sendra6; /* flag: send router advs on this ifc */
  216. uchar recvra6; /* flag: recv router advs on this ifc */
  217. Routerparams rp; /* router parameters as in RFC 2461, pp.40—43.
  218. used only if node is router */
  219. };
  220. /*
  221. * one per multicast-lifc pair used by a Conv
  222. */
  223. struct Ipmulti
  224. {
  225. uchar ma[IPaddrlen];
  226. uchar ia[IPaddrlen];
  227. Ipmulti *next;
  228. };
  229. /*
  230. * hash table for 2 ip addresses + 2 ports
  231. */
  232. enum
  233. {
  234. Nipht= 521, /* convenient prime */
  235. IPmatchexact= 0, /* match on 4 tuple */
  236. IPmatchany, /* *!* */
  237. IPmatchport, /* *!port */
  238. IPmatchaddr, /* addr!* */
  239. IPmatchpa, /* addr!port */
  240. };
  241. struct Iphash
  242. {
  243. Iphash *next;
  244. Conv *c;
  245. int match;
  246. };
  247. struct Ipht
  248. {
  249. Lock;
  250. Iphash *tab[Nipht];
  251. };
  252. void iphtadd(Ipht*, Conv*);
  253. void iphtrem(Ipht*, Conv*);
  254. Conv* iphtlook(Ipht *ht, uchar *sa, ushort sp, uchar *da, ushort dp);
  255. /*
  256. * one per multiplexed protocol
  257. */
  258. struct Proto
  259. {
  260. QLock;
  261. char* name; /* protocol name */
  262. int x; /* protocol index */
  263. int ipproto; /* ip protocol type */
  264. char* (*connect)(Conv*, char**, int);
  265. char* (*announce)(Conv*, char**, int);
  266. char* (*bind)(Conv*, char**, int);
  267. int (*state)(Conv*, char*, int);
  268. void (*create)(Conv*);
  269. void (*close)(Conv*);
  270. void (*rcv)(Proto*, Ipifc*, Block*);
  271. char* (*ctl)(Conv*, char**, int);
  272. void (*advise)(Proto*, Block*, char*);
  273. int (*stats)(Proto*, char*, int);
  274. int (*local)(Conv*, char*, int);
  275. int (*remote)(Conv*, char*, int);
  276. int (*inuse)(Conv*);
  277. int (*gc)(Proto*); /* returns true if any conversations are freed */
  278. Fs *f; /* file system this proto is part of */
  279. Conv **conv; /* array of conversations */
  280. int ptclsize; /* size of per protocol ctl block */
  281. int nc; /* number of conversations */
  282. int ac;
  283. Qid qid; /* qid for protocol directory */
  284. ushort nextport;
  285. ushort nextrport;
  286. void *priv;
  287. };
  288. /*
  289. * one per IP protocol stack
  290. */
  291. struct Fs
  292. {
  293. RWlock;
  294. int dev;
  295. int np;
  296. Proto* p[Maxproto+1]; /* list of supported protocols */
  297. Proto* t2p[256]; /* vector of all protocols */
  298. Proto* ipifc; /* kludge for ipifcremroute & ipifcaddroute */
  299. Proto* ipmux; /* kludge for finding an ip multiplexor */
  300. IP *ip;
  301. Ipselftab *self;
  302. Arp *arp;
  303. v6params *v6p;
  304. Route *v4root[1<<Lroot]; /* v4 routing forest */
  305. Route *v6root[1<<Lroot]; /* v6 routing forest */
  306. Route *queue; /* used as temp when reinjecting routes */
  307. Netlog *alog;
  308. char ndb[1024]; /* an ndb entry for this interface */
  309. int ndbvers;
  310. long ndbmtime;
  311. };
  312. /* one per default router known to host */
  313. struct v6router {
  314. uchar inuse;
  315. Ipifc *ifc;
  316. int ifcid;
  317. uchar routeraddr[IPaddrlen];
  318. long ltorigin;
  319. Routerparams rp;
  320. };
  321. struct v6params
  322. {
  323. Routerparams rp; /* v6 params, one copy per node now */
  324. Hostparams hp;
  325. v6router v6rlist[3]; /* max 3 default routers, currently */
  326. int cdrouter; /* uses only v6rlist[cdrouter] if */
  327. /* cdrouter >= 0. */
  328. };
  329. int Fsconnected(Conv*, char*);
  330. Conv* Fsnewcall(Conv*, uchar*, ushort, uchar*, ushort, uchar);
  331. int Fspcolstats(char*, int);
  332. int Fsproto(Fs*, Proto*);
  333. int Fsbuiltinproto(Fs*, uchar);
  334. Conv* Fsprotoclone(Proto*, char*);
  335. Proto* Fsrcvpcol(Fs*, uchar);
  336. Proto* Fsrcvpcolx(Fs*, uchar);
  337. char* Fsstdconnect(Conv*, char**, int);
  338. char* Fsstdannounce(Conv*, char**, int);
  339. char* Fsstdbind(Conv*, char**, int);
  340. ulong scalednconv(void);
  341. void closeconv(Conv*);
  342. /*
  343. * logging
  344. */
  345. enum
  346. {
  347. Logip= 1<<1,
  348. Logtcp= 1<<2,
  349. Logfs= 1<<3,
  350. Logicmp= 1<<5,
  351. Logudp= 1<<6,
  352. Logcompress= 1<<7,
  353. Loggre= 1<<9,
  354. Logppp= 1<<10,
  355. Logtcprxmt= 1<<11,
  356. Logigmp= 1<<12,
  357. Logudpmsg= 1<<13,
  358. Logipmsg= 1<<14,
  359. Logrudp= 1<<15,
  360. Logrudpmsg= 1<<16,
  361. Logesp= 1<<17,
  362. Logtcpwin= 1<<18,
  363. };
  364. void netloginit(Fs*);
  365. void netlogopen(Fs*);
  366. void netlogclose(Fs*);
  367. void netlogctl(Fs*, char*, int);
  368. long netlogread(Fs*, void*, ulong, long);
  369. void netlog(Fs*, int, char*, ...);
  370. void ifcloginit(Fs*);
  371. long ifclogread(Fs*, Chan *,void*, ulong, long);
  372. void ifclog(Fs*, uchar *, int);
  373. void ifclogopen(Fs*, Chan*);
  374. void ifclogclose(Fs*, Chan*);
  375. /*
  376. * iproute.c
  377. */
  378. typedef struct RouteTree RouteTree;
  379. typedef struct Routewalk Routewalk;
  380. typedef struct V4route V4route;
  381. typedef struct V6route V6route;
  382. enum
  383. {
  384. /* type bits */
  385. Rv4= (1<<0), /* this is a version 4 route */
  386. Rifc= (1<<1), /* this route is a directly connected interface */
  387. Rptpt= (1<<2), /* this route is a pt to pt interface */
  388. Runi= (1<<3), /* a unicast self address */
  389. Rbcast= (1<<4), /* a broadcast self address */
  390. Rmulti= (1<<5), /* a multicast self address */
  391. Rproxy= (1<<6), /* this route should be proxied */
  392. };
  393. struct Routewalk
  394. {
  395. int o;
  396. int h;
  397. char* p;
  398. char* e;
  399. void* state;
  400. void (*walk)(Route*, Routewalk*);
  401. };
  402. struct RouteTree
  403. {
  404. Route* right;
  405. Route* left;
  406. Route* mid;
  407. uchar depth;
  408. uchar type;
  409. uchar ifcid; /* must match ifc->id */
  410. Ipifc *ifc;
  411. char tag[4];
  412. int ref;
  413. };
  414. struct V4route
  415. {
  416. ulong address;
  417. ulong endaddress;
  418. uchar gate[IPv4addrlen];
  419. };
  420. struct V6route
  421. {
  422. ulong address[IPllen];
  423. ulong endaddress[IPllen];
  424. uchar gate[IPaddrlen];
  425. };
  426. struct Route
  427. {
  428. RouteTree;
  429. union {
  430. V6route v6;
  431. V4route v4;
  432. };
  433. };
  434. extern void v4addroute(Fs *f, char *tag, uchar *a, uchar *mask, uchar *gate, int type);
  435. extern void v6addroute(Fs *f, char *tag, uchar *a, uchar *mask, uchar *gate, int type);
  436. extern void v4delroute(Fs *f, uchar *a, uchar *mask, int dolock);
  437. extern void v6delroute(Fs *f, uchar *a, uchar *mask, int dolock);
  438. extern Route* v4lookup(Fs *f, uchar *a, Conv *c);
  439. extern Route* v6lookup(Fs *f, uchar *a, Conv *c);
  440. extern long routeread(Fs *f, char*, ulong, int);
  441. extern long routewrite(Fs *f, Chan*, char*, int);
  442. extern void routetype(int, char*);
  443. extern void ipwalkroutes(Fs*, Routewalk*);
  444. extern void convroute(Route*, uchar*, uchar*, uchar*, char*, int*);
  445. /*
  446. * devip.c
  447. */
  448. /*
  449. * Hanging off every ip channel's ->aux is the following structure.
  450. * It maintains the state used by devip and iproute.
  451. */
  452. struct IPaux
  453. {
  454. char *owner; /* the user that did the attach */
  455. char tag[4];
  456. };
  457. extern IPaux* newipaux(char*, char*);
  458. /*
  459. * arp.c
  460. */
  461. struct Arpent
  462. {
  463. uchar ip[IPaddrlen];
  464. uchar mac[MAClen];
  465. Medium *type; /* media type */
  466. Arpent* hash;
  467. Block* hold;
  468. Block* last;
  469. uint ctime; /* time entry was created or refreshed */
  470. uint utime; /* time entry was last used */
  471. uchar state;
  472. Arpent *nextrxt; /* re-transmit chain */
  473. uint rtime; /* time for next retransmission */
  474. uchar rxtsrem;
  475. Ipifc *ifc;
  476. uchar ifcid; /* must match ifc->id */
  477. };
  478. extern void arpinit(Fs*);
  479. extern int arpread(Arp*, char*, ulong, int);
  480. extern int arpwrite(Fs*, char*, int);
  481. extern Arpent* arpget(Arp*, Block *bp, int version, Ipifc *ifc, uchar *ip, uchar *h);
  482. extern void arprelease(Arp*, Arpent *a);
  483. extern Block* arpresolve(Arp*, Arpent *a, Medium *type, uchar *mac);
  484. extern void arpenter(Fs*, int version, uchar *ip, uchar *mac, int len, int norefresh);
  485. /*
  486. * ipaux.c
  487. */
  488. extern int myetheraddr(uchar*, char*);
  489. extern ulong parseip(uchar*, char*);
  490. extern ulong parseipmask(uchar*, char*);
  491. extern char* v4parseip(uchar*, char*);
  492. extern void maskip(uchar *from, uchar *mask, uchar *to);
  493. extern int parsemac(uchar *to, char *from, int len);
  494. extern uchar* defmask(uchar*);
  495. extern int isv4(uchar*);
  496. extern void v4tov6(uchar *v6, uchar *v4);
  497. extern int v6tov4(uchar *v4, uchar *v6);
  498. extern int eipfmt(Fmt*);
  499. #define ipmove(x, y) memmove(x, y, IPaddrlen)
  500. #define ipcmp(x, y) ( (x)[IPaddrlen-1] != (y)[IPaddrlen-1] || memcmp(x, y, IPaddrlen) )
  501. extern uchar IPv4bcast[IPaddrlen];
  502. extern uchar IPv4bcastobs[IPaddrlen];
  503. extern uchar IPv4allsys[IPaddrlen];
  504. extern uchar IPv4allrouter[IPaddrlen];
  505. extern uchar IPnoaddr[IPaddrlen];
  506. extern uchar v4prefix[IPaddrlen];
  507. extern uchar IPallbits[IPaddrlen];
  508. #define NOW TK2MS(MACHP(0)->ticks)
  509. /*
  510. * media
  511. */
  512. extern Medium ethermedium;
  513. extern Medium nullmedium;
  514. extern Medium pktmedium;
  515. extern Medium tripmedium;
  516. /*
  517. * ipifc.c
  518. */
  519. extern Medium* ipfindmedium(char *name);
  520. extern void addipmedium(Medium *med);
  521. extern int ipforme(Fs*, uchar *addr);
  522. extern int iptentative(Fs*, uchar *addr);
  523. extern int ipisbm(uchar *);
  524. extern int ipismulticast(uchar *);
  525. extern Ipifc* findipifc(Fs*, uchar *remote, int type);
  526. extern void findlocalip(Fs*, uchar *local, uchar *remote);
  527. extern int ipv4local(Ipifc *ifc, uchar *addr);
  528. extern int ipv6local(Ipifc *ifc, uchar *addr);
  529. extern int ipv6anylocal(Ipifc *ifc, uchar *addr);
  530. extern Iplifc* iplocalonifc(Ipifc *ifc, uchar *ip);
  531. extern int ipproxyifc(Fs *f, Ipifc *ifc, uchar *ip);
  532. extern int ipismulticast(uchar *ip);
  533. extern int ipisbooting(void);
  534. extern int ipifccheckin(Ipifc *ifc, Medium *med);
  535. extern void ipifccheckout(Ipifc *ifc);
  536. extern int ipifcgrab(Ipifc *ifc);
  537. extern void ipifcaddroute(Fs*, int, uchar*, uchar*, uchar*, int);
  538. extern void ipifcremroute(Fs*, int, uchar*, uchar*);
  539. extern void ipifcremmulti(Conv *c, uchar *ma, uchar *ia);
  540. extern void ipifcaddmulti(Conv *c, uchar *ma, uchar *ia);
  541. extern char* ipifcrem(Ipifc *ifc, char **argv, int argc);
  542. extern char* ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
  543. extern long ipselftabread(Fs*, char *a, ulong offset, int n);
  544. extern char* ipifcadd6(Ipifc *ifc, char**argv, int argc);
  545. /*
  546. * ip.c
  547. */
  548. extern void iprouting(Fs*, int);
  549. extern void icmpnoconv(Fs*, Block*);
  550. extern void icmpcantfrag(Fs*, Block*, int);
  551. extern void icmpttlexceeded(Fs*, uchar*, Block*);
  552. extern ushort ipcsum(uchar*);
  553. extern void ipiput4(Fs*, Ipifc*, Block*);
  554. extern void ipiput6(Fs*, Ipifc*, Block*);
  555. extern int ipoput4(Fs*, Block*, int, int, int, Conv*);
  556. extern int ipoput6(Fs*, Block*, int, int, int, Conv*);
  557. extern int ipstats(Fs*, char*, int);
  558. extern ushort ptclbsum(uchar*, int);
  559. extern ushort ptclcsum(Block*, int, int);
  560. extern void ip_init(Fs*);
  561. extern void update_mtucache(uchar*, ulong);
  562. extern ulong restrict_mtu(uchar*, ulong);
  563. /*
  564. * bootp.c
  565. */
  566. extern char* bootp(Ipifc*);
  567. extern int bootpread(char*, ulong, int);
  568. /*
  569. * resolving inferno/plan9 differences
  570. */
  571. Chan* commonfdtochan(int, int, int, int);
  572. char* commonuser(void);
  573. char* commonerror(void);
  574. /*
  575. * chandial.c
  576. */
  577. extern Chan* chandial(char*, char*, char*, Chan**);
  578. /*
  579. * global to all of the stack
  580. */
  581. extern void (*igmpreportfn)(Ipifc*, uchar*);