summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
authorXavier Simonart <simonartxavier@gmail.com>2021-09-11 18:06:43 +0000
committerXavier Simonart <simonartxavier@gmail.com>2021-09-11 18:07:43 +0000
commit5815cd749e9c23422e4d04bf00920e493efa4be8 (patch)
tree102b26a9a3a5e7390040c226b815e0407f617917 /VNFs
parent57d5ce26e8bca43631f9e71607f0cfbb254906ac (diff)
swap: prevent printing continuous warning messages for STP and LLDP
Some switches send frequent STP (Spanning Tree) and LLDP (Link Layer Discovery Protocol) messages. Handle_swap was printing a warning message for each of them. Now a warning will only be printed for the first message of each type. Signed-off-by: Xavier Simonart <simonartxavier@gmail.com> Change-Id: I5a8ef7b76c492451aae66fd1533c61927bc6d8f1
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/handle_swap.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/VNFs/DPPD-PROX/handle_swap.c b/VNFs/DPPD-PROX/handle_swap.c
index 094199e4..06bbc6de 100644
--- a/VNFs/DPPD-PROX/handle_swap.c
+++ b/VNFs/DPPD-PROX/handle_swap.c
@@ -196,6 +196,8 @@ static int handle_swap_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, ui
struct igmpv2_hdr *pigmp;
prox_rte_icmp_hdr *picmp;
uint8_t type;
+ static int llc_printed = 0;
+ static int lldp_printed = 0;
for (j = 0; j < n_pkts; ++j) {
PREFETCH0(mbufs[j]);
@@ -279,9 +281,31 @@ static int handle_swap_bulk(struct task_base *tbase, struct rte_mbuf **mbufs, ui
handle_ipv6(task, mbufs[j], ipv6_hdr, &out[j]);
continue;
case ETYPE_LLDP:
+ if (!lldp_printed) {
+ plog_info("Discarding LLDP packets (only printed once)\n");
+ lldp_printed = 1;
+ }
out[j] = OUT_DISCARD;
continue;
default:
+ if ((rte_bswap16(hdr->ether_type) < 0x600) && (rte_bswap16(hdr->ether_type) >= 16)) {
+ // 802.3
+ struct prox_llc {
+ uint8_t dsap;
+ uint8_t lsap;
+ uint8_t control;
+ };
+ struct prox_llc *llc = (struct prox_llc *)(hdr + 1);
+ if ((llc->dsap == 0x42) && (llc->lsap == 0x42)) {
+ // STP Protocol
+ out[j] = OUT_DISCARD;
+ if (!llc_printed) {
+ plog_info("Discarding STP packets (only printed once)\n");
+ llc_printed = 1;
+ }
+ continue;
+ }
+ }
plog_warn("Unsupported ether_type 0x%x\n", hdr->ether_type);
out[j] = OUT_DISCARD;
continue;