From 965f603238a92b6ab8cd8a0592e0fb65c096b3e1 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Sat, 26 Mar 2022 00:05:31 +0100 Subject: treewide: Add include guards ...at the moment, just for consistency with packet.h, icmp.h, tcp.h and udp.h. Signed-off-by: Stefano Brivio --- arch.h | 5 +++++ arp.h | 5 +++++ checksum.h | 5 +++++ conf.h | 5 +++++ dhcp.h | 5 +++++ dhcpv6.h | 5 +++++ ndp.h | 5 +++++ netlink.h | 5 +++++ passt.h | 5 +++++ pasta.h | 5 +++++ pcap.h | 5 +++++ siphash.h | 5 +++++ tap.h | 5 +++++ tcp_splice.h | 5 +++++ util.h | 5 +++++ 15 files changed, 75 insertions(+) diff --git a/arch.h b/arch.h index ce1c01b..40e0ce2 100644 --- a/arch.h +++ b/arch.h @@ -3,4 +3,9 @@ * Author: Stefano Brivio */ +#ifndef ARCH_H +#define ARCH_H + void arch_avx2_exec(char **argv); + +#endif /* ARCH_H */ diff --git a/arp.h b/arp.h index 6ef3736..34b15db 100644 --- a/arp.h +++ b/arp.h @@ -3,6 +3,9 @@ * Author: Stefano Brivio */ +#ifndef ARP_H +#define ARP_H + /** * struct arpmsg - 802.2 ARP IPv4 payload * @sha: Sender hardware address @@ -18,3 +21,5 @@ struct arpmsg { } __attribute__((__packed__)); int arp(struct ctx *c, struct pool *p); + +#endif /* ARP_H */ diff --git a/checksum.h b/checksum.h index 0212923..377e38d 100644 --- a/checksum.h +++ b/checksum.h @@ -3,8 +3,13 @@ * Author: Stefano Brivio */ +#ifndef CHECKSUM_H +#define CHECKSUM_H + uint32_t sum_16b(void *buf, size_t len); uint16_t csum_fold(uint32_t sum); uint16_t csum_unaligned(void *buf, size_t len, uint32_t init); void csum_tcp4(struct iphdr *iph); uint16_t csum(const void *buf, size_t len, uint32_t init); + +#endif /* CHECKSUM_H */ diff --git a/conf.h b/conf.h index 4d2aff1..c39d413 100644 --- a/conf.h +++ b/conf.h @@ -3,5 +3,10 @@ * Author: Stefano Brivio */ +#ifndef CONF_H +#define CONF_H + void conf(struct ctx *c, int argc, char **argv); void get_bound_ports(struct ctx *c, int ns, uint8_t proto); + +#endif /* CONF_H */ diff --git a/dhcp.h b/dhcp.h index 7c72fd2..ab74672 100644 --- a/dhcp.h +++ b/dhcp.h @@ -3,5 +3,10 @@ * Author: Stefano Brivio */ +#ifndef DHCP_H +#define DHCP_H + int dhcp(struct ctx *c, struct pool *p); void dhcp_init(void); + +#endif /* DHCP_H */ diff --git a/dhcpv6.h b/dhcpv6.h index 73d28d3..b476133 100644 --- a/dhcpv6.h +++ b/dhcpv6.h @@ -3,6 +3,11 @@ * Author: Stefano Brivio */ +#ifndef DHCPV6_H +#define DHCPV6_H + int dhcpv6(struct ctx *c, struct pool *p, struct in6_addr *saddr, struct in6_addr *daddr); void dhcpv6_init(struct ctx *c); + +#endif /* DHCPV6_H */ diff --git a/ndp.h b/ndp.h index a26673e..7280b23 100644 --- a/ndp.h +++ b/ndp.h @@ -3,5 +3,10 @@ * Author: Stefano Brivio */ +#ifndef NDP_H +#define NDP_H + int ndp(struct ctx *c, struct icmp6hdr *ih, unsigned char *eh_source, struct in6_addr *saddr); + +#endif /* NDP_H */ diff --git a/netlink.h b/netlink.h index 9081f46..77b640c 100644 --- a/netlink.h +++ b/netlink.h @@ -3,9 +3,14 @@ * Author: Stefano Brivio */ +#ifndef NETLINK_H +#define NETLINK_H + int nl_sock_init(struct ctx *c); unsigned int nl_get_ext_if(int *v4, int *v6); void nl_route(int ns, unsigned int ifi, sa_family_t af, void *gw); void nl_addr(int ns, unsigned int ifi, sa_family_t af, void *addr, int *prefix_len, void *addr_l); void nl_link(int ns, unsigned int ifi, void *mac, int up, int mtu); + +#endif /* NETLINK_H */ diff --git a/passt.h b/passt.h index cd28973..98f10a1 100644 --- a/passt.h +++ b/passt.h @@ -3,6 +3,9 @@ * Author: Stefano Brivio */ +#ifndef PASST_H +#define PASST_H + #define UNIX_SOCK_MAX 100 #define UNIX_SOCK_PATH "/tmp/passt_%i.socket" @@ -232,3 +235,5 @@ struct ctx { void proto_update_l2_buf(unsigned char *eth_d, unsigned char *eth_s, uint32_t *ip_da); + +#endif /* PASST_H */ diff --git a/pasta.h b/pasta.h index 235bfb9..8c80006 100644 --- a/pasta.h +++ b/pasta.h @@ -3,8 +3,13 @@ * Author: Stefano Brivio */ +#ifndef PASTA_H +#define PASTA_H + void pasta_start_ns(struct ctx *c); void pasta_ns_conf(struct ctx *c); void pasta_child_handler(int signal); int pasta_netns_quit_init(struct ctx *c); void pasta_netns_quit_handler(struct ctx *c, int inotify_fd); + +#endif /* PASTA_H */ diff --git a/pcap.h b/pcap.h index 73b5ed8..e951b2f 100644 --- a/pcap.h +++ b/pcap.h @@ -3,7 +3,12 @@ * Author: Stefano Brivio */ +#ifndef PCAP_H +#define PCAP_H + void pcap(char *pkt, size_t len); void pcapm(struct msghdr *mh); void pcapmm(struct mmsghdr *mmh, unsigned int vlen); void pcap_init(struct ctx *c); + +#endif /* PCAP_H */ diff --git a/siphash.h b/siphash.h index 5578586..80208ee 100644 --- a/siphash.h +++ b/siphash.h @@ -3,8 +3,13 @@ * Author: Stefano Brivio */ +#ifndef SIPHASH_H +#define SIPHASH_H + uint64_t siphash_8b(const uint8_t *in, const uint64_t *k); uint32_t siphash_12b(const uint8_t *in, const uint64_t *k); uint64_t siphash_20b(const uint8_t *in, const uint64_t *k); uint32_t siphash_32b(const uint8_t *in, const uint64_t *k); uint32_t siphash_36b(const uint8_t *in, const uint64_t *k); + +#endif /* SIPHASH_H */ diff --git a/tap.h b/tap.h index 8942fcf..233497e 100644 --- a/tap.h +++ b/tap.h @@ -3,8 +3,13 @@ * Author: Stefano Brivio */ +#ifndef TAP_H +#define TAP_H + void tap_ip_send(struct ctx *c, struct in6_addr *src, uint8_t proto, char *in, size_t len, uint32_t flow); int tap_send(struct ctx *c, void *data, size_t len, int vnet_pre); void tap_handler(struct ctx *c, int fd, uint32_t events, struct timespec *now); void tap_sock_init(struct ctx *c); + +#endif /* TAP_H */ diff --git a/tcp_splice.h b/tcp_splice.h index f7c2f86..63ffc68 100644 --- a/tcp_splice.h +++ b/tcp_splice.h @@ -3,6 +3,9 @@ * Author: Stefano Brivio */ +#ifndef TCP_SPLICE_H +#define TCP_SPLICE_H + #define TCP_SPLICE_MAX_CONNS (128 * 1024) struct tcp_splice_conn; @@ -13,3 +16,5 @@ void tcp_splice_destroy(struct ctx *c, struct tcp_splice_conn *conn); void tcp_splice_init(struct ctx *c); void tcp_splice_timer(struct ctx *c); void tcp_splice_defer_handler(struct ctx *c); + +#endif /* TCP_SPLICE_H */ diff --git a/util.h b/util.h index 073a913..6779f24 100644 --- a/util.h +++ b/util.h @@ -3,6 +3,9 @@ * Author: Stefano Brivio */ +#ifndef UTIL_H +#define UTIL_H + void err(const char *format, ...); void warn(const char *format, ...); void info(const char *format, ...); @@ -213,3 +216,5 @@ int ns_enter(struct ctx *c); void write_pidfile(int fd, pid_t pid); int __daemon(int pidfile_fd, int devnull_fd); int fls(unsigned long x); + +#endif /* UTIL_H */ -- cgit v1.2.3