2021-01-18 13:13:51 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2021-01-26 18:34:23 +01:00
|
|
|
#ifndef PPING_H
|
|
|
|
#define PPING_H
|
|
|
|
|
2020-12-11 19:25:35 +01:00
|
|
|
#include <linux/types.h>
|
2021-02-08 20:28:46 +01:00
|
|
|
#include <linux/in6.h>
|
2020-12-11 19:25:35 +01:00
|
|
|
|
2021-01-26 18:34:23 +01:00
|
|
|
#define XDP_PROG_SEC "xdp"
|
|
|
|
#define TCBPF_PROG_SEC "pping_egress"
|
|
|
|
|
2021-02-08 20:28:46 +01:00
|
|
|
/*
|
|
|
|
* Struct to hold a full network tuple
|
|
|
|
* Works for both IPv4 and IPv6, as IPv4 addresses can be mapped to IPv6 ones
|
|
|
|
* based on RFC 4291 Section 2.5.5.2. The ipv member is technically not
|
|
|
|
* necessary, but makes it easier to determine if it is an IPv4 or IPv6 address
|
|
|
|
* (don't need to look at the first 12 bytes of address).
|
|
|
|
* The proto memeber is not currently used, but could be useful once pping
|
|
|
|
* is extended to work for other protocols than TCP
|
|
|
|
*/
|
|
|
|
struct network_tuple {
|
|
|
|
struct in6_addr saddr;
|
|
|
|
struct in6_addr daddr;
|
2021-01-18 18:08:35 +01:00
|
|
|
__u16 sport;
|
|
|
|
__u16 dport;
|
2021-02-08 20:28:46 +01:00
|
|
|
__u16 proto; //IPPROTO_TCP, IPPROTO_ICMP, QUIC etc
|
2021-02-09 13:00:28 +01:00
|
|
|
__u16 ipv; //AF_INET or AF_INET6
|
2020-12-11 19:25:35 +01:00
|
|
|
};
|
|
|
|
|
2021-02-08 20:28:46 +01:00
|
|
|
struct packet_id {
|
|
|
|
struct network_tuple flow;
|
|
|
|
__u32 identifier; //tsval for TCP packets
|
2020-12-11 19:25:35 +01:00
|
|
|
};
|
|
|
|
|
2021-02-08 20:28:46 +01:00
|
|
|
struct packet_timestamp {
|
2021-01-18 18:08:35 +01:00
|
|
|
__u64 timestamp;
|
|
|
|
__u8 used;
|
2020-12-11 19:25:35 +01:00
|
|
|
};
|
2021-01-07 18:14:27 +01:00
|
|
|
|
2021-01-18 18:08:35 +01:00
|
|
|
struct rtt_event {
|
|
|
|
__u64 rtt;
|
2021-02-09 13:00:28 +01:00
|
|
|
struct network_tuple flow;
|
2021-01-07 18:14:27 +01:00
|
|
|
};
|
|
|
|
|
2020-12-11 19:25:35 +01:00
|
|
|
#endif
|