Index ciany ogniowe oparte o IP Filter Rozdział9 (15) wiedza i zycie2 15 (222) abc.com.pl 7 Nastanie nocy (10) 14 2kro Przetacznik Gierowska Maria, Włodarski Ziemowit Psychologi (3) Rembowski Józef Rodzina w Âświetle psychologii (2) nie boska komedia akt3 krasinski |
[ Pobierz całość w formacie PDF ] .*/hlen = iph->ihl * 4;left = ntohs(iph->tot_len) - hlen; /* Space per frame */hlen += dev->hard_header_len; /* Total header size */mtu = (dev->mtu - hlen); /* Size of data space */ptr = (raw + hlen); /* Where to start from *//** Check for any "DF" flag.[DF means do not fragment]*/if (ntohs(iph->frag_off) & IP_DF){ip_statistics.IpFragFails++;NETDEBUG(printk("ip_queue_xmit: frag needed\n"));return;}/** The protocol doesn't seem to say what to do in the case that the* frame + options doesn't fit the mtu.As it used to fall down dead* in this case we were fortunate it didn't happen*/if(mtu<8){/* It's wrong but it's better than nothing */icmp_send(skb,ICMP_DEST_UNREACH,ICMP_FRAG_NEEDED,dev->mtu, dev);ip_statistics.IpFragFails++;return;}/** Fragment the datagram.*//** The initial offset is 0 for a complete frame.When* fragmenting fragments it's wherever this one starts.*/if (is_frag & 2)offset = (ntohs(iph->frag_off) & IP_OFFSET) << 3;elseoffset = 0;/** Keep copying data until we run out.*/while(left > 0){len = left;/* IF: it doesn't fit, use 'mtu' - the data space left */if (len > mtu)len = mtu;/* IF: we are not sending upto and including the packet endthen align the next start on an eight byte boundary */if (len < left){len/=8;len*=8;}/** Allocate buffer.*/if ((skb2 = alloc_skb(len + hlen+15,GFP_ATOMIC)) == NULL){NETDEBUG(printk("IP: frag: no memory for new fragment!\n"));ip_statistics.IpFragFails++;return;}/** Set up data on packet*/skb2->arp = skb->arp;if(skb->free==0)printk(KERN_ERR "IP fragmenter: BUG free!=1 in fragmenter\n");skb2->free = 1;skb_put(skb2,len + hlen);skb2->h.raw=(char *) skb2->data;/** Charge the memory for the fragment to any owner* it might possess*/if (sk){atomic_add(skb2->truesize, &sk->wmem_alloc);skb2->sk=sk;}skb2->raddr = skb->raddr; /* For rebuild_header - must be here *//** Copy the packet header into the new buffer.*/memcpy(skb2->h.raw, raw, hlen);/** Copy a block of the IP datagram.*/memcpy(skb2->h.raw + hlen, ptr, len);left -= len;skb2->h.raw+=dev->hard_header_len;/** Fill in the new header fields.*/iph = (struct iphdr *)(skb2->h.raw/*+dev->hard_header_len*/);iph->frag_off = htons((offset >> 3));skb2->ip_hdr = iph;/* ANK: dirty, but effective trick.Upgrade options only if* the segment to be fragmented was THE FIRST (otherwise,* options are already fixed) and make it ONCE* on the initial skb, so that all the following fragments* will inherit fixed options.*/if (offset == 0)ip_options_fragment(skb);/** Added AC : If we are fragmenting a fragment that's not the* last fragment then keep MF on each bit*/if (left > 0 || (is_frag & 1))iph->frag_off |= htons(IP_MF);ptr += len;offset += len;/** Put this fragment into the sending queue.*/ip_statistics.IpFragCreates++;ip_queue_xmit(sk, dev, skb2, 2);}ip_statistics.IpFragOKs++;} [ Pobierz całość w formacie PDF ] |
||||
Wszelkie Prawa Zastrzeżone! Kawa była słaba i bez smaku. Nie miała treści, a jedynie formę. Design by SZABLONY.maniak.pl. | |||||