Hi Florian, 2020-06-24, 10:08:00 +0200, Florian Westphal wrote: > After previous patch, we can consolidate some code: > > xfrm_replay_notify, xfrm_replay_notify_bmp and _esn all contain the > same code at the end. > > Remove it from xfrm_replay_notify_bmp/esn and reuse the one > in xfrm_replay_notify. > > Signed-off-by: Florian Westphal <f...@strlen.de> > --- > net/xfrm/xfrm_replay.c | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > > diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c > index e42a7afb8ee5..fac2f3af4c1a 100644 > --- a/net/xfrm/xfrm_replay.c > +++ b/net/xfrm/xfrm_replay.c > @@ -56,10 +56,10 @@ void xfrm_replay_notify(struct xfrm_state *x, int event) > break; > case XFRM_REPLAY_MODE_BMP: > xfrm_replay_notify_bmp(x, event); > - return; > + goto notify; > case XFRM_REPLAY_MODE_ESN: > xfrm_replay_notify_esn(x, event); > - return; > + goto notify;
These two functions have some early returns that skip the notification, but now the notification will be sent in all cases: static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event) { <snip> switch (event) { case XFRM_REPLAY_UPDATE: if (...) { if (x->xflags & XFRM_TIME_DEFER) event = XFRM_REPLAY_TIMEOUT; else return; } break; And this also changes the value that ends up in c.data.aevent. That change will be lost after this patch. > } > > switch (event) { > @@ -86,6 +86,8 @@ void xfrm_replay_notify(struct xfrm_state *x, int event) > } > > memcpy(&x->preplay, &x->replay, sizeof(struct xfrm_replay_state)); > + > +notify: > c.event = XFRM_MSG_NEWAE; > c.data.aevent = event; > km_state_notify(x, &c); -- Sabrina