summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/xform_esp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netipsec/xform_esp.c')
-rw-r--r--sys/netipsec/xform_esp.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c
index 97eeefd..d6d1fb9 100644
--- a/sys/netipsec/xform_esp.c
+++ b/sys/netipsec/xform_esp.c
@@ -451,19 +451,6 @@ esp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
return esp_input_cb(crp);
}
-#ifdef INET6
-#define IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag) do { \
- if (saidx->dst.sa.sa_family == AF_INET6) { \
- error = ipsec6_common_input_cb(m, sav, skip, protoff, mtag); \
- } else { \
- error = ipsec4_common_input_cb(m, sav, skip, protoff, mtag); \
- } \
-} while (0)
-#else
-#define IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag) \
- (error = ipsec4_common_input_cb(m, sav, skip, protoff, mtag))
-#endif
-
/*
* ESP input callback from the crypto driver.
*/
@@ -647,7 +634,21 @@ esp_input_cb(struct cryptop *crp)
/* Restore the Next Protocol field */
m_copyback(m, protoff, sizeof (u_int8_t), lastthree + 2);
- IPSEC_COMMON_INPUT_CB(m, sav, skip, protoff, mtag);
+ switch (saidx->dst.sa.sa_family) {
+#ifdef INET6
+ case AF_INET6:
+ error = ipsec6_common_input_cb(m, sav, skip, protoff, mtag);
+ break;
+#endif
+#ifdef INET
+ case AF_INET:
+ error = ipsec4_common_input_cb(m, sav, skip, protoff, mtag);
+ break;
+#endif
+ default:
+ panic("%s: Unexpected address family: %d saidx=%p", __func__,
+ saidx->dst.sa.sa_family, saidx);
+ }
KEY_FREESAV(&sav);
return error;
OpenPOWER on IntegriCloud