git: 809fef291357 - main - netipsec: move specific ipsecmethods declarations to ipsec_support.h

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Tue, 04 Oct 2022 03:57:36 UTC
The branch main has been updated by glebius:

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

commit 809fef2913574cb37d2dadc00abfd62619d52040
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-10-04 03:53:04 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-10-04 03:53:04 +0000

    netipsec: move specific ipsecmethods declarations to ipsec_support.h
    
    where struct ipsec_methods is defined.  Not a functional change.
    Allows further modification of method prototypes without breaking
    compilation of other ipsec compilation units.
    
    Differential revision:  https://reviews.freebsd.org/D36730
---
 sys/netipsec/ipsec.h         |  9 ---------
 sys/netipsec/ipsec6.h        |  7 -------
 sys/netipsec/ipsec_input.c   |  1 +
 sys/netipsec/ipsec_output.c  |  1 +
 sys/netipsec/ipsec_support.h | 22 ++++++++++++++++++++++
 5 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h
index 85360f9b737c..e29fdbe29fa0 100644
--- a/sys/netipsec/ipsec.h
+++ b/sys/netipsec/ipsec.h
@@ -325,8 +325,6 @@ u_int ipsec_get_reqlevel(struct secpolicy *, u_int);
 
 void udp_ipsec_adjust_cksum(struct mbuf *, struct secasvar *, int, int);
 int udp_ipsec_output(struct mbuf *, struct secasvar *);
-int udp_ipsec_input(struct mbuf *, int, int);
-int udp_ipsec_pcbctl(struct inpcb *, struct sockopt *);
 
 int ipsec_chkreplay(uint32_t, uint32_t *, struct secasvar *);
 int ipsec_updatereplay(uint32_t, struct secasvar *);
@@ -338,14 +336,7 @@ void ipsec_setspidx_inpcb(struct inpcb *, struct secpolicyindex *, u_int);
 
 void ipsec4_setsockaddrs(const struct mbuf *, union sockaddr_union *,
     union sockaddr_union *);
-int ipsec4_in_reject(const struct mbuf *, struct inpcb *);
-int ipsec4_input(struct mbuf *, int, int);
-int ipsec4_forward(struct mbuf *);
-int ipsec4_pcbctl(struct inpcb *, struct sockopt *);
-int ipsec4_output(struct mbuf *, struct inpcb *);
-int ipsec4_capability(struct mbuf *, u_int);
 int ipsec4_common_input_cb(struct mbuf *, struct secasvar *, int, int);
-int ipsec4_ctlinput(int, struct sockaddr *, void *);
 int ipsec4_check_pmtu(struct mbuf *, struct secpolicy *, int);
 int ipsec4_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *);
 int ipsec_process_done(struct mbuf *, struct secpolicy *, struct secasvar *,
diff --git a/sys/netipsec/ipsec6.h b/sys/netipsec/ipsec6.h
index f690102fae2b..3654466a2889 100644
--- a/sys/netipsec/ipsec6.h
+++ b/sys/netipsec/ipsec6.h
@@ -66,14 +66,7 @@ struct secpolicy *ipsec6_checkpolicy(const struct mbuf *,
 
 void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *,
     union sockaddr_union *);
-int ipsec6_input(struct mbuf *, int, int);
-int ipsec6_in_reject(const struct mbuf *, struct inpcb *);
-int ipsec6_forward(struct mbuf *);
-int ipsec6_pcbctl(struct inpcb *, struct sockopt *);
-int ipsec6_output(struct mbuf *, struct inpcb *);
-int ipsec6_capability(struct mbuf *, u_int);
 int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int);
-int ipsec6_ctlinput(int, struct sockaddr *, void *);
 int ipsec6_check_pmtu(struct mbuf *, struct secpolicy *, int);
 int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *);
 
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index 7effed48121a..fcc0b1999c63 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$");
 #ifdef INET6
 #include <netipsec/ipsec6.h>
 #endif
+#include <netipsec/ipsec_support.h>
 #include <netipsec/ah_var.h>
 #include <netipsec/esp.h>
 #include <netipsec/esp_var.h>
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index 26588db6371b..ff0175e417cd 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -84,6 +84,7 @@
 #ifdef INET6
 #include <netipsec/ipsec6.h>
 #endif
+#include <netipsec/ipsec_support.h>
 #include <netipsec/ah_var.h>
 #include <netipsec/esp_var.h>
 #include <netipsec/ipcomp_var.h>
diff --git a/sys/netipsec/ipsec_support.h b/sys/netipsec/ipsec_support.h
index e4d0aea906f1..f285c31efa05 100644
--- a/sys/netipsec/ipsec_support.h
+++ b/sys/netipsec/ipsec_support.h
@@ -44,6 +44,28 @@ int ipsec_init_pcbpolicy(struct inpcb *);
 int ipsec_delete_pcbpolicy(struct inpcb *);
 int ipsec_copy_pcbpolicy(struct inpcb *, struct inpcb *);
 
+#ifdef INET
+int udp_ipsec_input(struct mbuf *, int, int);
+int udp_ipsec_pcbctl(struct inpcb *, struct sockopt *);
+int ipsec4_in_reject(const struct mbuf *, struct inpcb *);
+int ipsec4_input(struct mbuf *, int, int);
+int ipsec4_forward(struct mbuf *);
+int ipsec4_pcbctl(struct inpcb *, struct sockopt *);
+int ipsec4_output(struct mbuf *, struct inpcb *);
+int ipsec4_capability(struct mbuf *, u_int);
+int ipsec4_ctlinput(int, struct sockaddr *, void *);
+#endif /* INET */
+
+#ifdef INET6
+int ipsec6_input(struct mbuf *, int, int);
+int ipsec6_in_reject(const struct mbuf *, struct inpcb *);
+int ipsec6_forward(struct mbuf *);
+int ipsec6_pcbctl(struct inpcb *, struct sockopt *);
+int ipsec6_output(struct mbuf *, struct inpcb *);
+int ipsec6_capability(struct mbuf *, u_int);
+int ipsec6_ctlinput(int, struct sockaddr *, void *);
+#endif /* INET6 */
+
 struct ipsec_methods {
 	int	(*input)(struct mbuf *, int, int);
 	int	(*check_policy)(const struct mbuf *, struct inpcb *);