-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Check base diff for context. tl;dr - Validate TPR header server-id with host's server-id. (same as xdpdecap). Note: We need to create copies of `parse_hdr_opt` and `tcp_hdr_opt_lookup_server_id` since the existing functions accept xdp_md struct and `parse_hdr_opt` is a non-inline function called in a loop. The bpf verifier doesn't allow void* to be passed as a function param of a non-inline function and making that function inline singnificantly increases verifier time (since it is called in a loop). Check for more details: D49670259 This is still a no-op as this program isn't used yet Reviewed By: avasylev Differential Revision: D50141892 fbshipit-source-id: 828bb7fc82e985f6a6a7616ac976a3b6b18020de
- Loading branch information
1 parent
33424d7
commit 745374f
Showing
3 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Copyright (C) 2019-present, Facebook, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef __DECAP_STATS_MAPS_H | ||
#define __DECAP_STATS_MAPS_H | ||
|
||
#include "katran/lib/linux_includes/bpf.h" | ||
#include "katran/lib/linux_includes/bpf_helpers.h" | ||
|
||
#include "katran/lib/bpf/balancer_consts.h" | ||
|
||
#ifndef DECAP_STATS_MAP_SIZE | ||
#define DECAP_STATS_MAP_SIZE 1 | ||
#endif | ||
|
||
struct decap_tpr_stats { | ||
__u64 tpr_misrouted; | ||
__u64 tpr_total; | ||
}; | ||
|
||
// map for tpr related counters | ||
struct { | ||
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); | ||
__type(key, __u32); | ||
__type(value, struct decap_tpr_stats); | ||
__uint(max_entries, DECAP_STATS_MAP_SIZE); | ||
__uint(map_flags, NO_FLAGS); | ||
} decap_tpr_counters SEC(".maps"); | ||
|
||
// map, which contains server_id info | ||
struct { | ||
__uint(type, BPF_MAP_TYPE_ARRAY); | ||
__type(key, __u32); | ||
__type(value, __u32); | ||
__uint(max_entries, 1); | ||
__uint(map_flags, NO_FLAGS); | ||
} tpr_server_id SEC(".maps"); | ||
|
||
#endif // of __DECAP_STATS_MAPS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters