[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case
| Newsgroups | gmane.os.freebsd.devel.net |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363 Kyle Evans <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #2 from Kyle Evans <[email protected]> --- (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.