git: 299f8977cef6 - main - if_wg: wg_input: remove a couple locals (NFC)

Kyle Evans kevans at FreeBSD.org
Tue Mar 9 19:49:25 UTC 2021


The branch main has been updated by kevans:

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

commit 299f8977cef66d19c05d52d19b892fd8c7a235ea
Author:     Kyle Evans <kevans at FreeBSD.org>
AuthorDate: 2021-03-09 10:59:21 +0000
Commit:     Kyle Evans <kevans at FreeBSD.org>
CommitDate: 2021-03-09 19:49:13 +0000

    if_wg: wg_input: remove a couple locals (NFC)
    
    We have no use for the udphdr or this hlen local, just spell out the
    addition inline.
    
    MFC after:      3 days
    Reviewed by:    grehan, markj
    Differential Revision:  https://reviews.freebsd.org/D29142
---
 sys/dev/if_wg/module/if_wg_session.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c
index ae9e44cffef5..5360b047426b 100644
--- a/sys/dev/if_wg/module/if_wg_session.c
+++ b/sys/dev/if_wg/module/if_wg_session.c
@@ -1891,17 +1891,14 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb,
 	struct wg_pkt_data *pkt_data;
 	struct wg_endpoint *e;
 	struct wg_softc *sc = _sc;
-	struct udphdr *uh;
 	struct mbuf *m;
-	int pktlen, pkttype, hlen;
+	int pktlen, pkttype;
 	struct noise_remote *remote;
 	struct wg_tag *t;
 	void *data;
 
-	uh = (struct udphdr *)(m0->m_data + offset);
-	hlen = offset + sizeof(struct udphdr);
-
-	m_adj(m0, hlen);
+	/* Caller provided us with srcsa, no need for this header. */
+	m_adj(m0, offset + sizeof(struct udphdr));
 
 	/*
 	 * Ensure mbuf has at least enough contiguous data to peel off our


More information about the dev-commits-src-main mailing list