View | Details | Raw Unified | Return to bug 264115
Collapse All | Expand All

(-)b/sys/dev/wg/if_wg.c (-6 / +4 lines)
Lines 1517-1524 wg_encrypt(struct wg_softc *sc, struct wg_packet *pkt) Link Here
1517
	state = WG_PACKET_CRYPTED;
1517
	state = WG_PACKET_CRYPTED;
1518
out:
1518
out:
1519
	pkt->p_mbuf = m;
1519
	pkt->p_mbuf = m;
1520
	wmb();
1520
	atomic_store_rel_int(&pkt->p_state, state);
1521
	pkt->p_state = state;
1522
	GROUPTASK_ENQUEUE(&peer->p_send);
1521
	GROUPTASK_ENQUEUE(&peer->p_send);
1523
	noise_remote_put(remote);
1522
	noise_remote_put(remote);
1524
}
1523
}
Lines 1590-1597 wg_decrypt(struct wg_softc *sc, struct wg_packet *pkt) Link Here
1590
	state = WG_PACKET_CRYPTED;
1589
	state = WG_PACKET_CRYPTED;
1591
out:
1590
out:
1592
	pkt->p_mbuf = m;
1591
	pkt->p_mbuf = m;
1593
	wmb();
1592
	atomic_store_rel_int(&pkt->p_state, state);
1594
	pkt->p_state = state;
1595
	GROUPTASK_ENQUEUE(&peer->p_recv);
1593
	GROUPTASK_ENQUEUE(&peer->p_recv);
1596
	noise_remote_put(remote);
1594
	noise_remote_put(remote);
1597
}
1595
}
Lines 1647-1653 wg_deliver_out(struct wg_peer *peer) Link Here
1647
	wg_peer_get_endpoint(peer, &endpoint);
1645
	wg_peer_get_endpoint(peer, &endpoint);
1648
1646
1649
	while ((pkt = wg_queue_dequeue_serial(&peer->p_encrypt_serial)) != NULL) {
1647
	while ((pkt = wg_queue_dequeue_serial(&peer->p_encrypt_serial)) != NULL) {
1650
		if (pkt->p_state != WG_PACKET_CRYPTED)
1648
		if (atomic_load_acq_int(&pkt->p_state) != WG_PACKET_CRYPTED)
1651
			goto error;
1649
			goto error;
1652
1650
1653
		m = pkt->p_mbuf;
1651
		m = pkt->p_mbuf;
Lines 1689-1695 wg_deliver_in(struct wg_peer *peer) Link Here
1689
	struct epoch_tracker	 et;
1687
	struct epoch_tracker	 et;
1690
1688
1691
	while ((pkt = wg_queue_dequeue_serial(&peer->p_decrypt_serial)) != NULL) {
1689
	while ((pkt = wg_queue_dequeue_serial(&peer->p_decrypt_serial)) != NULL) {
1692
		if (pkt->p_state != WG_PACKET_CRYPTED)
1690
		if (atomic_load_acq_int(&pkt->p_state) != WG_PACKET_CRYPTED)
1693
			goto error;
1691
			goto error;
1694
1692
1695
		m = pkt->p_mbuf;
1693
		m = pkt->p_mbuf;

Return to bug 264115