|
|
1.1 ! root 1: /* ipsend.c - ipsend */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <network.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * ipsend - fill in IP header and send datagram to specified address ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: ipsend(faddr, packet, datalen) ! 12: IPaddr faddr; ! 13: struct epacket *packet; ! 14: int datalen; ! 15: { ! 16: register struct ip *ipptr; ! 17: ! 18: packet->ep_hdr.e_ptype = hs2net(EP_IP); ! 19: ipptr = (struct ip *) packet->ep_data; ! 20: ipptr->i_verlen = IVERLEN; ! 21: ipptr->i_svctyp = ISVCTYP; ! 22: ipptr->i_paclen = hs2net( datalen+IPHLEN ); ! 23: ipptr->i_id = hs2net(ipackid++); ! 24: ipptr->i_fragoff = hs2net(IFRAGOFF); ! 25: ipptr->i_tim2liv = ITIM2LIV; ! 26: ipptr->i_cksum = 0; ! 27: getaddr(ipptr->i_src); ! 28: blkcopy(ipptr->i_dest, faddr, IPLEN); ! 29: ipptr->i_cksum = cksum(ipptr, IPHLEN>>1); ! 30: return( route(faddr, packet, EHLEN+IPHLEN+datalen) ); ! 31: } ! 32: int ipackid = 1;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.