Lines Matching refs:ip

89 #include <netinet/ip.h>
125 void ip_test1(dev, mtu, ip, gwip, ptest)
128 ip_t *ip;
140 IP_HL_A(ip, sizeof(*ip) >> 2);
141 IP_V_A(ip, IPVERSION);
142 ip->ip_tos = 0;
143 ip->ip_off = 0;
144 ip->ip_ttl = 60;
145 ip->ip_p = IPPROTO_UDP;
146 ip->ip_sum = 0;
147 u = (udphdr_t *)(ip + 1);
152 ip->ip_len = sizeof(*ip) + ntohs(u->uh_ulen);
153 len = ip->ip_len;
163 ip->ip_id = 0;
165 for (i = 0; i < ((sizeof(*ip) + ntohs(u->uh_ulen)) >> 2); i++) {
166 IP_HL_A(ip, i >> 2);
167 (void) send_ip(nfd, 1500, ip, gwip, 1);
179 ip->ip_id = 0;
181 for (; i < ((sizeof(*ip) * 2 + ntohs(u->uh_ulen)) >> 2); i++) {
182 IP_HL_A(ip, i >> 2);
183 (void) send_ip(nfd, 1500, ip, gwip, 1);
195 ip->ip_id = 0;
197 IP_HL_A(ip, sizeof(*ip) >> 2);
199 IP_V_A(ip, i);
200 (void) send_ip(nfd, 1500, ip, gwip, 1);
212 ip->ip_id = 0;
215 IP_V_A(ip, i);
216 (void) send_ip(nfd, 1500, ip, gwip, 1);
228 ip->ip_id = 0;
229 IP_V_A(ip, IPVERSION);
230 i = ip->ip_len + 1;
232 for (; i < (ip->ip_len * 2); i++) {
233 ip->ip_id = htons(id++);
234 ip->ip_sum = 0;
235 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
236 (void) send_ether(nfd, (char *)ip, i, gwip);
244 ip->ip_id = htons(id++);
245 ip->ip_len = i;
246 ip->ip_sum = 0;
247 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
248 (void) send_ether(nfd, (char *)ip, len, gwip);
260 ip->ip_id = 0;
263 ip->ip_id = htons(id++);
264 ip->ip_len = i;
265 ip->ip_sum = 0;
266 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
267 (void) send_ether(nfd, (char *)ip, len, gwip);
273 ip->ip_len = len;
276 ip->ip_id = htons(id++);
277 ip->ip_sum = 0;
278 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
279 (void) send_ether(nfd, (char *)ip, i, gwip);
292 ip->ip_id = 0;
293 ip->ip_len = sizeof(*ip);
294 ip->ip_off = htons(IP_MF);
295 (void) send_ip(nfd, mtu, ip, gwip, 1);
300 ip->ip_id = 0;
301 ip->ip_len = sizeof(*ip);
302 ip->ip_off = htons(IP_MF);
303 (void) send_ip(nfd, mtu, ip, gwip, 1);
308 ip->ip_id = 0;
309 ip->ip_len = sizeof(*ip);
310 ip->ip_off = htons(0xa000);
311 (void) send_ip(nfd, mtu, ip, gwip, 1);
316 ip->ip_id = 0;
317 ip->ip_len = sizeof(*ip);
318 ip->ip_off = htons(0x0100);
319 (void) send_ip(nfd, mtu, ip, gwip, 1);
335 ip->ip_p = IPPROTO_ICMP;
336 ip->ip_off = htons(IP_MF);
338 ip->ip_id = htons(id++);
340 ip->ip_len = 768 + 20 + 8;
341 (void) send_ip(nfd, mtu, ip, gwip, 1);
344 ip->ip_len = MIN(768 + 20, mtu - 68);
347 ip->ip_off = htons(IP_MF | (i >> 3));
348 (void) send_ip(nfd, mtu, ip, gwip, 1);
353 ip->ip_len = 896 + 20;
354 ip->ip_off = htons(i >> 3);
355 (void) send_ip(nfd, mtu, ip, gwip, 1);
366 ip->ip_p = IPPROTO_ICMP;
367 ip->ip_off = htons(IP_MF);
369 ip->ip_id = htons(id++);
371 ip->ip_len = 768 + 20 + 8;
373 (void) send_ip(nfd, mtu, ip, gwip, 1);
378 ip->ip_len = MIN(768 + 20, mtu - 68);
381 ip->ip_off = htons(IP_MF | (i >> 3));
383 (void) send_ip(nfd, mtu, ip, gwip, 1);
390 ip->ip_len = 896 + 20;
391 ip->ip_off = htons(i >> 3);
393 (void) send_ip(nfd, mtu, ip, gwip, 1);
406 ip->ip_p = IPPROTO_ICMP;
407 ip->ip_off = htons(IP_MF);
409 ip->ip_id = htons(id++);
411 ip->ip_len = 768 + 20 + 8;
412 (void) send_ip(nfd, mtu, ip, gwip, 1);
415 ip->ip_len = MIN(768 + 20, mtu - 68);
418 ip->ip_off = htons(IP_MF | (i >> 3));
419 (void) send_ip(nfd, mtu, ip, gwip, 1);
424 ip->ip_len = 896 + 20;
425 ip->ip_off = htons(i >> 3);
426 (void) send_ip(nfd, mtu, ip, gwip, 1);
432 ip->ip_len = len;
433 ip->ip_off = 0;
438 ip->ip_id = 0;
439 ip->ip_off = htons(0x8000);
441 (void) send_ip(nfd, mtu, ip, gwip, 1);
446 ip->ip_off = 0;
452 ip->ip_id = 0;
453 ip->ip_ttl = 255;
455 (void) send_ip(nfd, mtu, ip, gwip, 1);
459 ip->ip_ttl = 128;
461 (void) send_ip(nfd, mtu, ip, gwip, 1);
465 ip->ip_ttl = 0;
467 (void) send_ip(nfd, mtu, ip, gwip, 1);
476 void ip_test2(dev, mtu, ip, gwip, ptest)
479 ip_t *ip;
496 IP_HL_A(ip, 6);
497 ip->ip_len = IP_HL(ip) << 2;
498 s = (u_char *)(ip + 1);
509 ip->ip_p = IPPROTO_IP;
511 (void) send_ip(nfd, mtu, ip, gwip, 1);
516 IP_HL_A(ip, 7);
517 ip->ip_len = IP_HL(ip) << 2;
525 (void) send_ip(nfd, mtu, ip, gwip, 1);
532 (void) send_ip(nfd, mtu, ip, gwip, 1);
539 (void) send_ip(nfd, mtu, ip, gwip, 1);
546 (void) send_ip(nfd, mtu, ip, gwip, 1);
553 (void) send_ip(nfd, mtu, ip, gwip, 1);
560 (void) send_ip(nfd, mtu, ip, gwip, 1);
572 void ip_test3(dev, mtu, ip, gwip, ptest)
575 ip_t *ip;
589 IP_HL_A(ip, sizeof(*ip) >> 2);
590 IP_V_A(ip, IPVERSION);
591 ip->ip_tos = 0;
592 ip->ip_off = 0;
593 ip->ip_ttl = 60;
594 ip->ip_p = IPPROTO_ICMP;
595 ip->ip_sum = 0;
596 ip->ip_len = sizeof(*ip) + sizeof(*icp);
597 icp = (struct icmp *)((char *)ip + (IP_HL(ip) << 2));
610 (void) send_icmp(nfd, mtu, ip, gwip);
615 (void) send_icmp(nfd, mtu, ip, gwip);
628 (void) send_icmp(nfd, mtu, ip, gwip);
640 (void) send_icmp(nfd, mtu, ip, gwip);
644 (void) send_icmp(nfd, mtu, ip, gwip);
648 (void) send_icmp(nfd, mtu, ip, gwip);
652 (void) send_icmp(nfd, mtu, ip, gwip);
663 (void) send_icmp(nfd, mtu, ip, gwip);
667 (void) send_icmp(nfd, mtu, ip, gwip);
671 (void) send_icmp(nfd, mtu, ip, gwip);
675 (void) send_icmp(nfd, mtu, ip, gwip);
687 (void) send_icmp(nfd, mtu, ip, gwip);
692 (void) send_icmp(nfd, mtu, ip, gwip);
697 (void) send_icmp(nfd, mtu, ip, gwip);
702 (void) send_icmp(nfd, mtu, ip, gwip);
716 (void) send_icmp(nfd, mtu, ip, gwip);
720 (void) send_icmp(nfd, mtu, ip, gwip);
724 (void) send_icmp(nfd, mtu, ip, gwip);
728 (void) send_icmp(nfd, mtu, ip, gwip);
732 (void) send_icmp(nfd, mtu, ip, gwip);
742 ip->ip_len = sizeof(*ip) + sizeof(*icp) / 2;
746 (void) send_icmp(nfd, mtu, ip, gwip);
751 (void) send_icmp(nfd, mtu, ip, gwip);
756 (void) send_icmp(nfd, mtu, ip, gwip);
761 (void) send_icmp(nfd, mtu, ip, gwip);
773 void ip_test4(dev, mtu, ip, gwip, ptest)
776 ip_t *ip;
789 IP_HL_A(ip, sizeof(*ip) >> 2);
790 IP_V_A(ip, IPVERSION);
791 ip->ip_tos = 0;
792 ip->ip_off = 0;
793 ip->ip_ttl = 60;
794 ip->ip_p = IPPROTO_UDP;
795 ip->ip_sum = 0;
796 u = (udphdr_t *)((char *)ip + (IP_HL(ip) << 2));
810 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
814 (void) send_udp(nfd, 1500, ip, gwip);
827 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
830 ip->ip_len = i;
831 (void) send_udp(nfd, 1500, ip, gwip);
845 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
848 (void) send_udp(nfd, 1500, ip, gwip);
854 (void) send_udp(nfd, 1500, ip, gwip);
860 (void) send_udp(nfd, 1500, ip, gwip);
866 (void) send_udp(nfd, 1500, ip, gwip);
873 (void) send_udp(nfd, 1500, ip, gwip);
886 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
889 (void) send_udp(nfd, 1500, ip, gwip);
895 (void) send_udp(nfd, 1500, ip, gwip);
901 (void) send_udp(nfd, 1500, ip, gwip);
907 (void) send_udp(nfd, 1500, ip, gwip);
913 (void) send_udp(nfd, 1500, ip, gwip);
925 for (i = sizeof(*ip); i <= ntohs(u->uh_ulen); i++) {
926 (void) send_udp(nfd, i, ip, gwip);
938 void ip_test5(dev, mtu, ip, gwip, ptest)
941 ip_t *ip;
953 t = (tcphdr_t *)((char *)ip + (IP_HL(ip) << 2));
965 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
980 (void) send_tcp(nfd, mtu, ip, gwip);
996 (void) send_tcp(nfd, mtu, ip, gwip);
1002 (void) send_tcp(nfd, mtu, ip, gwip);
1008 (void) send_tcp(nfd, mtu, ip, gwip);
1014 (void) send_tcp(nfd, mtu, ip, gwip);
1020 (void) send_tcp(nfd, mtu, ip, gwip);
1026 (void) send_tcp(nfd, mtu, ip, gwip);
1039 (void) send_tcp(nfd, mtu, ip, gwip);
1045 (void) send_tcp(nfd, mtu, ip, gwip);
1051 (void) send_tcp(nfd, mtu, ip, gwip);
1057 (void) send_tcp(nfd, mtu, ip, gwip);
1063 (void) send_tcp(nfd, mtu, ip, gwip);
1069 (void) send_tcp(nfd, mtu, ip, gwip);
1081 (void) send_tcp(nfd, mtu, ip, gwip);
1087 (void) send_tcp(nfd, mtu, ip, gwip);
1093 (void) send_tcp(nfd, mtu, ip, gwip);
1112 sin.sin_addr.s_addr = ip->ip_dst.s_addr;
1123 inet_ntoa(ip->ip_dst));
1127 bcopy((char *)ip, (char *)&ti, sizeof(*ip));
1149 (void) send_tcp(nfd, mtu, ip, gwip);
1153 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t) + 1;
1155 (void) send_tcp(nfd, mtu, ip, gwip);
1158 (void) send_tcp(nfd, mtu, ip, gwip);
1161 (void) send_tcp(nfd, mtu, ip, gwip);
1165 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1176 (void) send_tcp(nfd, mtu, ip, gwip);
1182 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1201 (void) send_tcp(nfd, mtu, ip, gwip);
1207 (void) send_tcp(nfd, mtu, ip, gwip);
1213 (void) send_tcp(nfd, mtu, ip, gwip);
1219 (void) send_tcp(nfd, mtu, ip, gwip);
1225 (void) send_tcp(nfd, mtu, ip, gwip);
1239 (void) send_tcp(nfd, mtu, ip, gwip);
1245 (void) send_tcp(nfd, mtu, ip, gwip);
1251 (void) send_tcp(nfd, mtu, ip, gwip);
1257 (void) send_tcp(nfd, mtu, ip, gwip);
1263 (void) send_tcp(nfd, mtu, ip, gwip);
1268 /* LAND attack - self connect, so make src & dst ip/port the same */
1275 ip->ip_src = ip->ip_dst;
1276 (void) send_tcp(nfd, mtu, ip, gwip);
1288 void ip_test6(dev, mtu, ip, gwip, ptest)
1291 ip_t *ip;
1303 IP_V_A(ip, IPVERSION);
1304 ip->ip_tos = 0;
1305 ip->ip_off = 0;
1306 ip->ip_ttl = 60;
1307 ip->ip_p = IPPROTO_UDP;
1308 ip->ip_sum = 0;
1309 u = (udphdr_t *)(ip + 1);
1327 ip->ip_len = sizeof(*ip) + 768 + sizeof(*u);
1328 IP_HL_A(ip, sizeof(*ip) >> 2);
1329 ip->ip_off = htons(IP_MF);
1330 (void) send_ip(nfd, 1500, ip, gwip, 1);
1337 ip->ip_len = sizeof(*ip) + 128 + sizeof(*u);
1338 ip->ip_off = htons(IP_MF);
1339 (void) send_ip(nfd, 1500, ip, gwip, 1);
1345 ip->ip_len = sizeof(*ip) + 768;
1346 ip->ip_off = htons(IP_MF|(j>>3));
1347 (void) send_ip(nfd, 1500, ip, gwip, 1);
1352 ip->ip_len = sizeof(*ip) + 128;
1354 ip->ip_off = htons(IP_MF|(k>>3));
1355 (void) send_ip(nfd, 1500, ip, gwip, 1);
1370 void ip_test7(dev, mtu, ip, gwip, ptest)
1373 ip_t *ip;
1400 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,
1416 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,