git: 1aed3b34301e - main - udp: add protocol method declarations to udp_var.h

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Wed, 07 Dec 2022 19:52:02 UTC
The branch main has been updated by glebius:

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

commit 1aed3b34301e33eb8f64d7abc968fcbe5d6171ca
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-12-07 19:51:49 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-12-07 19:51:49 +0000

    udp: add protocol method declarations to udp_var.h
    
    They are shared between UDP over IPv4 and over IPv6.  To prevent all
    possible kernel build failures wrap them in #ifdef _SYS_PROTOSW_H_.
    Prompted by feedback from jhb@ and jrtc27@ on c93db4abf454.
---
 sys/netinet/tcp_syncache.c | 1 -
 sys/netinet/udp_usrreq.c   | 3 ---
 sys/netinet/udp_var.h      | 6 ++++++
 sys/netinet6/udp6_usrreq.c | 6 ------
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index ad1811fc68cd..00d0ac2fa9d5 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$");
 #include <netinet/toecore.h>
 #endif
 #include <netinet/udp.h>
-#include <netinet/udp_var.h>
 
 #include <netipsec/ipsec_support.h>
 
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 011e20692935..19c163e95094 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1037,7 +1037,6 @@ udp_v4mapped_pktinfo(struct cmsghdr *cm, struct sockaddr_in * src,
 }
 #endif	/* INET6 */
 
-pr_send_t udp_send;			/* shared with udp6_usrreq.c */
 int
 udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
     struct mbuf *control, struct thread *td)
@@ -1445,7 +1444,6 @@ release:
 	return (error);
 }
 
-pr_abort_t udp_abort;			/* shared with udp6_usrreq.c */
 void
 udp_abort(struct socket *so)
 {
@@ -1630,7 +1628,6 @@ udp_detach(struct socket *so)
 	in_pcbfree(inp);
 }
 
-pr_disconnect_t udp_disconnect;		/* shared with udp6_usrreq.c */
 int
 udp_disconnect(struct socket *so)
 {
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 26e56be53f16..2b91518c0ff3 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -176,6 +176,12 @@ int		udp_shutdown(struct socket *so);
 int		udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f,
 		    udp_tun_icmp_t i, void *ctx);
 
+#ifdef _SYS_PROTOSW_H_
+pr_abort_t	udp_abort;
+pr_disconnect_t	udp_disconnect;
+pr_send_t	udp_send;
+#endif
+
 #endif /* _KERNEL */
 
 #endif /* _NETINET_UDP_VAR_H_ */
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 79fe7d4cc0fb..484f43d24808 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -131,12 +131,6 @@ SYSCTL_INT(_net_inet6_udp6, OID_AUTO, rfc6935_port, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(zero_checksum_port), 0,
     "Zero UDP checksum allowed for traffic to/from this port.");
 
-
-/* netinet/udp_usrreqs.c */
-pr_abort_t	udp_abort;
-pr_disconnect_t	udp_disconnect;
-pr_send_t	udp_send;
-
 /*
  * UDP protocol implementation.
  * Per RFC 768, August, 1980.