From afa6f7119c9d27414bb71a09c0fb67ea9ef45bd8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 7 Apr 2022 21:50:57 +0200 Subject: [PATCH] tr-bridge: manually filter non-LLC frames in software --- tr-bridge.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tr-bridge.c b/tr-bridge.c index 4db9bb7..49123f3 100644 --- a/tr-bridge.c +++ b/tr-bridge.c @@ -214,6 +214,11 @@ static int eth2tr(struct bridge_state *bst) return 0; } + if (ethh->h_proto != htons(ETH_P_802_2)) { + fprintf(stderr, "TR<-ETH: Not bridging unexpected frame for proto 0x%04x\n", ntohs(ethh->h_proto)); + return 0; + } + trh.ac = AC; trh.fc = LLC_FRAME; memcpy(&trh.daddr, ethh->h_dest, sizeof(trh.daddr)); @@ -259,6 +264,11 @@ static int tr2eth(struct bridge_state *bst) return 0; } + if (trh->fc != LLC_FRAME) { + fprintf(stderr, "TR->ETH: Not bridging unexpected non-LLC frame for FC 0x%02x\n", trh->fc); + return 0; + } + memcpy(ðh.h_dest, trh->daddr, sizeof(ethh.h_dest)); osmo_revbytebits_buf(ethh.h_dest, TR_ALEN); memcpy(ðh.h_source, trh->saddr, sizeof(ethh.h_source));