pping: Fix struct alginment issues

Move some members in network_tuple and rtt_event around to avoid holes.

Also remove some uncecessary parentheses before & operator, and add
local definitions of AF_INET and AF_INET6.

Signed-off-by: Simon Sundberg <simon.sundberg@kau.se>
This commit is contained in:
Simon Sundberg
2021-02-09 13:00:28 +01:00
parent 670df84bd9
commit eafdf87d80
5 changed files with 18 additions and 21 deletions

View File

@@ -7,6 +7,8 @@
#include <string.h>
#include "pping.h"
#define AF_INET 2
#define AF_INET6 10
#define MAX_TCP_OPTIONS 10
/*
@@ -15,14 +17,10 @@
static __always_inline void map_ipv4_to_ipv6(__be32 ipv4, struct in6_addr *ipv6)
{
/* __u16 ipv4_prefix[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0xffff}; */
/* memcpy(&(ipv6->in6_u.u6_addr8), ipv4_prefix, sizeof(ipv4_prefix)); */
memset(&(ipv6->in6_u.u6_addr8[0]), 0x00, 10);
memset(&(ipv6->in6_u.u6_addr8[10]), 0xff, 2);
#if __UAPI_DEF_IN6_ADDR_ALT
/* memcpy(ipv6, ipv4_prefix, sizeof(ipv4_prefix)); // Won't load on TC */
memset(&ipv6->in6_u.u6_addr8[0], 0x00, 10);
memset(&ipv6->in6_u.u6_addr8[10], 0xff, 2);
ipv6->in6_u.u6_addr32[3] = ipv4;
#else
memcpy(&(ipv6->in6_u.u6_addr8[12]), &ipv4, sizeof(ipv4));
#endif
}
/*