[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Jan 2024 22:44:49 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363 Kyle Evans <kevans@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kevans@freebsd.org --- Comment #2 from Kyle Evans <kevans@freebsd.org> --- (In reply to Aaron LI from comment #1) I would perhaps reorganize it slightly at that point: static inline unsigned int calculate_padding(struct wg_packet *pkt) { unsigned int padded_size, last_unit = pkt->p_mbuf->m_pkthdr.len; padded_size = (last_unit + (WG_PKT_PADDING - 1)) & ~(WG_PKT_PADDING - 1); if (__predict_true(pkt->p_mtu != 0)) { if (__predict_false(last_unit > pkt->p_mtu)) last_unit %= pkt->p_mtu; if (pkt->p_mtu < padded_size) padded_size = pkt->p_mtu; } return (padded_size - last_unit); } -- You are receiving this mail because: You are the assignee for the bug.