Add option to disable IPv6 to speed up performance of XDP program.
This commit is contained in:
@@ -36,11 +36,14 @@ static __always_inline int log_filter_msg(struct iphdr* iph, struct ipv6hdr* iph
|
||||
{
|
||||
e->src_ip = iph->saddr;
|
||||
e->dst_ip = iph->daddr;
|
||||
} else if (iph6)
|
||||
}
|
||||
#ifdef ENABLE_IPV6
|
||||
else if (iph6)
|
||||
{
|
||||
memcpy(&e->src_ip6, iph6->saddr.in6_u.u6_addr32, 4);
|
||||
memcpy(&e->dst_ip6, iph6->daddr.in6_u.u6_addr32, 4);
|
||||
}
|
||||
#endif
|
||||
|
||||
e->src_port = src_port;
|
||||
e->dst_port = dst_port;
|
||||
|
||||
@@ -21,6 +21,7 @@ struct
|
||||
__type(value, u64);
|
||||
} map_block SEC(".maps");
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
struct
|
||||
{
|
||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||
@@ -28,6 +29,7 @@ struct
|
||||
__type(key, u128);
|
||||
__type(value, u64);
|
||||
} map_block6 SEC(".maps");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_IP_RANGE_DROP
|
||||
struct
|
||||
@@ -50,6 +52,7 @@ struct
|
||||
__type(value, cl_stats_t);
|
||||
} map_ip_stats SEC(".maps");
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
struct
|
||||
{
|
||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||
@@ -58,6 +61,7 @@ struct
|
||||
__type(value, cl_stats_t);
|
||||
} map_ip6_stats SEC(".maps");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RL_FLOW
|
||||
struct
|
||||
@@ -68,6 +72,7 @@ struct
|
||||
__type(value, cl_stats_t);
|
||||
} map_flow_stats SEC(".maps");
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
struct
|
||||
{
|
||||
__uint(type, BPF_MAP_TYPE_LRU_HASH);
|
||||
@@ -76,6 +81,7 @@ struct
|
||||
__type(value, cl_stats_t);
|
||||
} map_flow6_stats SEC(".maps");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ static __always_inline int update_ip_stats(u64 *pps, u64 *bps, u32 ip, u16 pkt_l
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
/**
|
||||
* Updates source IPv6 address stats.
|
||||
*
|
||||
@@ -107,6 +108,7 @@ static __always_inline int update_ip6_stats(u64 *pps, u64 *bps, u128 *ip, u16 pk
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RL_FLOW
|
||||
/**
|
||||
@@ -168,6 +170,7 @@ static __always_inline int update_flow_stats(u64 *pps, u64 *bps, u32 ip, u16 por
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
/**
|
||||
* Updates IPv6 flow stats.
|
||||
*
|
||||
@@ -227,4 +230,5 @@ static __always_inline int update_flow6_stats(u64 *pps, u64 *bps, u128 *ip, u16
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user