/dports/net-mgmt/tcpreplay/tcpreplay-4.3.4/src/tcpedit/ |
H A D | edit_packet.c | 64 assert(ip_hdr); in fix_ipv4_checksums() 72 if (ip_hdr->ip_v != 4) { in fix_ipv4_checksums() 81 ret1 = do_checksum(tcpedit, (u_char *) ip_hdr, ip_hdr->ip_p, in fix_ipv4_checksums() 175 if (!ip_hdr->ip_len) in fix_ipv4_length() 262 assert(ip_hdr); in ipv4_addr_csum_replace() 388 assert(ip_hdr); in randomize_ipv4() 409 ipv4_addr_csum_replace(ip_hdr, old_ip, ip_hdr->ip_dst.s_addr, l3len); in randomize_ipv4() 416 ipv4_addr_csum_replace(ip_hdr, old_ip, ip_hdr->ip_src.s_addr, l3len); in randomize_ipv4() 521 if (ip_hdr) { in untrunc_packet() 759 assert(ip_hdr); in rewrite_ipv4l3() [all …]
|
H A D | edit_packet.h | 28 u_char **pktdata, ipv4_hdr_t *ip_hdr, ipv6_hdr_t *ip6_hdr); 31 u_char *pktdata, ipv4_hdr_t *ip_hdr, const int l3len); 34 u_char *pktdata, ipv6_hdr_t *ip_hdr, const int l3len); 40 ipv4_hdr_t *ip_hdr); 43 ipv6_hdr_t *ip_hdr); 45 void fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr); 52 int rewrite_ipv4l3(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr, tcpr_dir_t direction, 55 int rewrite_ipv6l3(tcpedit_t *tcpedit, ipv6_hdr_t *ip_hdr, tcpr_dir_t direction, 60 int rewrite_ipv4_ttl(tcpedit_t *tcpedit, ipv4_hdr_t *ip_hdr);
|
H A D | tcpedit.c | 87 ipv4_hdr_t *ip_hdr = NULL; in tcpedit_packet() local 166 if (ip_hdr == NULL) in tcpedit_packet() 201 ip_hdr = NULL; in tcpedit_packet() 206 if (ip_hdr != NULL) { in tcpedit_packet() 213 ip_hdr->ip_tos = tcpedit->tos; in tcpedit_packet() 214 newval = *((uint16_t*)ip_hdr); in tcpedit_packet() 293 if (ip_hdr != NULL) { in tcpedit_packet() 319 if (ip_hdr != NULL) { in tcpedit_packet() 347 if (ip_hdr != NULL) { in tcpedit_packet() 348 fix_ipv4_length(*pkthdr, ip_hdr); in tcpedit_packet() [all …]
|
/dports/net/libnet/libnet-1.1.6/src/ |
H A D | libnet_build_ip.c | 51 struct libnet_ipv4_hdr ip_hdr; in libnet_build_ipv4() local 70 memset(&ip_hdr, 0, sizeof(ip_hdr)); in libnet_build_ipv4() 255 struct libnet_ipv4_hdr ip_hdr; in libnet_autobuild_ipv4() local 281 memset(&ip_hdr, 0, sizeof(ip_hdr)); in libnet_autobuild_ipv4() 298 ip_hdr.ip_hl += j; in libnet_autobuild_ipv4() 404 ip_hdr->ip_len = htons(ntohs(ip_hdr->ip_len) + options_size_increase); in libnet_build_ipv4_options() 450 memset(&ip_hdr, 0, sizeof(ip_hdr)); in libnet_build_ipv6() 456 ip_hdr.ip_nh = nh; in libnet_build_ipv6() 457 ip_hdr.ip_hl = hl; in libnet_build_ipv6() 458 ip_hdr.ip_src = src; in libnet_build_ipv6() [all …]
|
H A D | libnet_write.c | 208 struct libnet_ipv4_hdr *ip_hdr = NULL; in libnet_win32_write_raw_ipv4() local 232 remoteip = ip_hdr->ip_dst.S_un.S_addr; in libnet_win32_write_raw_ipv4() 311 struct libnet_ipv4_hdr *ip_hdr; in libnet_write_raw_ipv4() local 318 ip_hdr = (struct libnet_ipv4_hdr *)packet; in libnet_write_raw_ipv4() 327 ip_hdr->ip_len = FIX(ip_hdr->ip_len); in libnet_write_raw_ipv4() 328 ip_hdr->ip_off = FIX(ip_hdr->ip_off); in libnet_write_raw_ipv4() 340 if (ip_hdr->ip_p == 6) in libnet_write_raw_ipv4() 351 else if (ip_hdr->ip_p == 17) in libnet_write_raw_ipv4() 363 ip_hdr->ip_len = UNFIX(ip_hdr->ip_len); in libnet_write_raw_ipv4() 364 ip_hdr->ip_off = UNFIX(ip_hdr->ip_off); in libnet_write_raw_ipv4() [all …]
|
/dports/security/fragrouter/fragrouter-1.6/Libnet-0.99b/src/ |
H A D | build_ip.c | 44 struct ip ip_hdr; in build_ip() local 48 ip_hdr.ip_v = 4; /* version 4 */ in build_ip() 49 ip_hdr.ip_hl = 5; /* 20 byte header */ in build_ip() 50 ip_hdr.ip_tos = tos; /* IP tos */ in build_ip() 51 ip_hdr.ip_len = htons(IP_H + len); /* total length */ in build_ip() 52 ip_hdr.ip_id = htons(id); /* IP ID */ in build_ip() 54 ip_hdr.ip_ttl = ttl; /* time to live */ in build_ip() 56 ip_hdr.ip_sum = 0; /* do this later */ in build_ip() 57 ip_hdr.ip_src.s_addr = src; in build_ip() 58 ip_hdr.ip_dst.s_addr = dst; in build_ip() [all …]
|
H A D | write_ip.c | 44 struct ip *ip_hdr; in write_ip() local 50 ip_hdr = (struct ip *)buf; in write_ip() 60 ip_hdr->ip_len = FIX(ip_hdr->ip_len); in write_ip() 61 ip_hdr->ip_off = FIX(ip_hdr->ip_off); in write_ip() 66 sin.sin_addr.s_addr = ip_hdr->ip_dst.s_addr; in write_ip() 77 ip_hdr->ip_len = UNFIX(ip_hdr->ip_len); in write_ip() 78 ip_hdr->ip_off = UNFIX(ip_hdr->ip_off); in write_ip() 119 struct ip *ip_hdr; in write_ip_via_datalink() local 122 ip_hdr = (struct ip *)(buf); in write_ip_via_datalink() 123 dest_ip = ip_hdr->ip_dst.s_addr; in write_ip_via_datalink() [all …]
|
/dports/net/thcrut/thcrut-1.2.5/Libnet-1.0.2a/src/ |
H A D | libnet_build_ip.c | 54 struct libnet_ip_hdr ip_hdr; in libnet_build_ip() local 61 ip_hdr.ip_v = 4; /* version 4 */ in libnet_build_ip() 62 ip_hdr.ip_hl = 5; /* 20 byte header */ in libnet_build_ip() 63 ip_hdr.ip_tos = tos; /* IP tos */ in libnet_build_ip() 64 ip_hdr.ip_len = htons(LIBNET_IP_H + len); /* total length */ in libnet_build_ip() 65 ip_hdr.ip_id = htons(id); /* IP ID */ in libnet_build_ip() 67 ip_hdr.ip_ttl = ttl; /* time to live */ in libnet_build_ip() 69 ip_hdr.ip_sum = 0; /* do this later */ in libnet_build_ip() 70 ip_hdr.ip_src.s_addr = src; in libnet_build_ip() 71 ip_hdr.ip_dst.s_addr = dst; in libnet_build_ip() [all …]
|
H A D | libnet_write_ip.c | 43 struct libnet_ip_hdr *ip_hdr; in libnet_write_ip() local 45 ip_hdr = (struct libnet_ip_hdr *)buf; in libnet_write_ip() 55 ip_hdr->ip_len = FIX(ip_hdr->ip_len); in libnet_write_ip() 56 ip_hdr->ip_off = FIX(ip_hdr->ip_off); in libnet_write_ip() 61 sin.sin_addr.s_addr = ip_hdr->ip_dst.s_addr; in libnet_write_ip() 67 ip_hdr->ip_len = UNFIX(ip_hdr->ip_len); in libnet_write_ip() 68 ip_hdr->ip_off = UNFIX(ip_hdr->ip_off); in libnet_write_ip()
|
H A D | libnet_insert_ipo.c | 41 struct libnet_ip_hdr *ip_hdr; in libnet_insert_ipo() local 51 ip_hdr = (struct libnet_ip_hdr *)(buf); in libnet_insert_ipo() 52 s = UNFIX(ip_hdr->ip_len); in libnet_insert_ipo() 74 memmove((u_char *)ip_hdr + LIBNET_IP_H + opt_len, (u_char *)ip_hdr in libnet_insert_ipo() 82 p = (u_char *)ip_hdr + LIBNET_IP_H; in libnet_insert_ipo() 91 ip_hdr->ip_hl += j; in libnet_insert_ipo() 92 ip_hdr->ip_len = FIX(opt_len + s); in libnet_insert_ipo()
|
H A D | libnet_insert_tcpo.c | 41 struct libnet_ip_hdr *ip_hdr; in libnet_insert_tcpo() local 53 ip_hdr = (struct libnet_ip_hdr *)(buf); in libnet_insert_tcpo() 55 if (ip_hdr->ip_p != IPPROTO_TCP) in libnet_insert_tcpo() 79 s = ntohs(ip_hdr->ip_len); in libnet_insert_tcpo() 110 tcp_hdr = (struct libnet_tcp_hdr *)(buf + (ip_hdr->ip_hl << 2)); in libnet_insert_tcpo() 116 if (s > (ip_hdr->ip_hl << 2) + LIBNET_TCP_H) in libnet_insert_tcpo() 123 (s - (ip_hdr->ip_hl << 2) - LIBNET_TCP_H)); in libnet_insert_tcpo() 142 ip_hdr->ip_len = htons(opt_padded_len + s); in libnet_insert_tcpo()
|
/dports/benchmarks/spp/caia-swin-spp-8cfe6814ce52/src/ |
H A D | instance.c | 253 u_char * transport_hdr = ((u_char *)ip_hdr + (ip_hdr->ip_hl * 4)); in getHash() 259 memcpy((void*)(hash_data + hash_offset), (void*)&ip_hdr->ip_src, sizeof(ip_hdr->ip_src)); in getHash() 263 memcpy((void*)(hash_data + hash_offset), (void*)&ip_hdr->ip_dst, sizeof(ip_hdr->ip_dst)); in getHash() 268 memcpy((void*)(hash_data + hash_offset), (void*)&ip_hdr->ip_p, sizeof(ip_hdr->ip_p)); in getHash() 272 memcpy((void*)(hash_data + hash_offset), (void*)&ip_hdr->ip_id, sizeof(ip_hdr->ip_id)); in getHash() 277 if(ip_hdr->ip_p == 6 || ip_hdr->ip_p == 17) { //We have a TCP or UDP packet in getHash() 389 struct ip * ip_hdr; in createInstance() local 440 if(ip_hdr->ip_v != 4){ in createInstance() 446 if(ip_hdr->ip_len == 0){ in createInstance() 458 src_addr = ip_hdr->ip_src.s_addr; in createInstance() [all …]
|
/dports/comms/uhd/uhd-90ce6062b6b5df2eddeee723777be85108e4e7c7/host/lib/include/uhdlib/transport/dpdk/ |
H A D | udp.hpp | 50 ip_hdr->version_ihl = 0x40 | 5; in fill_ipv4_hdr() 51 ip_hdr->type_of_service = 0; in fill_ipv4_hdr() 53 ip_hdr->packet_id = 0; in fill_ipv4_hdr() 55 ip_hdr->time_to_live = 64; in fill_ipv4_hdr() 56 ip_hdr->next_proto_id = proto_id; in fill_ipv4_hdr() 57 ip_hdr->hdr_checksum = 0; // Require HW offload in fill_ipv4_hdr() 58 ip_hdr->src_addr = port->get_ipv4(); in fill_ipv4_hdr() 59 ip_hdr->dst_addr = dst_ipv4_addr; in fill_ipv4_hdr() 77 struct ipv4_hdr* ip_hdr; in fill_udp_hdr() local 84 ip_hdr = (struct ipv4_hdr*)ð_hdr[1]; in fill_udp_hdr() [all …]
|
/dports/net/ipdecap/ipdecap-0.7.2/src/ |
H A D | ipdecap.c | 208 const struct ip *ip_hdr = NULL; in process_ipip_packet() local 224 (ip_hdr->ip_hl *4), ntohs(ip_hdr->ip_len), ip_hdr->ip_p); in process_ipip_packet() 227 ip_hl = ip_hdr->ip_hl; in process_ipip_packet() 238 (ip_hdr->ip_hl *4), ntohs(ip_hdr->ip_len), ip_hdr->ip_p); in process_ipip_packet() 258 const struct ip *ip_hdr = NULL; in process_ipv6_packet() local 281 (ip_hdr->ip_hl *4), ntohs(ip_hdr->ip_len), ip_hdr->ip_p); in process_ipv6_packet() 302 const struct ip *ip_hdr = NULL; in process_gre_packet() local 319 (ip_hdr->ip_hl *4), ntohs(ip_hdr->ip_len), ip_hdr->ip_p); in process_gre_packet() 321 packet_size += ntohs(ip_hdr->ip_len) - ip_hdr->ip_hl*4; in process_gre_packet() 361 const struct ip *ip_hdr = NULL; in handle_packets() local [all …]
|
/dports/net-mgmt/tcpreplay/tcpreplay-4.3.4/src/common/ |
H A D | xX.c | 118 process_xX_by_cidr_ipv4(int mode, tcpr_cidr_t * cidr, ipv4_hdr_t * ip_hdr) in process_xX_by_cidr_ipv4() argument 128 return check_ip_cidr(cidr, ip_hdr->ip_src.s_addr) ? DONT_SEND : SEND; in process_xX_by_cidr_ipv4() 132 return check_ip_cidr(cidr, ip_hdr->ip_dst.s_addr) ? DONT_SEND : SEND; in process_xX_by_cidr_ipv4() 135 return (check_ip_cidr(cidr, ip_hdr->ip_dst.s_addr) && in process_xX_by_cidr_ipv4() 136 check_ip_cidr(cidr, ip_hdr->ip_src.s_addr) ) ? DONT_SEND : SEND; in process_xX_by_cidr_ipv4() 140 return (check_ip_cidr(cidr, ip_hdr->ip_dst.s_addr) || in process_xX_by_cidr_ipv4() 141 check_ip_cidr(cidr, ip_hdr->ip_src.s_addr) ) ? DONT_SEND : SEND; in process_xX_by_cidr_ipv4() 149 return check_ip_cidr(cidr, ip_hdr->ip_src.s_addr) ? SEND : DONT_SEND; in process_xX_by_cidr_ipv4() 153 return check_ip_cidr(cidr, ip_hdr->ip_dst.s_addr) ? SEND : DONT_SEND; in process_xX_by_cidr_ipv4() 157 return (check_ip_cidr(cidr, ip_hdr->ip_dst.s_addr) && in process_xX_by_cidr_ipv4() [all …]
|
/dports/net-mgmt/tcpreplay/tcpreplay-4.3.4/src/ |
H A D | tcpprep.c | 213 if (ip_hdr) { in check_dst_port() 217 proto = ip_hdr->ip_p; in check_dst_port() 396 if (ip_hdr) { in process_raw_packets() 413 if (ip_hdr) { in process_raw_packets() 428 if (ip_hdr) { in process_raw_packets() 462 if (ip_hdr) { in process_raw_packets() 482 if (ip_hdr) { in process_raw_packets() 497 if (ip_hdr) { in process_raw_packets() 512 if (ip_hdr) { in process_raw_packets() 527 if (ip_hdr) { in process_raw_packets() [all …]
|
/dports/net/frr7-pythontools/frr-frr-7.5.1/pimd/ |
H A D | pim_igmp_mtrace.c | 390 checksum = ip_hdr->ip_sum; in mtrace_un_forward_packet() 392 ip_hdr->ip_sum = 0; in mtrace_un_forward_packet() 394 if (checksum != in_cksum(ip_hdr, ip_hdr->ip_hl * 4)) in mtrace_un_forward_packet() 397 if (ip_hdr->ip_ttl-- <= 1) in mtrace_un_forward_packet() 400 ip_hdr->ip_sum = in_cksum(ip_hdr, ip_hdr->ip_hl * 4); in mtrace_un_forward_packet() 436 sent = sendto(fd, ip_hdr, ntohs(ip_hdr->ip_len), 0, in mtrace_un_forward_packet() 451 ntohs(ip_hdr->ip_len), inet_ntoa(ip_hdr->ip_dst), in mtrace_un_forward_packet() 452 ip_hdr->ip_ttl); in mtrace_un_forward_packet() 468 sg.grp = ip_hdr->ip_dst; in mtrace_mc_forward_packet() 476 ntohs(ip_hdr->ip_len), in mtrace_mc_forward_packet() [all …]
|
/dports/net/frr7/frr-frr-7.5.1/pimd/ |
H A D | pim_igmp_mtrace.c | 390 checksum = ip_hdr->ip_sum; in mtrace_un_forward_packet() 392 ip_hdr->ip_sum = 0; in mtrace_un_forward_packet() 394 if (checksum != in_cksum(ip_hdr, ip_hdr->ip_hl * 4)) in mtrace_un_forward_packet() 397 if (ip_hdr->ip_ttl-- <= 1) in mtrace_un_forward_packet() 400 ip_hdr->ip_sum = in_cksum(ip_hdr, ip_hdr->ip_hl * 4); in mtrace_un_forward_packet() 436 sent = sendto(fd, ip_hdr, ntohs(ip_hdr->ip_len), 0, in mtrace_un_forward_packet() 451 ntohs(ip_hdr->ip_len), inet_ntoa(ip_hdr->ip_dst), in mtrace_un_forward_packet() 452 ip_hdr->ip_ttl); in mtrace_un_forward_packet() 468 sg.grp = ip_hdr->ip_dst; in mtrace_mc_forward_packet() 476 ntohs(ip_hdr->ip_len), in mtrace_mc_forward_packet() [all …]
|
/dports/net/honeyd/honeyd-1.5c/ |
H A D | condition.h | 37 struct ip_hdr; 44 int (*match)(const struct template *, const struct ip_hdr *, u_short, void *); 57 int condition_match_osfp(const struct template *, const struct ip_hdr *, u_short, void *); 58 int condition_match_addr(const struct template *, const struct ip_hdr *, u_short, void *); 59 int condition_match_time(const struct template *, const struct ip_hdr *, u_short, void *); 60 int condition_match_proto(const struct template *, const struct ip_hdr *, u_short, void *); 61 int condition_match_otherwise(const struct template *, const struct ip_hdr *, u_short, void *);
|
H A D | gre.c | 70 gre_decapsulate(struct ip_hdr *oip, u_short oiplen, in gre_decapsulate() 71 struct ip_hdr **pip, u_short *piplen) in gre_decapsulate() 74 struct ip_hdr *ip; in gre_decapsulate() 106 ip = (struct ip_hdr *)data; in gre_decapsulate() 107 if (data + sizeof(struct ip_hdr) > end) in gre_decapsulate() 136 struct ip_hdr *iip, u_int iiplen) in gre_encapsulate() 138 struct ip_hdr *oip = (struct ip_hdr *)pkt; in gre_encapsulate() 143 iplen = sizeof(struct ip_hdr) + sizeof(struct gre_hdr) + iiplen; in gre_encapsulate()
|
/dports/benchmarks/stress-ng/stress-ng-0.13.09/ |
H A D | stress-icmp-flood.c | 96 struct iphdr *const ip_hdr = (struct iphdr *)pkt; in stress_icmp_flood() local 101 ip_hdr->version = 4; in stress_icmp_flood() 102 ip_hdr->ihl = 5; in stress_icmp_flood() 103 ip_hdr->tos = 0; in stress_icmp_flood() 104 ip_hdr->tot_len = htons(pkt_len); in stress_icmp_flood() 105 ip_hdr->id = stress_mwc16(); in stress_icmp_flood() 106 ip_hdr->frag_off = 0; in stress_icmp_flood() 107 ip_hdr->ttl = 64; in stress_icmp_flood() 108 ip_hdr->protocol = IPPROTO_ICMP; in stress_icmp_flood() 109 ip_hdr->saddr = (in_addr_t)addr; in stress_icmp_flood() [all …]
|
/dports/net-mgmt/flow-tools/flow-tools-2ca53f5/src/ |
H A D | flow-send.c | 59 struct ip *ip_hdr, struct udphdr *udp_hdr, 65 struct ip *ip_hdr; in main() local 233 ip_hdr = (struct ip*)&fte.buf; in main() 236 ip_hdr->ip_hl = 5; in main() 237 ip_hdr->ip_v = 4; in main() 238 ip_hdr->ip_p = 17; /* UDP */ in main() 326 struct ip *ip_hdr, struct udphdr *udp_hdr, in pdu_xmit() argument 346 ip_hdr->ip_len = FT_ENC_IPHDR_LEN+fte->buf_size; in pdu_xmit() 348 ip_hdr->ip_ttl = ftpi->ttl; in pdu_xmit() 349 ip_hdr->ip_src.s_addr = htonl(ftpi->loc_ip); in pdu_xmit() [all …]
|
/dports/net/bittwist/bittwist-1.1/src/ |
H A D | bittwiste.c | 1111 free(ip_hdr); ip_hdr = NULL; in parse_ip() 1240 ip_hdr->ip_sum = htons(cksum((u_char *)ip_hdr, ip_hlb)); in parse_ip() 1314 free(ip_hdr); ip_hdr = NULL; in parse_ip() 1332 free(ip_hdr); ip_hdr = NULL; in parse_ip() 1360 free(ip_hdr); ip_hdr = NULL; in parse_icmp() 1524 free(ip_hdr); ip_hdr = NULL; in parse_icmp() 1589 free(ip_hdr); ip_hdr = NULL; in parse_tcp() 1641 free(ip_hdr); ip_hdr = NULL; in parse_tcp() 1852 free(ip_hdr); ip_hdr = NULL; in parse_tcp() 1922 free(ip_hdr); ip_hdr = NULL; in parse_udp() [all …]
|
/dports/net/zmap/zmap-2.1.1/src/probe_modules/ |
H A D | module_icmp_echo.c | 90 static int icmp_validate_packet(const struct ip *ip_hdr, in icmp_validate_packet() argument 93 if (ip_hdr->ip_p != IPPROTO_ICMP) { in icmp_validate_packet() 97 if (((uint32_t) 4 * ip_hdr->ip_hl + ICMP_SMALLEST_SIZE) > len) { in icmp_validate_packet() 102 struct icmp *icmp_h = (struct icmp *) ((char *) ip_hdr + 4*ip_hdr->ip_hl); in icmp_validate_packet() 111 if ((4*ip_hdr->ip_hl + ICMP_TIMXCEED_UNREACH_HEADER_SIZE + in icmp_validate_packet() 117 if (((uint32_t) 4 * ip_hdr->ip_hl + ICMP_TIMXCEED_UNREACH_HEADER_SIZE + in icmp_validate_packet() 122 struct icmp *icmp_inner = (struct icmp *)((char *) ip_inner + 4*ip_hdr->ip_hl); in icmp_validate_packet() 127 validate_gen(ip_hdr->ip_dst.s_addr, ip_inner->ip_dst.s_addr, in icmp_validate_packet() 141 struct ip *ip_hdr = (struct ip *) &packet[sizeof(struct ether_header)]; in icmp_echo_process_packet() local 142 struct icmp *icmp_hdr = (struct icmp *) ((char *) ip_hdr + 4*ip_hdr->ip_hl); in icmp_echo_process_packet()
|
/dports/net/tcptraceroute/tcptraceroute-tcptraceroute-1.5beta7/ |
H A D | capture.c | 100 struct libnet_ipv4_hdr *ip_hdr; in capture() local 194 if (ip_hdr->ip_v != 4) in capture() 200 if (ip_hdr->ip_hl > 5) in capture() 206 if (ip_hdr->ip_dst.s_addr != src_ip) in capture() 216 if (ip_hdr->ip_p == IPPROTO_ICMP) in capture() 357 record->addr = ip_hdr->ip_src.s_addr; in capture() 387 record->addr = ip_hdr->ip_src.s_addr; in capture() 396 record->addr = ip_hdr->ip_src.s_addr; in capture() 404 if (ip_hdr->ip_p == IPPROTO_TCP) in capture() 409 if (ip_hdr->ip_src.s_addr != dst_ip) in capture() [all …]
|