/linux-master/tools/testing/selftests/bpf/progs/ |
H A D | decap_sanity.c | 36 struct udphdr udph; local 48 if (bpf_skb_load_bytes(skb, ETH_HLEN + sizeof(ip6h), &udph, sizeof(udph))) 51 if (udph.dest != __bpf_constant_htons(UDP_TEST_PORT)) 56 err = bpf_skb_adjust_room(skb, -(s32)(ETH_HLEN + sizeof(ip6h) + sizeof(udph)),
|
H A D | test_tc_tunnel.c | 605 struct udphdr udph; local 645 if (bpf_skb_load_bytes(skb, off + len, &udph, sizeof(udph)) < 0) 647 switch (bpf_ntohs(udph.dest)) {
|
H A D | test_cls_redirect_dynptr.c | 733 struct udphdr udph; local 738 if (bpf_dynptr_read(&udph, sizeof(udph), dynptr, *offset, 0)) { 742 *offset += sizeof(udph); 744 tuplen = fill_tuple(&tuple, info->hdr, info->len, udph.source, udph.dest);
|
/linux-master/net/netfilter/ipvs/ |
H A D | ip_vs_proto_udp.c | 139 struct udphdr *udph; local 151 if (skb_ensure_writable(skb, udphoff + sizeof(*udph))) 173 udph = (void *)skb_network_header(skb) + udphoff; 174 udph->source = cp->vport; 180 udp_partial_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, 183 } else if (!payload_csum && (udph->check != 0)) { 185 udp_fast_csum_update(cp->af, udph, &cp->daddr, &cp->vaddr, 192 udph->check = 0; 196 udph->check = csum_ipv6_magic(&cp->vaddr.in6, 202 udph 222 struct udphdr *udph; local [all...] |
/linux-master/tools/testing/selftests/net/ |
H A D | txring_overwrite.c | 43 struct udphdr *udph; local 65 udph = buffer + off; 66 udph->dest = htons(8000); 67 udph->source = htons(8001); 68 udph->len = htons(blen - off); 69 udph->check = 0; 71 off += sizeof(*udph);
|
H A D | psock_snd.c | 137 struct udphdr *udph = header; local 138 int len = sizeof(*udph) + payload_len; 140 udph->source = htons(9); 141 udph->dest = htons(cfg_port); 142 udph->len = htons(len); 145 udph->check = build_ip_csum(header - (2 * alen), alen, 146 htons(IPPROTO_UDP) + udph->len); 148 udph->check = 0; 150 return sizeof(*udph);
|
H A D | tap.c | 285 struct udphdr *udph = (struct udphdr *)buf; local 286 int len = sizeof(*udph) + payload_len; 289 udph->source = htons(22); 290 udph->dest = htons(58822); 291 udph->len = htons(len); 296 sum += htons(IPPROTO_UDP) + udph->len; 301 udph->check = finish_ip_csum(sum); 303 return sizeof(*udph) + payload_len;
|
H A D | txtimestamp.c | 416 static uint16_t get_udp_csum(const struct udphdr *udph, int alen) argument 419 const void *csum_start = udph; 422 pseudo_sum += udph->len; 426 csum_len = ntohs(udph->len) + alen * 2; 470 struct udphdr *udph = p; local 472 udph->source = ntohs(dest_port + 1); /* spoof */ 473 udph->dest = ntohs(dest_port); 474 udph->len = ntohs(sizeof(*udph) + cfg_payload_len); 475 udph [all...] |
H A D | csum.c | 638 struct udphdr *udph = th; local 640 if (len < sizeof(*udph)) 643 if (udph->dest != htons(cfg_port_dst)) 646 if (udph->source == htons(cfg_port_src_encap)) 647 return recv_verify_packet_udp_encap(udph + 1, 648 len - sizeof(*udph)); 650 return recv_verify_csum(th, len, ntohs(udph->source), udph->check);
|
/linux-master/net/sched/ |
H A D | act_csum.c | 257 struct udphdr *udph; local 266 * udph->len to get the real length without any protocol check, 267 * UDPLITE uses udph->len for another thing, 271 udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph)); 272 if (udph == NULL) 276 ul = ntohs(udph->len); 278 if (udplite || udph->check) { 280 udph->check = 0; 284 skb->csum = csum_partial(udph, ip 313 struct udphdr *udph; local [all...] |
H A D | act_nat.c | 194 struct udphdr *udph; local 196 if (!pskb_may_pull(skb, ihl + sizeof(*udph) + noff) || 197 skb_try_make_writable(skb, ihl + sizeof(*udph) + noff)) 200 udph = (void *)(skb_network_header(skb) + ihl); 201 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) { 202 inet_proto_csum_replace4(&udph->check, skb, addr, 204 if (!udph->check) 205 udph->check = CSUM_MANGLED_0;
|
/linux-master/net/ipv4/netfilter/ |
H A D | nf_nat_snmp_basic_main.c | 129 struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); local 130 u16 datalen = ntohs(udph->len) - sizeof(struct udphdr); 131 char *data = (unsigned char *)udph + sizeof(struct udphdr); 146 ctx.begin = (unsigned char *)udph + sizeof(struct udphdr); 147 ctx.check = &udph->check; 167 const struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl); local 170 if (udph->source == htons(SNMP_PORT) && dir != IP_CT_DIR_REPLY) 172 if (udph->dest == htons(SNMP_TRAP_PORT) && dir != IP_CT_DIR_ORIGINAL) 184 if (ntohs(udph->len) != skb->len - (iph->ihl << 2)) {
|
/linux-master/drivers/net/ethernet/mellanox/mlx5/core/ |
H A D | en_selftest.c | 84 struct udphdr *udph; local 105 udph = skb_put(skb, sizeof(struct udphdr)); 113 udph->source = htons(9); 114 udph->dest = htons(9); /* Discard Protocol */ 115 udph->len = htons(sizeof(struct mlx5ehdr) + sizeof(struct udphdr)); 116 udph->check = 0; 165 struct udphdr *udph; local 181 udph = (struct udphdr *)((u8 *)iph + 4 * iph->ihl); 182 if (udph->dest != htons(9)) 185 mlxh = (struct mlx5ehdr *)((char *)udph [all...] |
/linux-master/net/netfilter/ |
H A D | nf_nat_helper.c | 145 struct udphdr *udph; local 156 udph = (void *)skb->data + protoff; 159 mangle_contents(skb, protoff + sizeof(*udph), 164 udph->len = htons(datalen); 167 if (!udph->check && skb->ip_summed != CHECKSUM_PARTIAL) 171 udph, &udph->check, datalen, oldlen);
|
H A D | nf_flow_table_ip.c | 51 struct udphdr *udph; local 53 udph = (void *)(skb_network_header(skb) + thoff); 54 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) { 55 inet_proto_csum_replace4(&udph->check, skb, addr, 57 if (!udph->check) 58 udph->check = CSUM_MANGLED_0; 488 struct udphdr *udph; local 490 udph = (void *)(skb_network_header(skb) + thoff); 491 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) { 492 inet_proto_csum_replace16(&udph [all...] |
H A D | nf_flow_table_core.c | 469 struct udphdr *udph; local 471 udph = (void *)(skb_network_header(skb) + thoff); 472 if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) { 473 inet_proto_csum_replace2(&udph->check, skb, port, 475 if (!udph->check) 476 udph->check = CSUM_MANGLED_0;
|
/linux-master/drivers/infiniband/sw/rxe/ |
H A D | rxe_icrc.c | 77 struct udphdr *udph; local 99 udph = (struct udphdr *)(ip4h + 1); 107 udph = (struct udphdr *)(ip6h + 1); 113 udph->check = CSUM_MANGLED_0;
|
H A D | rxe_net.c | 136 struct udphdr *udph; local 155 udph = udp_hdr(skb); 158 pkt->hdr = (u8 *)(udph + 1); 160 pkt->paylen = be16_to_cpu(udph->len) - sizeof(*udph); 214 struct udphdr *udph; local 216 __skb_push(skb, sizeof(*udph)); 218 udph = udp_hdr(skb); 220 udph->dest = dst_port; 221 udph [all...] |
/linux-master/tools/testing/selftests/bpf/ |
H A D | test_flow_dissector.c | 211 const struct udphdr *udph, 219 pseudo_sum += udph->len; 220 return build_ip_csum((void *) udph, num_words, pseudo_sum); 224 const struct udphdr *udph, 233 return build_ip_csum((void *) udph, num_words, pseudo_sum); 239 struct udphdr *udph = header; local 240 int len = sizeof(*udph) + payload_len; 242 udph->source = htons(cfg_src_port); 243 udph->dest = htons(dport); 244 udph 210 build_udp_v4_csum(const struct iphdr *iph, const struct udphdr *udph, int num_words) argument 223 build_udp_v6_csum(const struct ipv6hdr *ip6h, const struct udphdr *udph, int num_words) argument [all...] |
H A D | xdp_hw_metadata.c | 330 struct udphdr *udph; local 356 udph = (void *)(iph + 1); 359 udph = (void *)(ip6h + 1); 377 swap(&udph->source, &udph->dest, 2); 379 want_csum = udph->check; 381 udph->check = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr, 382 ntohs(udph->len), IPPROTO_UDP, 0); 384 udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 385 ntohs(udph [all...] |
/linux-master/tools/testing/selftests/bpf/prog_tests/ |
H A D | xdp_metadata.c | 156 struct udphdr *udph; local 178 udph = (void *)(iph + 1); 187 iph->tot_len = htons(sizeof(*iph) + sizeof(*udph) + UDP_PAYLOAD_BYTES); 196 udph->source = htons(UDP_SOURCE_PORT); 197 udph->dest = htons(dst_port); 198 udph->len = htons(sizeof(*udph) + UDP_PAYLOAD_BYTES); 199 udph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, 200 ntohs(udph->len), IPPROTO_UDP, 0); 202 memset(udph 280 struct udphdr *udph; local [all...] |
/linux-master/drivers/net/netdevsim/ |
H A D | psample.c | 42 struct udphdr *udph; local 73 udph = skb_put_zero(skb, sizeof(struct udphdr) + data_len); 74 get_random_bytes(&udph->source, sizeof(u16)); 75 get_random_bytes(&udph->dest, sizeof(u16)); 76 udph->len = htons(sizeof(struct udphdr) + data_len);
|
/linux-master/net/core/ |
H A D | netpoll.c | 404 struct udphdr *udph; local 413 udp_len = len + sizeof(*udph); 429 skb_push(skb, sizeof(*udph)); 431 udph = udp_hdr(skb); 432 udph->source = htons(np->local_port); 433 udph->dest = htons(np->remote_port); 434 udph->len = htons(udp_len); 437 udph->check = 0; 438 udph->check = csum_ipv6_magic(&np->local_ip.in6, 441 csum_partial(udph, udp_le [all...] |
/linux-master/drivers/net/ |
H A D | amt.c | 616 struct udphdr *udph; local 644 len = hlen + tlen + sizeof(*iph) + sizeof(*udph) + sizeof(*amtd); 655 len = sizeof(*iph) + sizeof(*udph) + sizeof(*amtd); 658 amtd = skb_pull(skb, sizeof(*iph) + sizeof(*udph)); 663 skb_push(skb, sizeof(*udph)); 665 udph = udp_hdr(skb); 666 udph->source = amt->gw_port; 667 udph->dest = amt->relay_port; 668 udph->len = htons(sizeof(*udph) 705 struct udphdr *udph; local 2553 struct udphdr *udph; local 2640 struct udphdr *udph; local 2663 struct udphdr *udph; local [all...] |
/linux-master/net/ipv4/ |
H A D | ipconfig.c | 629 struct udphdr udph; /* UDP header */ member in struct:bootp_pkt 853 b->udph.source = htons(68); 854 b->udph.dest = htons(67); 855 b->udph.len = htons(sizeof(struct bootp_pkt) - sizeof(struct iphdr)); 1030 if (b->udph.source != htons(67) || b->udph.dest != htons(68)) 1033 if (ntohs(h->tot_len) < ntohs(b->udph.len) + sizeof(struct iphdr)) 1036 len = ntohs(b->udph.len) - sizeof(struct udphdr);
|