summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-05-06 15:55:15 +0000
committerbluhm <bluhm@openbsd.org>2017-05-06 15:55:15 +0000
commitdde15c32177640638824d536d764f3baf06a13d5 (patch)
tree42906d222f1fbce7ce8a177aef18df2a747a185b
parentPrint full MIDR for CPUs that can't be identified. (diff)
downloadwireguard-openbsd-dde15c32177640638824d536d764f3baf06a13d5.tar.xz
wireguard-openbsd-dde15c32177640638824d536d764f3baf06a13d5.zip
Convert the xformsw definition to C99 style initializer. Also fix
the function declaration of ipe4_input() and avoid a wrong cast. OK mikeb@ dhill@
-rw-r--r--sys/netinet/ip_ipip.c7
-rw-r--r--sys/netinet/ip_ipsp.c69
-rw-r--r--sys/netinet/ip_ipsp.h4
3 files changed, 57 insertions, 23 deletions
diff --git a/sys/netinet/ip_ipip.c b/sys/netinet/ip_ipip.c
index c809bcc3b80..72dd138922a 100644
--- a/sys/netinet/ip_ipip.c
+++ b/sys/netinet/ip_ipip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipip.c,v 1.76 2017/05/04 17:58:46 bluhm Exp $ */
+/* $OpenBSD: ip_ipip.c,v 1.77 2017/05/06 15:55:15 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -587,12 +587,13 @@ ipe4_zeroize(struct tdb *tdbp)
return 0;
}
-void
-ipe4_input(struct mbuf *m, int hlen, int proto)
+int
+ipe4_input(struct mbuf *m, struct tdb *tdb, int hlen, int proto)
{
/* This is a rather serious mistake, so no conditional printing. */
printf("ipe4_input(): should never be called\n");
m_freem(m);
+ return EINVAL;
}
#endif /* IPSEC */
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 49ef81aa4ec..dd252568ffa 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.221 2017/05/05 11:04:18 bluhm Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.222 2017/05/06 15:55:15 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
@@ -113,25 +113,58 @@ RBT_GENERATE(ipsec_ids_flows, ipsec_ids, id_node_id, ipsp_ids_flow_cmp);
struct xformsw xformsw[] = {
#ifdef IPSEC
- { XF_IP4, 0, "IPv4 Simple Encapsulation",
- ipe4_attach, ipe4_init, ipe4_zeroize,
- (int (*)(struct mbuf *, struct tdb *, int, int))ipe4_input,
- ipip_output, },
- { XF_AH, XFT_AUTH, "IPsec AH",
- ah_attach, ah_init, ah_zeroize,
- ah_input, ah_output, },
- { XF_ESP, XFT_CONF|XFT_AUTH, "IPsec ESP",
- esp_attach, esp_init, esp_zeroize,
- esp_input, esp_output, },
- { XF_IPCOMP, XFT_COMP, "IPcomp",
- ipcomp_attach, ipcomp_init, ipcomp_zeroize,
- ipcomp_input, ipcomp_output, },
+{
+ .xf_type = XF_IP4,
+ .xf_flags = 0,
+ .xf_name = "IPv4 Simple Encapsulation",
+ .xf_attach = ipe4_attach,
+ .xf_init = ipe4_init,
+ .xf_zeroize = ipe4_zeroize,
+ .xf_input = ipe4_input,
+ .xf_output = ipip_output,
+},
+{
+ .xf_type = XF_AH,
+ .xf_flags = XFT_AUTH,
+ .xf_name = "IPsec AH",
+ .xf_attach = ah_attach,
+ .xf_init = ah_init,
+ .xf_zeroize = ah_zeroize,
+ .xf_input = ah_input,
+ .xf_output = ah_output,
+},
+{
+ .xf_type = XF_ESP,
+ .xf_flags = XFT_CONF|XFT_AUTH,
+ .xf_name = "IPsec ESP",
+ .xf_attach = esp_attach,
+ .xf_init = esp_init,
+ .xf_zeroize = esp_zeroize,
+ .xf_input = esp_input,
+ .xf_output = esp_output,
+},
+{
+ .xf_type = XF_IPCOMP,
+ .xf_flags = XFT_COMP,
+ .xf_name = "IPcomp",
+ .xf_attach = ipcomp_attach,
+ .xf_init = ipcomp_init,
+ .xf_zeroize = ipcomp_zeroize,
+ .xf_input = ipcomp_input,
+ .xf_output = ipcomp_output,
+},
#endif /* IPSEC */
#ifdef TCP_SIGNATURE
- { XF_TCPSIGNATURE, XFT_AUTH, "TCP MD5 Signature Option, RFC 2385",
- tcp_signature_tdb_attach, tcp_signature_tdb_init,
- tcp_signature_tdb_zeroize, tcp_signature_tdb_input,
- tcp_signature_tdb_output, }
+{
+ .xf_type = XF_TCPSIGNATURE,
+ .xf_flags = XFT_AUTH,
+ .xf_name = "TCP MD5 Signature Option, RFC 2385",
+ .xf_attach = tcp_signature_tdb_attach,
+ .xf_init = tcp_signature_tdb_init,
+ .xf_zeroize = tcp_signature_tdb_zeroize,
+ .xf_input = tcp_signature_tdb_input,
+ .xf_output = tcp_signature_tdb_output,
+}
#endif /* TCP_SIGNATURE */
};
diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h
index 7ea868b7477..248c1f637d9 100644
--- a/sys/netinet/ip_ipsp.h
+++ b/sys/netinet/ip_ipsp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.h,v 1.179 2017/04/14 20:46:31 bluhm Exp $ */
+/* $OpenBSD: ip_ipsp.h,v 1.180 2017/05/06 15:55:15 bluhm Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
@@ -474,7 +474,7 @@ int tdb_walk(u_int, int (*)(struct tdb *, void *, int), void *);
int ipe4_attach(void);
int ipe4_init(struct tdb *, struct xformsw *, struct ipsecinit *);
int ipe4_zeroize(struct tdb *);
-void ipe4_input(struct mbuf *, int, int);
+int ipe4_input(struct mbuf *, struct tdb *, int, int);
int ipip_input(struct mbuf **, int *, struct ifnet *, int);
int ipip_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);