]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - tools/testing/selftests/bpf/network_helpers.h
Merge branch 'test_progs-improvements'
[mirror_ubuntu-jammy-kernel.git] / tools / testing / selftests / bpf / network_helpers.h
CommitLineData
33181bb8
SF
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __NETWORK_HELPERS_H
3#define __NETWORK_HELPERS_H
4#include <sys/socket.h>
5#include <sys/types.h>
488a23b8
SF
6#include <linux/types.h>
7typedef __u16 __sum16;
8#include <linux/if_ether.h>
9#include <linux/if_packet.h>
10#include <linux/ip.h>
11#include <linux/ipv6.h>
12#include <netinet/tcp.h>
13#include <bpf/bpf_endian.h>
14
15#define MAGIC_VAL 0x1234
16#define NUM_ITER 100000
17#define VIP_NUM 5
18#define MAGIC_BYTES 123
19
20/* ipv4 test vector */
21struct ipv4_packet {
22 struct ethhdr eth;
23 struct iphdr iph;
24 struct tcphdr tcp;
25} __packed;
26extern struct ipv4_packet pkt_v4;
27
28/* ipv6 test vector */
29struct ipv6_packet {
30 struct ethhdr eth;
31 struct ipv6hdr iph;
32 struct tcphdr tcp;
33} __packed;
34extern struct ipv6_packet pkt_v6;
33181bb8
SF
35
36int start_server(int family, int type);
566fc3f5 37int start_server_with_port(int family, int type, __u16 port);
33181bb8 38int connect_to_fd(int family, int type, int server_fd);
383724e1
AI
39int connect_fd_to_fd(int client_fd, int server_fd);
40int connect_wait(int client_fd);
33181bb8
SF
41
42#endif