[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-29 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

Kyle Evans  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|In Progress |Closed
  Flags|mfc-stable14?,  |mfc-stable14+,
   |mfc-stable13?   |mfc-stable13+

--- Comment #7 from Kyle Evans  ---
MFC'd to all supported branches; thanks!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-29 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

--- Comment #5 from commit-h...@freebsd.org ---
A commit in branch stable/13 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=bbda52e814e0c760b2beaeae40a2c76ff43d1975

commit bbda52e814e0c760b2beaeae40a2c76ff43d1975
Author: Aaron LI 
AuthorDate: 2024-01-17 23:29:23 +
Commit: Kyle Evans 
CommitDate: 2024-01-30 05:37:46 +

if_wg: fix erroneous calculation in calculate_padding() for p_mtu == 0

In practice this is harmless; only keepalive packets may realistically have
p_mtu == 0, and they'll also have no payload so the math works out the same
either way.  Still, let's prefer technical accuracy and calculate the
amount
of padding needed rather than the padded length...

PR: 276363

(cherry picked from commit b891f61ef538a4e9b4658b4b756635c8036a5788)

 sys/dev/wg/if_wg.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-29 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

--- Comment #6 from commit-h...@freebsd.org ---
A commit in branch stable/14 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=86986d381072171a5d6183701ae2f96c2d9a6406

commit 86986d381072171a5d6183701ae2f96c2d9a6406
Author: Aaron LI 
AuthorDate: 2024-01-17 23:29:23 +
Commit: Kyle Evans 
CommitDate: 2024-01-30 05:37:29 +

if_wg: fix erroneous calculation in calculate_padding() for p_mtu == 0

In practice this is harmless; only keepalive packets may realistically have
p_mtu == 0, and they'll also have no payload so the math works out the same
either way.  Still, let's prefer technical accuracy and calculate the
amount
of padding needed rather than the padded length...

PR: 276363

(cherry picked from commit b891f61ef538a4e9b4658b4b756635c8036a5788)

 sys/dev/wg/if_wg.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-17 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

Kyle Evans  changed:

   What|Removed |Added

  Flags||mfc-stable13?,
   ||mfc-stable14?,
   ||mfc-stable12-
 CC||n...@freebsd.org
   Assignee|n...@freebsd.org |kev...@freebsd.org
 Status|New |In Progress

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-17 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

--- Comment #4 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=b891f61ef538a4e9b4658b4b756635c8036a5788

commit b891f61ef538a4e9b4658b4b756635c8036a5788
Author: Aaron LI 
AuthorDate: 2024-01-17 23:29:23 +
Commit: Kyle Evans 
CommitDate: 2024-01-17 23:29:52 +

if_wg: fix erroneous calculation in calculate_padding() for p_mtu == 0

In practice this is harmless; only keepalive packets may realistically have
p_mtu == 0, and they'll also have no payload so the math works out the same
either way.  Still, let's prefer technical accuracy and calculate the
amount
of padding needed rather than the padded length...

PR: 276363

 sys/dev/wg/if_wg.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-17 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

--- Comment #3 from Kyle Evans  ---
(In reply to Kyle Evans from comment #2)

WHoops, sorry, of course we need to re-calculate padded_size.

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-17 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

Kyle Evans  changed:

   What|Removed |Added

 CC||kev...@freebsd.org

--- Comment #2 from Kyle Evans  ---
(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.


[Bug 276363] if_wg: Fix bug in calculate_padding() for the 'p_mtu = 0' case

2024-01-16 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276363

Mark Linimon  changed:

   What|Removed |Added

   Assignee|b...@freebsd.org|n...@freebsd.org

-- 
You are receiving this mail because:
You are the assignee for the bug.