clang-format: Set penalty for breaking after assignment operator

This commit is contained in:
Tim Wojtulewicz 2021-09-24 16:06:13 -07:00
parent 4423574d26
commit 9af6b2f48d
54 changed files with 255 additions and 247 deletions

View file

@ -49,11 +49,11 @@ bool ICMPAnalyzer::BuildConnTuple(size_t len, const uint8_t* data, Packet* packe
tuple.src_port = htons(icmpp->icmp_type);
if ( packet->proto == IPPROTO_ICMP )
tuple.dst_port =
htons(ICMP4_counterpart(icmpp->icmp_type, icmpp->icmp_code, tuple.is_one_way));
tuple.dst_port = htons(
ICMP4_counterpart(icmpp->icmp_type, icmpp->icmp_code, tuple.is_one_way));
else if ( packet->proto == IPPROTO_ICMPV6 )
tuple.dst_port =
htons(ICMP6_counterpart(icmpp->icmp_type, icmpp->icmp_code, tuple.is_one_way));
tuple.dst_port = htons(
ICMP6_counterpart(icmpp->icmp_type, icmpp->icmp_code, tuple.is_one_way));
else
reporter->InternalError("Reached ICMP packet analyzer with unknown packet protocol %x",
packet->proto);
@ -280,11 +280,11 @@ TransportProto ICMPAnalyzer::GetContextProtocol(const IP_Hdr* ip_hdr, uint32_t*
*src_port = ntohs(icmpp->icmp_type);
if ( ip4 )
*dst_port =
ntohs(ICMP4_counterpart(icmpp->icmp_type, icmpp->icmp_code, is_one_way));
*dst_port = ntohs(
ICMP4_counterpart(icmpp->icmp_type, icmpp->icmp_code, is_one_way));
else
*dst_port =
ntohs(ICMP6_counterpart(icmpp->icmp_type, icmpp->icmp_code, is_one_way));
*dst_port = ntohs(
ICMP6_counterpart(icmpp->icmp_type, icmpp->icmp_code, is_one_way));
break;
}

View file

@ -160,8 +160,8 @@ zeek::Connection* IPBasedAnalyzer::NewConn(const ConnTuple* id, const detail::Co
if ( ! WantConnection(src_h, dst_h, pkt->ip_hdr->Payload(), flip) )
return nullptr;
Connection* conn =
new Connection(key, run_state::processing_start_time, id, pkt->ip_hdr->FlowLabel(), pkt);
Connection* conn = new Connection(key, run_state::processing_start_time, id,
pkt->ip_hdr->FlowLabel(), pkt);
conn->SetTransport(transport);
if ( flip )
@ -293,7 +293,7 @@ void IPBasedAnalyzer::SetIgnoreChecksumsNets(TableValPtr t)
TableValPtr IPBasedAnalyzer::GetIgnoreChecksumsNets()
{
if ( ! IPBasedAnalyzer::ignore_checksums_nets_table )
IPBasedAnalyzer::ignore_checksums_nets_table =
zeek::id::find_val<TableVal>("ignore_checksums_nets");
IPBasedAnalyzer::ignore_checksums_nets_table = zeek::id::find_val<TableVal>(
"ignore_checksums_nets");
return IPBasedAnalyzer::ignore_checksums_nets_table;
}

View file

@ -636,8 +636,8 @@ void TCPSessionAdapter::Process(bool is_orig, const struct tcphdr* tp, int len,
else
{
bool ack_underflow = false;
rel_ack =
get_relative_seq(peer, ack_seq, peer->AckSeq(), peer->AckWraps(), &ack_underflow);
rel_ack = get_relative_seq(peer, ack_seq, peer->AckSeq(), peer->AckWraps(),
&ack_underflow);
if ( ack_underflow )
{
@ -1614,10 +1614,10 @@ void TCPSessionAdapter::AddExtraAnalyzers(Connection* conn)
if ( tcp_contents && ! reass )
{
static auto tcp_content_delivery_ports_orig =
id::find_val<TableVal>("tcp_content_delivery_ports_orig");
static auto tcp_content_delivery_ports_resp =
id::find_val<TableVal>("tcp_content_delivery_ports_resp");
static auto tcp_content_delivery_ports_orig = id::find_val<TableVal>(
"tcp_content_delivery_ports_orig");
static auto tcp_content_delivery_ports_resp = id::find_val<TableVal>(
"tcp_content_delivery_ports_resp");
const auto& dport = val_mgr->Port(ntohs(Conn()->RespPort()), TRANSPORT_TCP);
if ( ! reass )
@ -1821,8 +1821,8 @@ int TCPSessionAdapter::ParseTCPOptions(const struct tcphdr* tcp, bool is_orig)
void TCPSessionAdapter::CheckRecording(bool need_contents, analyzer::tcp::TCP_Flags flags)
{
bool record_current_content = need_contents || Conn()->RecordContents();
bool record_current_packet =
Conn()->RecordPackets() || flags.SYN() || flags.FIN() || flags.RST();
bool record_current_packet = Conn()->RecordPackets() || flags.SYN() || flags.FIN() ||
flags.RST();
Conn()->SetRecordCurrentContent(record_current_content);
Conn()->SetRecordCurrentPacket(record_current_packet);

View file

@ -102,9 +102,10 @@ void UDPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remai
int chksum = up->uh_sum;
auto validate_checksum =
! run_state::current_pkt->l3_checksummed && ! zeek::detail::ignore_checksums &&
! GetIgnoreChecksumsNets()->Contains(ip->IPHeaderSrcAddr()) && remaining >= len;
auto validate_checksum = ! run_state::current_pkt->l3_checksummed &&
! zeek::detail::ignore_checksums &&
! GetIgnoreChecksumsNets()->Contains(ip->IPHeaderSrcAddr()) &&
remaining >= len;
constexpr auto vxlan_len = 8;
constexpr auto eth_len = 14;
@ -159,10 +160,10 @@ void UDPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remai
if ( udp_contents )
{
static auto udp_content_ports = id::find_val<TableVal>("udp_content_ports");
static auto udp_content_delivery_ports_orig =
id::find_val<TableVal>("udp_content_delivery_ports_orig");
static auto udp_content_delivery_ports_resp =
id::find_val<TableVal>("udp_content_delivery_ports_resp");
static auto udp_content_delivery_ports_orig = id::find_val<TableVal>(
"udp_content_delivery_ports_orig");
static auto udp_content_delivery_ports_resp = id::find_val<TableVal>(
"udp_content_delivery_ports_resp");
bool do_udp_contents = false;
const auto& sport_val = val_mgr->Port(ntohs(up->uh_sport), TRANSPORT_UDP);
const auto& dport_val = val_mgr->Port(ntohs(up->uh_dport), TRANSPORT_UDP);
@ -172,8 +173,8 @@ void UDPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remai
do_udp_contents = true;
else
{
uint16_t p =
zeek::detail::udp_content_delivery_ports_use_resp ? c->RespPort() : up->uh_dport;
uint16_t p = zeek::detail::udp_content_delivery_ports_use_resp ? c->RespPort()
: up->uh_dport;
const auto& port_val = zeek::val_mgr->Port(ntohs(p), TRANSPORT_UDP);
if ( is_orig )