Commit ea28029a authored by Franck Messaoudi's avatar Franck Messaoudi

Update: formatting some files

parent e64d6c81
......@@ -59,12 +59,12 @@ class SessionManager {
virtual ~SessionManager();
/*---------------------------------------------------------------------------------------------------------------*/
// /**
// * @brief Create a Session object in BPF map.
// *
// * @param pSession The session object to be created.
// */
// void createSession(std::shared_ptr<SessionBpf> pSession);
// /**
// * @brief Create a Session object in BPF map.
// *
// * @param pSession The session object to be created.
// */
// void createSession(std::shared_ptr<SessionBpf> pSession);
/*---------------------------------------------------------------------------------------------------------------*/
/**
......
......@@ -7,7 +7,7 @@
#include <linux/if_ether.h>
//#define UDP_CSUM_OFFSET (sizeof(struct ethhdr) + offsetof(struct udphdr,
//check))
// check))
// static u32 udp_handle(
// struct xdp_md* ctx, struct udphdr* udph, u32 src_ip, u32 dest_ip);
......
......@@ -422,7 +422,7 @@ int xdp_handle_downlink(struct xdp_md* ctx) {
return XDP_DROP;
}
// struct iphdr* iph = (struct iphdr*) ((void*) ethh + sizeof(*ethh));
// struct iphdr* iph = (struct iphdr*) ((void*) ethh + sizeof(*ethh));
struct iphdr* iph = (void*) (ethh + 1);
if ((void*) (iph + 1) > data_end) {
......@@ -430,7 +430,7 @@ int xdp_handle_downlink(struct xdp_md* ctx) {
return XDP_DROP;
}
bpf_debug("xxxxxxxxxxxx ip_dest: 0x%x", iph->daddr);
bpf_debug("xxxxxxxxxxxx ip_dest: 0x%x", iph->daddr);
u32 ip_dest = bpf_htonl(iph->daddr);
struct session_id* session =
bpf_map_lookup_elem(&m_session_mapping, &ip_dest);
......@@ -472,9 +472,9 @@ int xdp_handle_shaping(struct xdp_md* ctx) {
return XDP_DROP;
}
//struct iphdr* iph = (struct iphdr*) ((void*) ethh + sizeof(*ethh));
// struct iphdr* iph = (struct iphdr*) ((void*) ethh + sizeof(*ethh));
struct iphdr* iph = (void*) (ethh + 1);
if ((void*) (iph + 1) > data_end) {
bpf_debug("Error: Invalid IPv4 Packet");
return XDP_DROP;
......
......@@ -35,13 +35,12 @@
#define TARGET_INTF 644
//---------------------------------------------------------------------------------------------------------------
static __always_inline u32 egress_sdf_filter(
struct __sk_buff* skb) {
void *data = (void *)(long)skb->data;
static __always_inline u32 egress_sdf_filter(struct __sk_buff* skb) {
void* data = (void*) (long) skb->data;
void* data_end = (void*) (long) skb->data_end;
struct ethhdr* ethh = data;
if ((void*) (ethh + 1) > data_end) {
bpf_debug("Error: Invalid Ethernet header");
return TC_ACT_SHOT;
......@@ -81,13 +80,13 @@ static __always_inline u32 egress_sdf_filter(
struct filter_key* key = {0};
u8 protocol = iph_inner->protocol;
//bpf_debug("Create Key for SDF Filter Map");
// bpf_debug("Create Key for SDF Filter Map");
key->src_ip = iph_inner->saddr;
key->dst_ip = iph_inner->daddr;
key->protocol = protocol;
switch (protocol) {
case IPPROTO_UDP: {
// Extract UDP header
......@@ -141,11 +140,10 @@ static __always_inline u32 egress_sdf_filter(
}
//---------------------------------------------------------------------------------------------------------------
static __always_inline u32
ipv4_sdf_filter(struct __sk_buff* skb) {
void *data = (void *)(long)skb->data;
void *data_end = (void *)(long)skb->data_end;
static __always_inline u32 ipv4_sdf_filter(struct __sk_buff* skb) {
void* data = (void*) (long) skb->data;
void* data_end = (void*) (long) skb->data_end;
struct ethhdr* ethh = data;
if ((void*) (ethh + 1) > data_end) {
......@@ -160,7 +158,7 @@ ipv4_sdf_filter(struct __sk_buff* skb) {
return TC_ACT_SHOT;
}
u8 protocol = iph->protocol;
u8 protocol = iph->protocol;
switch (protocol) {
case IPPROTO_UDP: {
......@@ -182,15 +180,14 @@ ipv4_sdf_filter(struct __sk_buff* skb) {
}
}
//---------------------------------------------------------------------------------------------------------------
SEC("tc/egress")
int tc_filter_traffic(struct __sk_buff* skb) {
bpf_debug("==========< tc/egress: Filter Traffic >==========\n");
void *data = (void *)(long)skb->data;
void *data_end = (void *)(long)skb->data_end;
void* data = (void*) (long) skb->data;
void* data_end = (void*) (long) skb->data_end;
struct ethhdr* ethh = data;
......@@ -243,12 +240,12 @@ int tc_redirect_traffic(struct __sk_buff* skb) {
int key = DOWNLINK, *ifindex;
ifindex = bpf_map_lookup_elem(&m_egress_ifindex, &key);
if (ifindex) {
bpf_debug("TC_REDIRECT: Redirecting packet to N3 tc layer");
return bpf_redirect(*ifindex, 0);
}
bpf_debug("TC Packets not redirected! Drop them");
return TC_ACT_SHOT;
}
......
......@@ -27,7 +27,6 @@
// uint64_t qfi;
// };
struct s_fiveQosFlow {
uint8_t gate;
uint64_t mbr;
......@@ -35,6 +34,4 @@ struct s_fiveQosFlow {
uint8_t qfi;
};
#endif //__QOS_FLOW_H__
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment