netinet*: move ipproto_register() and co to ip_var.h and ip6_var.h

This is a FreeBSD KPI and belongs to private header not netinet/in.h.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36723
This commit is contained in:
Gleb Smirnoff 2022-10-03 20:53:04 -07:00
parent ab9293239c
commit 24b96f35b9
4 changed files with 24 additions and 20 deletions

View File

@ -696,23 +696,6 @@ void in_ifdetach(struct ifnet *);
#define satosin(sa) ((struct sockaddr_in *)(sa))
#define sintosa(sin) ((struct sockaddr *)(sin))
#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
typedef int ipproto_input_t(struct mbuf **, int *, int);
typedef void ipproto_ctlinput_t(int, struct sockaddr *, void *);
int ipproto_register(uint8_t, ipproto_input_t, ipproto_ctlinput_t);
int ipproto_unregister(uint8_t);
int ip6proto_register(uint8_t, ipproto_input_t, ipproto_ctlinput_t);
int ip6proto_unregister(uint8_t);
#define IPPROTO_REGISTER(prot, input, ctl) do { \
int error __diagused; \
error = ipproto_register(prot, input, ctl); \
MPASS(error == 0); \
} while (0)
#define IP6PROTO_REGISTER(prot, input, ctl) do { \
int error __diagused; \
error = ip6proto_register(prot, input, ctl); \
MPASS(error == 0); \
} while (0)
#endif /* _KERNEL */
/* INET6 stuff */

View File

@ -239,6 +239,16 @@ extern int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
extern void (*ip_rsvp_force_done)(struct socket *);
extern int (*rsvp_input_p)(struct mbuf **, int *, int);
typedef int ipproto_input_t(struct mbuf **, int *, int);
typedef void ipproto_ctlinput_t(int, struct sockaddr *, void *);
int ipproto_register(uint8_t, ipproto_input_t, ipproto_ctlinput_t);
int ipproto_unregister(uint8_t);
#define IPPROTO_REGISTER(prot, input, ctl) do { \
int error __diagused; \
error = ipproto_register(prot, input, ctl); \
MPASS(error == 0); \
} while (0)
VNET_DECLARE(struct pfil_head *, inet_pfil_head);
#define V_inet_pfil_head VNET(inet_pfil_head)
#define PFIL_INET_NAME "inet"

View File

@ -131,9 +131,9 @@ __FBSDID("$FreeBSD$");
#include <netinet6/ip6protosw.h>
ipproto_input_t *ip6_protox[IPPROTO_MAX] = {
ip6proto_input_t *ip6_protox[IPPROTO_MAX] = {
[0 ... IPPROTO_MAX - 1] = rip6_input };
ipproto_ctlinput_t *ip6_ctlprotox[IPPROTO_MAX] = {
ip6proto_ctlinput_t *ip6_ctlprotox[IPPROTO_MAX] = {
[0 ... IPPROTO_MAX - 1] = rip6_ctlinput };
VNET_DEFINE(struct in6_ifaddrhead, in6_ifaddrhead);
@ -308,7 +308,8 @@ ip6_init(void *arg __unused)
SYSINIT(ip6_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_init, NULL);
int
ip6proto_register(uint8_t proto, ipproto_input_t input, ipproto_ctlinput_t ctl)
ip6proto_register(uint8_t proto, ip6proto_input_t input,
ip6proto_ctlinput_t ctl)
{
MPASS(proto > 0);

View File

@ -413,6 +413,16 @@ int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
u_int32_t ip6_randomid(void);
u_int32_t ip6_randomflowlabel(void);
void in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
typedef int ip6proto_input_t(struct mbuf **, int *, int);
typedef void ip6proto_ctlinput_t(int, struct sockaddr *, void *);
int ip6proto_register(uint8_t, ip6proto_input_t, ip6proto_ctlinput_t);
int ip6proto_unregister(uint8_t);
#define IP6PROTO_REGISTER(prot, input, ctl) do { \
int error __diagused; \
error = ip6proto_register(prot, input, ctl); \
MPASS(error == 0); \
} while (0)
#endif /* _KERNEL */
#endif /* !_NETINET6_IP6_VAR_H_ */