git: 8fc80638496e - main - divert: merge div_output() into div_send()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Aug 2022 02:24:57 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=8fc80638496e620519b2585d9fab409494ea4b43
commit 8fc80638496e620519b2585d9fab409494ea4b43
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-08-30 02:15:01 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-08-30 02:15:01 +0000
divert: merge div_output() into div_send()
No functional change intended.
---
sys/netinet/ip_divert.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index b4730b069fc1..d14ec5190ad0 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -293,18 +293,25 @@ divert_packet(struct mbuf *m, bool incoming)
* the interface with that address.
*/
static int
-div_output(struct socket *so, struct mbuf *m, struct sockaddr_in *sin,
- struct mbuf *control)
+div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
+ struct mbuf *control, struct thread *td)
{
struct epoch_tracker et;
+ struct sockaddr_in *sin = (struct sockaddr_in *)nam;
const struct ip *ip;
struct m_tag *mtag;
struct ipfw_rule_ref *dt;
int error, family;
- if (control) {
- m_freem(control); /* XXX */
- control = NULL;
+ if (control)
+ m_freem(control);
+
+ /* Packet must have a header (but that's about it) */
+ if (m->m_len < sizeof (struct ip) &&
+ (m = m_pullup(m, sizeof (struct ip))) == NULL) {
+ KMOD_IPSTAT_INC(ips_toosmall);
+ m_freem(m);
+ return (EINVAL);
}
if (sin != NULL) {
@@ -634,25 +641,6 @@ div_shutdown(struct socket *so)
return 0;
}
-static int
-div_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
- struct mbuf *control, struct thread *td)
-{
-
- /* Packet must have a header (but that's about it) */
- if (m->m_len < sizeof (struct ip) &&
- (m = m_pullup(m, sizeof (struct ip))) == NULL) {
- KMOD_IPSTAT_INC(ips_toosmall);
- if (control != NULL)
- m_freem(control);
- m_freem(m);
- return EINVAL;
- }
-
- /* Send packet */
- return div_output(so, m, (struct sockaddr_in *)nam, control);
-}
-
static int
div_pcblist(SYSCTL_HANDLER_ARGS)
{