Skip to content

Commit 361bf0a

Browse files
committed
cilium: change comment to test clang-tidy workflow
Signed-off-by: Jarno Rajahalme <[email protected]>
1 parent 8e7ce6b commit 361bf0a

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

cilium/network_policy.cc

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ IpAddressPair::IpAddressPair(const cilium::NetworkPolicy& proto) {
7575

7676
class HeaderMatch : public Logger::Loggable<Logger::Id::config> {
7777
public:
78-
HeaderMatch(const NetworkPolicyMap& parent, const cilium::HeaderMatch& config)
79-
: name_(config.name()), value_(config.value()), match_action_(config.match_action()),
78+
HeaderMatch(const NetworkPolicyMap& parent, const cilium::HeaderMatch& config) : name_(config.name()), value_(config.value()), match_action_(config.match_action()),
8079
mismatch_action_(config.mismatch_action()) {
8180
if (config.value_sds_secret().length() > 0) {
8281
secret_ = std::make_unique<SecretWatcher>(parent, config.value_sds_secret());
@@ -94,30 +93,30 @@ class HeaderMatch : public Logger::Loggable<Logger::Id::config> {
9493
// Returns 'true' if matching can continue
9594
bool allowed(Envoy::Http::RequestHeaderMap& headers, Cilium::AccessLog::Entry& log_entry) const {
9695
bool matches = false;
97-
const std::string* match_value = &value_;
96+
const std::string* matchValue = &value_;
9897
const auto header_value = Http::HeaderUtility::getAllOfHeaderAsString(headers, name_);
9998

10099
// Get secret value?
101100
if (secret_) {
102101
auto* secret_value = secret_->value();
103102
if (secret_value) {
104-
match_value = secret_value;
103+
matchValue = secret_value;
105104
} else if (value_.length() == 0) {
106-
// fail if secret has no value and the inline value to match is also empty
105+
// Fail if secret has no value and the inline value to match is also empty.
107106
ENVOY_LOG(info, "Cilium HeaderMatch missing SDS secret value for header {}", name_);
108107
return false;
109108
}
110109
}
111110

112111
// Perform presence match if the value to match is empty
113-
bool is_present_match = match_value->length() == 0;
112+
bool is_present_match = matchValue->length() == 0;
114113
if (is_present_match) {
115114
matches = header_value.result().has_value();
116115
} else if (header_value.result().has_value()) {
117116
const absl::string_view val = header_value.result().value();
118-
if (val.length() == match_value->length()) {
117+
if (val.length() == matchValue->length()) {
119118
// Use constant time comparison for security reason
120-
matches = CRYPTO_memcmp(val.data(), match_value->data(), match_value->length()) == 0;
119+
matches = CRYPTO_memcmp(val.data(), matchValue->data(), matchValue->length()) == 0;
121120
}
122121
}
123122

@@ -128,10 +127,10 @@ class HeaderMatch : public Logger::Loggable<Logger::Id::config> {
128127
return true;
129128
case cilium::HeaderMatch::FAIL_ON_MATCH:
130129
default: // fail closed if unknown action
131-
logRejected(log_entry, *match_value);
130+
logRejected(log_entry, *matchValue);
132131
return false;
133132
case cilium::HeaderMatch::DELETE_ON_MATCH:
134-
logRejected(log_entry, *match_value);
133+
logRejected(log_entry, *matchValue);
135134
headers.remove(name_);
136135
return true;
137136
}
@@ -140,14 +139,14 @@ class HeaderMatch : public Logger::Loggable<Logger::Id::config> {
140139
switch (mismatch_action_) {
141140
case cilium::HeaderMatch::FAIL_ON_MISMATCH:
142141
default:
143-
logMissing(log_entry, *match_value);
142+
logMissing(log_entry, *matchValue);
144143
return false;
145144
case cilium::HeaderMatch::CONTINUE_ON_MISMATCH:
146-
logMissing(log_entry, *match_value);
145+
logMissing(log_entry, *matchValue);
147146
return true;
148147
case cilium::HeaderMatch::ADD_ON_MISMATCH:
149-
headers.addCopy(name_, *match_value);
150-
logMissing(log_entry, *match_value);
148+
headers.addCopy(name_, *matchValue);
149+
logMissing(log_entry, *matchValue);
151150
return true;
152151
case cilium::HeaderMatch::DELETE_ON_MISMATCH:
153152
if (is_present_match) {
@@ -168,9 +167,9 @@ class HeaderMatch : public Logger::Loggable<Logger::Id::config> {
168167
logRejected(log_entry, header_value.result().value());
169168
}
170169
// Set the expected value
171-
headers.setCopy(name_, *match_value);
170+
headers.setCopy(name_, *matchValue);
172171
// Log the expected value as missing
173-
logMissing(log_entry, *match_value);
172+
logMissing(log_entry, *matchValue);
174173
return true;
175174
}
176175
}

0 commit comments

Comments
 (0)