mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
Add IPv6 LI Stats
This commit is contained in:
23
src/bbl_li.c
23
src/bbl_li.c
@ -58,6 +58,7 @@ bbl_qmx_li_handler_rx(bbl_ethernet_header_t *eth, bbl_qmx_li_t *qmx_li, bbl_inte
|
||||
bbl_ethernet_header_t *inner_eth;
|
||||
bbl_pppoe_session_t *inner_pppoe;
|
||||
bbl_ipv4_t *inner_ipv4 = NULL;
|
||||
bbl_ipv6_t *inner_ipv6 = NULL;
|
||||
bbl_li_flow_t *li_flow;
|
||||
|
||||
dict_insert_result result;
|
||||
@ -96,10 +97,13 @@ bbl_qmx_li_handler_rx(bbl_ethernet_header_t *eth, bbl_qmx_li_t *qmx_li, bbl_inte
|
||||
inner_pppoe = (bbl_pppoe_session_t*)inner_eth->next;
|
||||
if(inner_pppoe->protocol == PROTOCOL_IPV4) {
|
||||
inner_ipv4 = (bbl_ipv4_t*)inner_pppoe->next;
|
||||
|
||||
}
|
||||
} else if(inner_pppoe->protocol == PROTOCOL_IPV6) {
|
||||
inner_ipv6 = (bbl_ipv6_t*)inner_pppoe->next;
|
||||
}
|
||||
} else if(inner_eth->type == ETH_TYPE_IPV4) {
|
||||
inner_ipv4 = (bbl_ipv4_t*)eth->next;
|
||||
} else if(inner_eth->type == PROTOCOL_IPV6) {
|
||||
inner_ipv6 = (bbl_ipv6_t*)eth->next;
|
||||
}
|
||||
|
||||
if(inner_ipv4) {
|
||||
@ -117,5 +121,20 @@ bbl_qmx_li_handler_rx(bbl_ethernet_header_t *eth, bbl_qmx_li_t *qmx_li, bbl_inte
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (inner_ipv6) {
|
||||
li_flow->packets_rx_ipv6++;
|
||||
switch(inner_ipv6->protocol) {
|
||||
case IPV6_NEXT_HEADER_TCP:
|
||||
li_flow->packets_rx_ipv6_tcp++;
|
||||
break;
|
||||
case IPV6_NEXT_HEADER_UDP:
|
||||
li_flow->packets_rx_ipv6_udp++;
|
||||
break;
|
||||
case IPV6_NEXT_HEADER_INTERNAL:
|
||||
li_flow->packets_rx_ipv6_internal++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ typedef struct bbl_li_flow_
|
||||
uint64_t packets_rx_ipv4_tcp;
|
||||
uint64_t packets_rx_ipv4_udp;
|
||||
uint64_t packets_rx_ipv4_internal;
|
||||
uint64_t packets_rx_ipv6;
|
||||
uint64_t packets_rx_ipv6_tcp;
|
||||
uint64_t packets_rx_ipv6_udp;
|
||||
uint64_t packets_rx_ipv6_internal;
|
||||
} bbl_li_flow_t;
|
||||
|
||||
const char* bbl_li_direction_string(uint8_t direction);
|
||||
|
@ -139,8 +139,10 @@
|
||||
#define UDP_PROTOCOL_L2TP 3
|
||||
#define UDP_PROTOCOL_QMX_LI 4
|
||||
|
||||
#define IPV6_NEXT_HEADER_TCP 6
|
||||
#define IPV6_NEXT_HEADER_UDP 17
|
||||
#define IPV6_NEXT_HEADER_ICMPV6 58
|
||||
#define IPV6_NEXT_HEADER_INTERNAL 61
|
||||
|
||||
#define ICMPV6_FLAGS_OTHER_CONFIG 0x40
|
||||
#define ICMPV6_OPTION_PREFIX 3
|
||||
|
Reference in New Issue
Block a user