Skip to content

Commit 58f36a1

Browse files
tagrawal03meta-codesync[bot]
authored andcommitted
Fix TPR to explicitly prevent usage on big-endian architectures
Summary: Fix TPR to explicitly prevent usage on big-endian architectures where byte-order issues would cause routing errors. https://fb.workplace.com/groups/592309277200280/permalink/659068030524404/ Detailed document explaining the issue: https://docs.google.com/document/d/1kOW2XtuWPV3hkfS7dCGZyIJoMNUmzwSQg53L6cxpr84/edit?usp=sharing Reviewed By: avasylev Differential Revision: D84927432 fbshipit-source-id: 4c510aac61b083ebf9ef2d19a575ebe0aa874b7f
1 parent 0331422 commit 58f36a1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

katran/tpr/TcpPktRouter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ TcpPktRouter::~TcpPktRouter() {
3131
folly::Expected<folly::Unit, std::system_error> TcpPktRouter::init(
3232
bool pollStats) {
3333
CHECK(!isInitialized_);
34+
35+
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
36+
static_assert(
37+
false,
38+
"TPR cannot run on big-endian architecture due to server_id byte-order "
39+
"requirements");
40+
#endif
41+
3442
auto res = BpfUtil::init();
3543
if (res.hasError()) {
3644
return makeError(res.error(), __func__);

0 commit comments

Comments
 (0)