tr-bridge: manually filter non-LLC frames in software

This commit is contained in:
Harald Welte 2022-04-07 21:50:57 +02:00
parent 8e888081c7
commit afa6f7119c
1 changed files with 10 additions and 0 deletions

View File

@ -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(&ethh.h_dest, trh->daddr, sizeof(ethh.h_dest));
osmo_revbytebits_buf(ethh.h_dest, TR_ALEN);
memcpy(&ethh.h_source, trh->saddr, sizeof(ethh.h_source));