Annotation of xinu/sys/icmp_in.c, revision 1.1.1.1

1.1       root        1: /* icmp_in.c - icmp_in */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <network.h>
                      6: 
                      7: /*------------------------------------------------------------------------
                      8:  *  icmp_in  -  handle ICMP packet coming in from the network
                      9:  *------------------------------------------------------------------------
                     10:  */
                     11: icmp_in(packet, icmpp, lim)
                     12: struct epacket *packet;
                     13: int    icmpp;
                     14: int    lim;
                     15: {
                     16:        struct  ip      *ipptr;
                     17:        struct  icmp    *icmpptr;
                     18:        int     len;
                     19: 
                     20:        ipptr = (struct ip *)packet->ep_data;
                     21:        icmpptr = (struct icmp *) ipptr->i_data;
                     22:        if (!Net.mavalid || icmpptr->ic_typ != ICRQECH) {
                     23:                freebuf(packet);
                     24:        } else {
                     25:                icmpptr->ic_typ = (char) ICRPECH;
                     26:                blkcopy(ipptr->i_dest, ipptr->i_src, IPLEN);
                     27:                len = net2hs(ipptr->i_paclen) - IPHLEN;
                     28:                if (isodd(len)) {
                     29:                        ipptr->i_data[len++] = NULLCH;
                     30:                }
                     31:                icmpptr->ic_cksum = 0;
                     32:                icmpptr->ic_cksum = cksum(icmpptr, len>>1);
                     33:                if (pcount(icmpp) < lim)
                     34:                        psend(icmpp, packet);
                     35:                else
                     36:                        freebuf(packet);
                     37:        }
                     38:        return(OK);
                     39: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.