Home
last modified time | relevance | path

Searched refs:bpf_htons (Results 1 – 25 of 39) sorted by relevance

12

/linux/tools/testing/selftests/bpf/progs/
A Dbpf_flow.c119 case bpf_htons(ETH_P_IP): in parse_eth_proto()
122 case bpf_htons(ETH_P_IPV6): in parse_eth_proto()
125 case bpf_htons(ETH_P_MPLS_MC): in parse_eth_proto()
126 case bpf_htons(ETH_P_MPLS_UC): in parse_eth_proto()
129 case bpf_htons(ETH_P_8021Q): in parse_eth_proto()
130 case bpf_htons(ETH_P_8021AD): in parse_eth_proto()
171 return parse_eth_proto(skb, bpf_htons(ETH_P_IP)); in parse_ip_proto()
183 if (bpf_htons(gre->flags & GRE_VERSION)) in parse_ip_proto()
199 if (gre->proto == bpf_htons(ETH_P_TEB)) { in parse_ip_proto()
287 if (iph->frag_off & bpf_htons(IP_OFFSET)) { in PROG()
[all …]
A Dconnect_force_port4.c37 sa.sin_port = bpf_htons(22222); in connect4()
44 if (ctx->user_port == bpf_htons(60000)) { in connect4()
54 ctx->user_port = bpf_htons(60123); in connect4()
66 if (ctx->user_port == bpf_htons(60123)) { in getsockname4()
68 ctx->user_port = bpf_htons(60000); in getsockname4()
82 if (ctx->user_port == bpf_htons(60123)) { in getpeername4()
A Dconnect_force_port6.c36 sa.sin6_port = bpf_htons(22223); in connect6()
43 if (ctx->user_port == bpf_htons(60000)) { in connect6()
59 ctx->user_port = bpf_htons(60124); in connect6()
71 if (ctx->user_port == bpf_htons(60124)) { in getsockname6()
76 ctx->user_port = bpf_htons(60000); in getsockname6()
90 if (ctx->user_port == bpf_htons(60124)) { in getpeername6()
A Dtest_xdp_vlan.c70 if (eth_type == bpf_htons(ETH_P_8021Q) in parse_eth_frame()
71 || eth_type == bpf_htons(ETH_P_8021AD)) { in parse_eth_frame()
83 if (eth_type == bpf_htons(ETH_P_8021Q) in parse_eth_frame()
84 || eth_type == bpf_htons(ETH_P_8021AD)) { in parse_eth_frame()
163 bpf_htons((bpf_ntohs(vlan_hdr->h_vlan_TCI) & 0xf000) in xdp_prognum1()
273 bpf_skb_vlan_push(ctx, bpf_htons(ETH_P_8021Q), TESTVLAN); in _tc_progA()
A Dtest_tc_tunnel.c121 iph_inner.tot_len = bpf_htons(sizeof(iph6_inner) + in __encap_ipv4()
173 h_outer.l4hdr.gre.protocol = bpf_htons(l2_proto); in __encap_ipv4()
180 h_outer.l4hdr.udp.dest = bpf_htons(udp_dst); in __encap_ipv4()
182 h_outer.l4hdr.udp.len = bpf_htons(bpf_ntohs(iph_inner.tot_len) + in __encap_ipv4()
224 h_outer.ip.tot_len = bpf_htons(olen + in __encap_ipv4()
241 eth.h_proto = bpf_htons(ETH_P_IP); in __encap_ipv4()
304 h_outer.l4hdr.gre.protocol = bpf_htons(l2_proto); in __encap_ipv6()
311 h_outer.l4hdr.udp.dest = bpf_htons(udp_dst); in __encap_ipv6()
315 h_outer.l4hdr.udp.len = bpf_htons(tot_len); in __encap_ipv6()
353 h_outer.ip.payload_len = bpf_htons(olen + in __encap_ipv6()
A Dtest_xdp.c126 set_ethhdr(new_eth, old_eth, tnl, bpf_htons(ETH_P_IP)); in handle_ipv4()
134 iph->tot_len = bpf_htons(payload_len + sizeof(*iph)); in handle_ipv4()
195 set_ethhdr(new_eth, old_eth, tnl, bpf_htons(ETH_P_IPV6)); in handle_ipv6()
200 ip6h->payload_len = bpf_htons(bpf_ntohs(payload_len) + sizeof(*ip6h)); in handle_ipv6()
224 if (h_proto == bpf_htons(ETH_P_IP)) in _xdp_tx_iptunnel()
226 else if (h_proto == bpf_htons(ETH_P_IPV6)) in _xdp_tx_iptunnel()
A Dtest_xdp_loop.c122 set_ethhdr(new_eth, old_eth, tnl, bpf_htons(ETH_P_IP)); in handle_ipv4()
130 iph->tot_len = bpf_htons(payload_len + sizeof(*iph)); in handle_ipv4()
191 set_ethhdr(new_eth, old_eth, tnl, bpf_htons(ETH_P_IPV6)); in handle_ipv6()
196 ip6h->payload_len = bpf_htons(bpf_ntohs(payload_len) + sizeof(*ip6h)); in handle_ipv6()
220 if (h_proto == bpf_htons(ETH_P_IP)) in _xdp_tx_iptunnel()
222 else if (h_proto == bpf_htons(ETH_P_IPV6)) in _xdp_tx_iptunnel()
A Dtest_sk_assign.c57 if (eth->h_proto == bpf_htons(ETH_P_IP)) { in get_tuple()
69 } else if (eth->h_proto == bpf_htons(ETH_P_IPV6)) { in get_tuple()
108 if (dport != bpf_htons(4321)) in handle_udp()
143 if (dport != bpf_htons(4321)) in handle_tcp()
A Dconnect6_prog.c43 tuple.ipv6.dport = bpf_htons(DST_REWRITE_PORT6); in connect_v6_prog()
74 ctx->user_port = bpf_htons(DST_REWRITE_PORT6); in connect_v6_prog()
80 sa.sin6_port = bpf_htons(0); in connect_v6_prog()
A Dsendmsg4_prog.c43 ctx->user_port == bpf_htons(DST_PORT)) { in sendmsg_v4_prog()
45 ctx->user_port = bpf_htons(DST_REWRITE_PORT4); in sendmsg_v4_prog()
A Dconnect4_prog.c40 sa.sin_port = bpf_htons(0); in do_bind()
156 tuple.ipv4.dport = bpf_htons(DST_REWRITE_PORT4); in connect_v4_prog()
194 ctx->user_port = bpf_htons(DST_REWRITE_PORT4); in connect_v4_prog()
A Dxdp_redirect_multi_kern.c54 if (h_proto == bpf_htons(ETH_P_IP)) in xdp_redirect_map_multi_prog()
58 else if (h_proto == bpf_htons(ETH_P_IPV6)) in xdp_redirect_map_multi_prog()
A Dtest_lwt_ip_encap.c39 hdr.iph.tot_len = bpf_htons(skb->len + sizeof(struct encap_hdr)); in bpf_lwt_encap_gre()
63 hdr.ip6hdr.payload_len = bpf_htons(skb->len + sizeof(struct grehdr)); in bpf_lwt_encap_gre6()
A Dtest_tc_edt.c73 if (tcp->dest == bpf_htons(9000)) in handle_tcp()
104 if (skb->protocol == bpf_htons(ETH_P_IP)) in tc_prog()
A Dtest_pkt_access.c112 if (eth->h_proto == bpf_htons(ETH_P_IP)) { in test_pkt_access()
120 } else if (eth->h_proto == bpf_htons(ETH_P_IPV6)) { in test_pkt_access()
A Dkfree_skb.c102 if (users != 1 || pkt_data != bpf_htons(0x86dd) || meta.ifindex != 1) in BPF_PROG()
149 if (len != 60 || protocol != bpf_htons(0x86dd) || ifindex != 1) in BPF_PROG()
A Dbind4_prog.c118 ctx->user_port != bpf_htons(SERV4_PORT)) in bind_v4_prog()
156 ctx->user_port = bpf_htons(SERV4_REWRITE_PORT); in bind_v4_prog()
A Dtest_sk_lookup_kern.c29 if (eth_proto == bpf_htons(ETH_P_IP)) { in get_tuple()
38 } else if (eth_proto == bpf_htons(ETH_P_IPV6)) { in get_tuple()
A Dbind6_prog.c128 ctx->user_port != bpf_htons(SERV6_PORT)) in bind_v6_prog()
173 ctx->user_port = bpf_htons(SERV6_REWRITE_PORT); in bind_v6_prog()
A Dxdping_kern.c70 if (eth->h_proto != bpf_htons(ETH_P_IP)) in icmp_check()
142 seq = bpf_htons(bpf_ntohs(icmph->un.echo.sequence) + 1); in xdping_client()
A Dtest_cls_redirect.c209 uint16_t frag_off = ip->frag_off & bpf_htons(IP_OFFSET_MASK); in ipv4_is_fragment()
210 return (ip->frag_off & bpf_htons(IP_MF)) != 0 || frag_off > 0; in ipv4_is_fragment()
387 encap->eth.h_proto = bpf_htons(ETH_P_IPV6); in accept_locally()
518 bpf_htons(bpf_ntohs(encap_gre->ip.tot_len) + delta); in forward_with_gre()
520 encap_gre->gre.protocol = bpf_htons(proto); in forward_with_gre()
944 if (skb->protocol != bpf_htons(ETH_P_IP)) { in cls_redirect()
A Dconnect4_dropper.c21 if (ctx->user_port == bpf_htons(60120)) in connect_v4_dropper()
A Dbind_perm.c27 if (ctx->user_port == bpf_htons(111)) in bind_prog()
/linux/samples/bpf/
A Dxdp_sample.bpf.h61 #define bpf_htons(x) __builtin_bswap16(x) macro
65 #define bpf_htons(x) (x) macro
A Dxdp_redirect_cpu.bpf.c69 if (eth_type == bpf_htons(ETH_P_8021Q) || in parse_eth()
70 eth_type == bpf_htons(ETH_P_8021AD)) { in parse_eth()
80 if (eth_type == bpf_htons(ETH_P_8021Q) || in parse_eth()
81 eth_type == bpf_htons(ETH_P_8021AD)) { in parse_eth()

Completed in 31 milliseconds

12