• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/ipfilter/ipsend/

Lines Matching refs:ip

69 #include <netinet/ip.h>
98 void ip_test1(dev, mtu, ip, gwip, ptest)
101 ip_t *ip;
113 IP_HL_A(ip, sizeof(*ip) >> 2);
114 IP_V_A(ip, IPVERSION);
115 ip->ip_tos = 0;
116 ip->ip_off = 0;
117 ip->ip_ttl = 60;
118 ip->ip_p = IPPROTO_UDP;
119 ip->ip_sum = 0;
120 u = (udphdr_t *)(ip + 1);
125 ip->ip_len = sizeof(*ip) + ntohs(u->uh_ulen);
126 len = ip->ip_len;
136 ip->ip_id = 0;
138 for (i = 0; i < ((sizeof(*ip) + ntohs(u->uh_ulen)) >> 2); i++) {
139 IP_HL_A(ip, i >> 2);
140 (void) send_ip(nfd, 1500, ip, gwip, 1);
152 ip->ip_id = 0;
154 for (; i < ((sizeof(*ip) * 2 + ntohs(u->uh_ulen)) >> 2); i++) {
155 IP_HL_A(ip, i >> 2);
156 (void) send_ip(nfd, 1500, ip, gwip, 1);
168 ip->ip_id = 0;
170 IP_HL_A(ip, sizeof(*ip) >> 2);
172 IP_V_A(ip, i);
173 (void) send_ip(nfd, 1500, ip, gwip, 1);
185 ip->ip_id = 0;
188 IP_V_A(ip, i);
189 (void) send_ip(nfd, 1500, ip, gwip, 1);
201 ip->ip_id = 0;
202 IP_V_A(ip, IPVERSION);
203 i = ip->ip_len + 1;
205 for (; i < (ip->ip_len * 2); i++) {
206 ip->ip_id = htons(id++);
207 ip->ip_sum = 0;
208 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
209 (void) send_ether(nfd, (char *)ip, i, gwip);
217 ip->ip_id = htons(id++);
218 ip->ip_len = i;
219 ip->ip_sum = 0;
220 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
221 (void) send_ether(nfd, (char *)ip, len, gwip);
233 ip->ip_id = 0;
236 ip->ip_id = htons(id++);
237 ip->ip_len = i;
238 ip->ip_sum = 0;
239 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
240 (void) send_ether(nfd, (char *)ip, len, gwip);
246 ip->ip_len = len;
249 ip->ip_id = htons(id++);
250 ip->ip_sum = 0;
251 ip->ip_sum = chksum((u_short *)ip, IP_HL(ip) << 2);
252 (void) send_ether(nfd, (char *)ip, i, gwip);
265 ip->ip_id = 0;
266 ip->ip_len = sizeof(*ip);
267 ip->ip_off = htons(IP_MF);
268 (void) send_ip(nfd, mtu, ip, gwip, 1);
273 ip->ip_id = 0;
274 ip->ip_len = sizeof(*ip);
275 ip->ip_off = htons(IP_MF);
276 (void) send_ip(nfd, mtu, ip, gwip, 1);
281 ip->ip_id = 0;
282 ip->ip_len = sizeof(*ip);
283 ip->ip_off = htons(0xa000);
284 (void) send_ip(nfd, mtu, ip, gwip, 1);
289 ip->ip_id = 0;
290 ip->ip_len = sizeof(*ip);
291 ip->ip_off = htons(0x0100);
292 (void) send_ip(nfd, mtu, ip, gwip, 1);
308 ip->ip_p = IPPROTO_ICMP;
309 ip->ip_off = htons(IP_MF);
311 ip->ip_id = htons(id++);
313 ip->ip_len = 768 + 20 + 8;
314 (void) send_ip(nfd, mtu, ip, gwip, 1);
317 ip->ip_len = MIN(768 + 20, mtu - 68);
320 ip->ip_off = htons(IP_MF | (i >> 3));
321 (void) send_ip(nfd, mtu, ip, gwip, 1);
326 ip->ip_len = 896 + 20;
327 ip->ip_off = htons(i >> 3);
328 (void) send_ip(nfd, mtu, ip, gwip, 1);
339 ip->ip_p = IPPROTO_ICMP;
340 ip->ip_off = htons(IP_MF);
342 ip->ip_id = htons(id++);
344 ip->ip_len = 768 + 20 + 8;
346 (void) send_ip(nfd, mtu, ip, gwip, 1);
351 ip->ip_len = MIN(768 + 20, mtu - 68);
354 ip->ip_off = htons(IP_MF | (i >> 3));
356 (void) send_ip(nfd, mtu, ip, gwip, 1);
363 ip->ip_len = 896 + 20;
364 ip->ip_off = htons(i >> 3);
366 (void) send_ip(nfd, mtu, ip, gwip, 1);
379 ip->ip_p = IPPROTO_ICMP;
380 ip->ip_off = htons(IP_MF);
382 ip->ip_id = htons(id++);
384 ip->ip_len = 768 + 20 + 8;
385 (void) send_ip(nfd, mtu, ip, gwip, 1);
388 ip->ip_len = MIN(768 + 20, mtu - 68);
391 ip->ip_off = htons(IP_MF | (i >> 3));
392 (void) send_ip(nfd, mtu, ip, gwip, 1);
397 ip->ip_len = 896 + 20;
398 ip->ip_off = htons(i >> 3);
399 (void) send_ip(nfd, mtu, ip, gwip, 1);
405 ip->ip_len = len;
406 ip->ip_off = 0;
411 ip->ip_id = 0;
412 ip->ip_off = htons(0x8000);
414 (void) send_ip(nfd, mtu, ip, gwip, 1);
419 ip->ip_off = 0;
425 ip->ip_id = 0;
426 ip->ip_ttl = 255;
428 (void) send_ip(nfd, mtu, ip, gwip, 1);
432 ip->ip_ttl = 128;
434 (void) send_ip(nfd, mtu, ip, gwip, 1);
438 ip->ip_ttl = 0;
440 (void) send_ip(nfd, mtu, ip, gwip, 1);
449 void ip_test2(dev, mtu, ip, gwip, ptest)
452 ip_t *ip;
469 IP_HL_A(ip, 6);
470 ip->ip_len = IP_HL(ip) << 2;
471 s = (u_char *)(ip + 1);
482 ip->ip_p = IPPROTO_IP;
484 (void) send_ip(nfd, mtu, ip, gwip, 1);
489 IP_HL_A(ip, 7);
490 ip->ip_len = IP_HL(ip) << 2;
498 (void) send_ip(nfd, mtu, ip, gwip, 1);
505 (void) send_ip(nfd, mtu, ip, gwip, 1);
512 (void) send_ip(nfd, mtu, ip, gwip, 1);
519 (void) send_ip(nfd, mtu, ip, gwip, 1);
526 (void) send_ip(nfd, mtu, ip, gwip, 1);
533 (void) send_ip(nfd, mtu, ip, gwip, 1);
545 void ip_test3(dev, mtu, ip, gwip, ptest)
548 ip_t *ip;
562 IP_HL_A(ip, sizeof(*ip) >> 2);
563 IP_V_A(ip, IPVERSION);
564 ip->ip_tos = 0;
565 ip->ip_off = 0;
566 ip->ip_ttl = 60;
567 ip->ip_p = IPPROTO_ICMP;
568 ip->ip_sum = 0;
569 ip->ip_len = sizeof(*ip) + sizeof(*icp);
570 icp = (struct icmp *)((char *)ip + (IP_HL(ip) << 2));
583 (void) send_icmp(nfd, mtu, ip, gwip);
588 (void) send_icmp(nfd, mtu, ip, gwip);
601 (void) send_icmp(nfd, mtu, ip, gwip);
613 (void) send_icmp(nfd, mtu, ip, gwip);
617 (void) send_icmp(nfd, mtu, ip, gwip);
621 (void) send_icmp(nfd, mtu, ip, gwip);
625 (void) send_icmp(nfd, mtu, ip, gwip);
636 (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);
660 (void) send_icmp(nfd, mtu, ip, gwip);
665 (void) send_icmp(nfd, mtu, ip, gwip);
670 (void) send_icmp(nfd, mtu, ip, gwip);
675 (void) send_icmp(nfd, mtu, ip, gwip);
689 (void) send_icmp(nfd, mtu, ip, gwip);
693 (void) send_icmp(nfd, mtu, ip, gwip);
697 (void) send_icmp(nfd, mtu, ip, gwip);
701 (void) send_icmp(nfd, mtu, ip, gwip);
705 (void) send_icmp(nfd, mtu, ip, gwip);
715 ip->ip_len = sizeof(*ip) + sizeof(*icp) / 2;
719 (void) send_icmp(nfd, mtu, ip, gwip);
724 (void) send_icmp(nfd, mtu, ip, gwip);
729 (void) send_icmp(nfd, mtu, ip, gwip);
734 (void) send_icmp(nfd, mtu, ip, gwip);
746 void ip_test4(dev, mtu, ip, gwip, ptest)
749 ip_t *ip;
762 IP_HL_A(ip, sizeof(*ip) >> 2);
763 IP_V_A(ip, IPVERSION);
764 ip->ip_tos = 0;
765 ip->ip_off = 0;
766 ip->ip_ttl = 60;
767 ip->ip_p = IPPROTO_UDP;
768 ip->ip_sum = 0;
769 u = (udphdr_t *)((char *)ip + (IP_HL(ip) << 2));
783 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
787 (void) send_udp(nfd, 1500, ip, gwip);
800 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
803 ip->ip_len = i;
804 (void) send_udp(nfd, 1500, ip, gwip);
818 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
821 (void) send_udp(nfd, 1500, ip, gwip);
827 (void) send_udp(nfd, 1500, ip, gwip);
833 (void) send_udp(nfd, 1500, ip, gwip);
839 (void) send_udp(nfd, 1500, ip, gwip);
846 (void) send_udp(nfd, 1500, ip, gwip);
859 ip->ip_len = (IP_HL(ip) << 2) + ntohs(u->uh_ulen);
862 (void) send_udp(nfd, 1500, ip, gwip);
868 (void) send_udp(nfd, 1500, ip, gwip);
874 (void) send_udp(nfd, 1500, ip, gwip);
880 (void) send_udp(nfd, 1500, ip, gwip);
886 (void) send_udp(nfd, 1500, ip, gwip);
898 for (i = sizeof(*ip); i <= ntohs(u->uh_ulen); i++) {
899 (void) send_udp(nfd, i, ip, gwip);
911 void ip_test5(dev, mtu, ip, gwip, ptest)
914 ip_t *ip;
926 t = (tcphdr_t *)((char *)ip + (IP_HL(ip) << 2));
936 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
951 (void) send_tcp(nfd, mtu, ip, gwip);
967 (void) send_tcp(nfd, mtu, ip, gwip);
973 (void) send_tcp(nfd, mtu, ip, gwip);
979 (void) send_tcp(nfd, mtu, ip, gwip);
985 (void) send_tcp(nfd, mtu, ip, gwip);
991 (void) send_tcp(nfd, mtu, ip, gwip);
997 (void) send_tcp(nfd, mtu, ip, gwip);
1010 (void) send_tcp(nfd, mtu, ip, gwip);
1016 (void) send_tcp(nfd, mtu, ip, gwip);
1022 (void) send_tcp(nfd, mtu, ip, gwip);
1028 (void) send_tcp(nfd, mtu, ip, gwip);
1034 (void) send_tcp(nfd, mtu, ip, gwip);
1040 (void) send_tcp(nfd, mtu, ip, gwip);
1052 (void) send_tcp(nfd, mtu, ip, gwip);
1058 (void) send_tcp(nfd, mtu, ip, gwip);
1064 (void) send_tcp(nfd, mtu, ip, gwip);
1083 sin.sin_addr.s_addr = ip->ip_dst.s_addr;
1094 inet_ntoa(ip->ip_dst));
1098 bcopy((char *)ip, (char *)&ti, sizeof(*ip));
1120 (void) send_tcp(nfd, mtu, ip, gwip);
1124 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t) + 1;
1126 (void) send_tcp(nfd, mtu, ip, gwip);
1129 (void) send_tcp(nfd, mtu, ip, gwip);
1132 (void) send_tcp(nfd, mtu, ip, gwip);
1136 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1147 (void) send_tcp(nfd, mtu, ip, gwip);
1153 ip->ip_len = sizeof(ip_t) + sizeof(tcphdr_t);
1172 (void) send_tcp(nfd, mtu, ip, gwip);
1178 (void) send_tcp(nfd, mtu, ip, gwip);
1184 (void) send_tcp(nfd, mtu, ip, gwip);
1190 (void) send_tcp(nfd, mtu, ip, gwip);
1196 (void) send_tcp(nfd, mtu, ip, gwip);
1210 (void) send_tcp(nfd, mtu, ip, gwip);
1216 (void) send_tcp(nfd, mtu, ip, gwip);
1222 (void) send_tcp(nfd, mtu, ip, gwip);
1228 (void) send_tcp(nfd, mtu, ip, gwip);
1234 (void) send_tcp(nfd, mtu, ip, gwip);
1239 /* LAND attack - self connect, so make src & dst ip/port the same */
1246 ip->ip_src = ip->ip_dst;
1247 (void) send_tcp(nfd, mtu, ip, gwip);
1259 void ip_test6(dev, mtu, ip, gwip, ptest)
1262 ip_t *ip;
1274 IP_V_A(ip, IPVERSION);
1275 ip->ip_tos = 0;
1276 ip->ip_off = 0;
1277 ip->ip_ttl = 60;
1278 ip->ip_p = IPPROTO_UDP;
1279 ip->ip_sum = 0;
1280 u = (udphdr_t *)(ip + 1);
1298 ip->ip_len = sizeof(*ip) + 768 + sizeof(*u);
1299 IP_HL_A(ip, sizeof(*ip) >> 2);
1300 ip->ip_off = htons(IP_MF);
1301 (void) send_ip(nfd, 1500, ip, gwip, 1);
1308 ip->ip_len = sizeof(*ip) + 128 + sizeof(*u);
1309 ip->ip_off = htons(IP_MF);
1310 (void) send_ip(nfd, 1500, ip, gwip, 1);
1316 ip->ip_len = sizeof(*ip) + 768;
1317 ip->ip_off = htons(IP_MF|(j>>3));
1318 (void) send_ip(nfd, 1500, ip, gwip, 1);
1323 ip->ip_len = sizeof(*ip) + 128;
1325 ip->ip_off = htons(IP_MF|(k>>3));
1326 (void) send_ip(nfd, 1500, ip, gwip, 1);
1341 void ip_test7(dev, mtu, ip, gwip, ptest)
1344 ip_t *ip;
1371 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,
1387 bcopy((char *)&ip->ip_dst, (char *)&pip->ip_dst,