|
|
1.1 ! root 1: /* mkarp.c - mkarp */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <network.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * mkarp - allocate and fill in an ARP or RARP packet ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: struct epacket *mkarp(typ, op, spaddr, tpaddr) ! 12: short typ; ! 13: short op; ! 14: IPaddr spaddr; ! 15: IPaddr tpaddr; ! 16: { ! 17: register struct arppak *apacptr; ! 18: struct epacket *packet; ! 19: ! 20: packet = (struct epacket *) getbuf(Net.netpool); ! 21: if ( ((int) packet) == SYSERR) ! 22: return((struct epacket *) SYSERR); ! 23: blkcopy(packet->ep_hdr.e_dest, EBCAST, AR_HLEN); ! 24: packet->ep_hdr.e_ptype = hs2net(typ); ! 25: apacptr = (struct arppak *) packet->ep_data; ! 26: apacptr->ar_hrd = hs2net(AR_HRD); ! 27: apacptr->ar_prot = hs2net(AR_PROT); ! 28: apacptr->ar_hlen = AR_HLEN; ! 29: apacptr->ar_plen = AR_PLEN; ! 30: apacptr->ar_op = hs2net(op); ! 31: blkcopy(apacptr->ar_sha, eth[0].etpaddr, AR_HLEN); ! 32: blkcopy(apacptr->ar_spa, spaddr, AR_PLEN); ! 33: blkcopy(apacptr->ar_tha, eth[0].etpaddr, AR_HLEN); ! 34: blkcopy(apacptr->ar_tpa, tpaddr, AR_PLEN); ! 35: return(packet); ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.