Lines Matching refs:ip

64 #include <netinet/ip.h>
94 ip_test1(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
104 IP_HL_A(ip, sizeof(*ip) >> 2);
105 IP_V_A(ip, IPVERSION);
106 ip->ip_tos = 0;
107 ip->ip_off = 0;
108 ip->ip_ttl = 60;
109 ip->ip_p = IPPROTO_UDP;
110 ip->ip_sum = 0;
111 u = (udphdr_t *)(ip + 1);
116 ip->ip_len = sizeof(*ip) + ntohs(u->uh_ulen);
117 len = ip->ip_len;
127 ip->ip_id = 0;
129 for (i = 0; i < ((sizeof(*ip) + ntohs(u->uh_ulen)) >> 2); i++) {
130 IP_HL_A(ip, i >> 2);
131 (void) send_ip(nfd, 1500, ip, gwip, 1);
143 ip->ip_id = 0;
145 for (; i < ((sizeof(*ip) * 2 + ntohs(u->uh_ulen)) >> 2); i++) {
146 IP_HL_A(ip, i >> 2);
147 (void) send_ip(nfd, 1500, ip, gwip, 1);
159 ip->ip_id = 0;
161 IP_HL_A(ip, sizeof(*ip) >> 2);
163 IP_V_A(ip, i);
164 (void) send_ip(nfd, 1500, ip, gwip, 1);
176 ip->ip_id = 0;
179 IP_V_A(ip, i);
180 (void) send_ip(nfd, 1500, ip, gwip, 1);
192 ip->ip_id = 0;
193 IP_V_A(ip, IPVERSION);
194 i = ip->ip_len + 1;
196 for (; i < (ip->ip_len * 2); i++) {
197 ip->ip_id = htons(id++);
198 ip->ip_sum = 0;
199 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
200 (void) send_ether(nfd, (char *)ip, i, gwip);
208 ip->ip_id = htons(id++);
209 ip->ip_len = i;
210 ip->ip_sum = 0;
211 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
212 (void) send_ether(nfd, (char *)ip, len, gwip);
224 ip->ip_id = 0;
227 ip->ip_id = htons(id++);
228 ip->ip_len = i;
229 ip->ip_sum = 0;
230 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
231 (void) send_ether(nfd, (char *)ip, len, gwip);
237 ip->ip_len = len;
240 ip->ip_id = htons(id++);
241 ip->ip_sum = 0;
242 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
243 (void) send_ether(nfd, (char *)ip, i, gwip);
256 ip->ip_id = 0;
257 ip->ip_len = sizeof(*ip);
258 ip->ip_off = htons(IP_MF);
259 (void) send_ip(nfd, mtu, ip, gwip, 1);
264 ip->ip_id = 0;
265 ip->ip_len = sizeof(*ip);
266 ip->ip_off = htons(IP_MF);
267 (void) send_ip(nfd, mtu, ip, gwip, 1);
272 ip->ip_id = 0;
273 ip->ip_len = sizeof(*ip);
274 ip->ip_off = htons(0xa000);
275 (void) send_ip(nfd, mtu, ip, gwip, 1);
280 ip->ip_id = 0;
281 ip->ip_len = sizeof(*ip);
282 ip->ip_off = htons(0x0100);
283 (void) send_ip(nfd, mtu, ip, gwip, 1);
299 ip->ip_p = IPPROTO_ICMP;
300 ip->ip_off = htons(IP_MF);
302 ip->ip_id = htons(id++);
304 ip->ip_len = 768 + 20 + 8;
305 (void) send_ip(nfd, mtu, ip, gwip, 1);
308 ip->ip_len = MIN(768 + 20, mtu - 68);
311 ip->ip_off = htons(IP_MF | (i >> 3));
312 (void) send_ip(nfd, mtu, ip, gwip, 1);
317 ip->ip_len = 896 + 20;
318 ip->ip_off = htons(i >> 3);
319 (void) send_ip(nfd, mtu, ip, gwip, 1);
330 ip->ip_p = IPPROTO_ICMP;
331 ip->ip_off = htons(IP_MF);
333 ip->ip_id = htons(id++);
335 ip->ip_len = 768 + 20 + 8;
337 (void) send_ip(nfd, mtu, ip, gwip, 1);
342 ip->ip_len = MIN(768 + 20, mtu - 68);
345 ip->ip_off = htons(IP_MF | (i >> 3));
347 (void) send_ip(nfd, mtu, ip, gwip, 1);
354 ip->ip_len = 896 + 20;
355 ip->ip_off = htons(i >> 3);
357 (void) send_ip(nfd, mtu, ip, gwip, 1);
370 ip->ip_p = IPPROTO_ICMP;
371 ip->ip_off = htons(IP_MF);
373 ip->ip_id = htons(id++);
375 ip->ip_len = 768 + 20 + 8;
376 (void) send_ip(nfd, mtu, ip, gwip, 1);
379 ip->ip_len = MIN(768 + 20, mtu - 68);
382 ip->ip_off = htons(IP_MF | (i >> 3));
383 (void) send_ip(nfd, mtu, ip, gwip, 1);
388 ip->ip_len = 896 + 20;
389 ip->ip_off = htons(i >> 3);
390 (void) send_ip(nfd, mtu, ip, gwip, 1);
396 ip->ip_len = len;
397 ip->ip_off = 0;
402 ip->ip_id = 0;
403 ip->ip_off = htons(0x8000);
405 (void) send_ip(nfd, mtu, ip, gwip, 1);
410 ip->ip_off = 0;
416 ip->ip_id = 0;
417 ip->ip_ttl = 255;
419 (void) send_ip(nfd, mtu, ip, gwip, 1);
423 ip->ip_ttl = 128;
425 (void) send_ip(nfd, mtu, ip, gwip, 1);
429 ip->ip_ttl = 0;
431 (void) send_ip(nfd, mtu, ip, gwip, 1);
440 void ip_test2(dev, mtu, ip, gwip, ptest)
443 ip_t *ip;
460 IP_HL_A(ip, 6);
461 ip->ip_len = IP_HL(ip) << 2;
462 s = (u_char *)(ip + 1);
473 ip->ip_p = IPPROTO_IP;
475 (void) send_ip(nfd, mtu, ip, gwip, 1);
480 IP_HL_A(ip, 7);
481 ip->ip_len = IP_HL(ip) << 2;
489 (void) send_ip(nfd, mtu, ip, gwip, 1);
496 (void) send_ip(nfd, mtu, ip, gwip, 1);
503 (void) send_ip(nfd, mtu, ip, gwip, 1);
510 (void) send_ip(nfd, mtu, ip, gwip, 1);
517 (void) send_ip(nfd, mtu, ip, gwip, 1);
524 (void) send_ip(nfd, mtu, ip, gwip, 1);
537 ip_test3(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
549 IP_HL_A(ip, sizeof(*ip) >> 2);
550 IP_V_A(ip, IPVERSION);
551 ip->ip_tos = 0;
552 ip->ip_off = 0;
553 ip->ip_ttl = 60;
554 ip->ip_p = IPPROTO_ICMP;
555 ip->ip_sum = 0;
556 ip->ip_len = sizeof(*ip) + sizeof(*icp);
557 icp = (struct icmp *)((char *)ip + (IP_HL(ip) << 2));
570 (void) send_icmp(nfd, mtu, ip, gwip);
575 (void) send_icmp(nfd, mtu, ip, gwip);
588 (void) send_icmp(nfd, mtu, ip, gwip);
600 (void) send_icmp(nfd, mtu, ip, gwip);
604 (void) send_icmp(nfd, mtu, ip, gwip);
608 (void) send_icmp(nfd, mtu, ip, gwip);
612 (void) send_icmp(nfd, mtu, ip, gwip);
623 (void) send_icmp(nfd, mtu, ip, gwip);
627 (void) send_icmp(nfd, mtu, ip, gwip);
631 (void) send_icmp(nfd, mtu, ip, gwip);
635 (void) send_icmp(nfd, mtu, ip, gwip);
647 (void) send_icmp(nfd, mtu, ip, gwip);
652 (void) send_icmp(nfd, mtu, ip, gwip);
657 (void) send_icmp(nfd, mtu, ip, gwip);
662 (void) send_icmp(nfd, mtu, ip, gwip);
676 (void) send_icmp(nfd, mtu, ip, gwip);
680 (void) send_icmp(nfd, mtu, ip, gwip);
684 (void) send_icmp(nfd, mtu, ip, gwip);
688 (void) send_icmp(nfd, mtu, ip, gwip);
692 (void) send_icmp(nfd, mtu, ip, gwip);
702 ip->ip_len = sizeof(*ip) + sizeof(*icp) / 2;
706 (void) send_icmp(nfd, mtu, ip, gwip);
711 (void) send_icmp(nfd, mtu, ip, gwip);
716 (void) send_icmp(nfd, mtu, ip, gwip);
721 (void) send_icmp(nfd, mtu, ip, gwip);
734 ip_test4(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
745 IP_HL_A(ip, sizeof(*ip) >> 2);
746 IP_V_A(ip, IPVERSION);
747 ip->ip_tos = 0;
748 ip->ip_off = 0;
749 ip->ip_ttl = 60;
750 ip->ip_p = IPPROTO_UDP;
751 ip->ip_sum = 0;
752 u = (udphdr_t *)((char *)ip + (IP_HL(ip) << 2));
766 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
770 (void) send_udp(nfd, 1500, ip, gwip);
783 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
786 ip->ip_len = i;
787 (void) send_udp(nfd, 1500, ip, gwip);
801 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
804 (void) send_udp(nfd, 1500, ip, gwip);
810 (void) send_udp(nfd, 1500, ip, gwip);
816 (void) send_udp(nfd, 1500, ip, gwip);
822 (void) send_udp(nfd, 1500, ip, gwip);
829 (void) send_udp(nfd, 1500, ip, gwip);
842 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
845 (void) send_udp(nfd, 1500, ip, gwip);
851 (void) send_udp(nfd, 1500, ip, gwip);
857 (void) send_udp(nfd, 1500, ip, gwip);
863 (void) send_udp(nfd, 1500, ip, gwip);
869 (void) send_udp(nfd, 1500, ip, gwip);
881 for (i = sizeof(*ip); i <= ntohs(u->uh_ulen); i++) {
882 (void) send_udp(nfd, i, ip, gwip);
895 ip_test5(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
905 t = (tcphdr_t *)((char *)ip + (IP_HL(ip) << 2));
915 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
930 (void) send_tcp(nfd, mtu, ip, gwip);
946 (void) send_tcp(nfd, mtu, ip, gwip);
952 (void) send_tcp(nfd, mtu, ip, gwip);
958 (void) send_tcp(nfd, mtu, ip, gwip);
964 (void) send_tcp(nfd, mtu, ip, gwip);
970 (void) send_tcp(nfd, mtu, ip, gwip);
976 (void) send_tcp(nfd, mtu, ip, gwip);
989 (void) send_tcp(nfd, mtu, ip, gwip);
995 (void) send_tcp(nfd, mtu, ip, gwip);
1001 (void) send_tcp(nfd, mtu, ip, gwip);
1007 (void) send_tcp(nfd, mtu, ip, gwip);
1013 (void) send_tcp(nfd, mtu, ip, gwip);
1019 (void) send_tcp(nfd, mtu, ip, gwip);
1031 (void) send_tcp(nfd, mtu, ip, gwip);
1037 (void) send_tcp(nfd, mtu, ip, gwip);
1043 (void) send_tcp(nfd, mtu, ip, gwip);
1062 sin.sin_addr.s_addr = ip->ip_dst.s_addr;
1073 inet_ntoa(ip->ip_dst));
1077 bcopy((char *)ip, (char *)&ti, sizeof(*ip));
1099 (void) send_tcp(nfd, mtu, ip, gwip);
1103 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t) + 1;
1105 (void) send_tcp(nfd, mtu, ip, gwip);
1108 (void) send_tcp(nfd, mtu, ip, gwip);
1111 (void) send_tcp(nfd, mtu, ip, gwip);
1115 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1126 (void) send_tcp(nfd, mtu, ip, gwip);
1132 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1151 (void) send_tcp(nfd, mtu, ip, gwip);
1157 (void) send_tcp(nfd, mtu, ip, gwip);
1163 (void) send_tcp(nfd, mtu, ip, gwip);
1169 (void) send_tcp(nfd, mtu, ip, gwip);
1175 (void) send_tcp(nfd, mtu, ip, gwip);
1189 (void) send_tcp(nfd, mtu, ip, gwip);
1195 (void) send_tcp(nfd, mtu, ip, gwip);
1201 (void) send_tcp(nfd, mtu, ip, gwip);
1207 (void) send_tcp(nfd, mtu, ip, gwip);
1213 (void) send_tcp(nfd, mtu, ip, gwip);
1218 /* LAND attack - self connect, so make src & dst ip/port the same */
1225 ip->ip_src = ip->ip_dst;
1226 (void) send_tcp(nfd, mtu, ip, gwip);
1239 ip_test6(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
1249 IP_V_A(ip, IPVERSION);
1250 ip->ip_tos = 0;
1251 ip->ip_off = 0;
1252 ip->ip_ttl = 60;
1253 ip->ip_p = IPPROTO_UDP;
1254 ip->ip_sum = 0;
1255 u = (udphdr_t *)(ip + 1);
1273 ip->ip_len = sizeof(*ip) + 768 + sizeof(*u);
1274 IP_HL_A(ip, sizeof(*ip) >> 2);
1275 ip->ip_off = htons(IP_MF);
1276 (void) send_ip(nfd, 1500, ip, gwip, 1);
1283 ip->ip_len = sizeof(*ip) + 128 + sizeof(*u);
1284 ip->ip_off = htons(IP_MF);
1285 (void) send_ip(nfd, 1500, ip, gwip, 1);
1291 ip->ip_len = sizeof(*ip) + 768;
1292 ip->ip_off = htons(IP_MF|(j>>3));
1293 (void) send_ip(nfd, 1500, ip, gwip, 1);
1298 ip->ip_len = sizeof(*ip) + 128;
1300 ip->ip_off = htons(IP_MF|(k>>3));
1301 (void) send_ip(nfd, 1500, ip, gwip, 1);
1317 ip_test7(char *dev, int mtu, ip_t *ip, struct in_addr gwip, int ptest)
1342 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,
1358 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,