diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 22:54:32 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-09 01:57:47 +0200 |
commit | 1564e913bf02a924116497bdb8c1b994298c0465 (patch) | |
tree | bd28848929af527602fd0e8474cf50670221b9a0 /src/receive.c | |
parent | 11d9063c3d2084a6eeb78aaaf5cadc9b8a2ff437 (diff) |
global: give if statements brackets and other cleanups
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/receive.c')
-rw-r--r-- | src/receive.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/receive.c b/src/receive.c index 0a48933..33a60b7 100644 --- a/src/receive.c +++ b/src/receive.c @@ -126,11 +126,11 @@ static void wg_receive_handshake_packet(struct wg_device *wg, mac_state = wg_cookie_validate_packet(&wg->cookie_checker, skb, under_load); if ((under_load && mac_state == VALID_MAC_WITH_COOKIE) || - (!under_load && mac_state == VALID_MAC_BUT_NO_COOKIE)) + (!under_load && mac_state == VALID_MAC_BUT_NO_COOKIE)) { packet_needs_cookie = false; - else if (under_load && mac_state == VALID_MAC_BUT_NO_COOKIE) + } else if (under_load && mac_state == VALID_MAC_BUT_NO_COOKIE) { packet_needs_cookie = true; - else { + } else { net_dbg_skb_ratelimited("%s: Invalid MAC of handshake, dropping packet from %pISpfsc\n", wg->dev->name, skb); return; @@ -392,8 +392,9 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, sizeof(struct ipv6hdr); if (INET_ECN_is_ce(PACKET_CB(skb)->ds)) IP6_ECN_set_ce(skb, ipv6_hdr(skb)); - } else + } else { goto dishonest_packet_type; + } if (unlikely(len > skb->len)) goto dishonest_packet_size; @@ -413,8 +414,9 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, net_dbg_ratelimited("%s: Failed to give packet to userspace from peer %llu (%pISpfsc)\n", dev->name, peer->internal_id, &peer->endpoint.addr); - } else + } else { update_rx_stats(peer, message_data_len(len_before_trim)); + } return; dishonest_packet_peer: |