aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-04-22 00:13:28 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2021-04-22 00:38:40 -0600
commit2e200c8cf3963a1bd8b754eb0654df91fc8a8e77 (patch)
tree77168c3b281b7d70ba45b2f6911298b95fcb4c79
parentif_wg: more thorough wg_mbuf_reset (diff)
downloadwireguard-freebsd-2e200c8cf3963a1bd8b754eb0654df91fc8a8e77.tar.xz
wireguard-freebsd-2e200c8cf3963a1bd8b754eb0654df91fc8a8e77.zip
global: add missing brackets
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/if_wg.c3
-rw-r--r--src/wg_noise.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index 0438c69..9a33adf 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -1422,10 +1422,11 @@ wg_mbuf_reset(struct mbuf *m)
#ifdef NUMA
m->m_pkthdr.numa_domain = M_NODOM;
#endif
- SLIST_FOREACH_SAFE(t, &m->m_pkthdr.tags, m_tag_link, tmp)
+ SLIST_FOREACH_SAFE(t, &m->m_pkthdr.tags, m_tag_link, tmp) {
if (t->m_tag_id != 0 && t->m_tag_cookie != MTAG_WGLOOP &&
t->m_tag_id != PACKET_TAG_MACLABEL)
m_tag_delete(m, t);
+ }
if (m->m_pkthdr.csum_flags & CSUM_SND_TAG)
m_snd_tag_rele(m->m_pkthdr.snd_tag);
diff --git a/src/wg_noise.c b/src/wg_noise.c
index b996d3b..b188ece 100644
--- a/src/wg_noise.c
+++ b/src/wg_noise.c
@@ -389,9 +389,10 @@ noise_remote_index_insert(struct noise_local *l, struct noise_remote *r)
assign_id:
r_i->i_local_index = arc4random();
idx = r_i->i_local_index & HT_INDEX_MASK;
- CK_LIST_FOREACH(i, &l->l_index_hash[idx], i_entry)
+ CK_LIST_FOREACH(i, &l->l_index_hash[idx], i_entry) {
if (i->i_local_index == r_i->i_local_index)
goto assign_id;
+ }
rw_wlock(&l->l_index_lock);
CK_LIST_FOREACH(i, &l->l_index_hash[idx], i_entry) {