aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-10-20 20:22:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-10-20 20:22:02 +0000
commitc9665e214f726d9a6e62af00d81b94567ebe2572 (patch)
tree07e5f22d36906604af3fb429ae5392fbbc3c058d
parentcc0b81c5f835753269da0e091f01ecbeebdaa3fa (diff)
downloadports-c9665e214f726d9a6e62af00d81b94567ebe2572.tar.gz
ports-c9665e214f726d9a6e62af00d81b94567ebe2572.zip
net/ng_mikrotik_eoip: Fix build after recent changes in main.
src commit 6d5f002ed1187547b0b40f8b46a3db38bf89c6dc changed the API of NG_NODE_FOREACH_HOOK to remove a mostly unused parameter. Use a structure as the callback argument to save the returned hook. PR: 266392 Differential Revision: https://reviews.freebsd.org/D36545
-rw-r--r--net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c b/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c
new file mode 100644
index 000000000000..4649334fe687
--- /dev/null
+++ b/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c
@@ -0,0 +1,60 @@
+--- ng_mikrotik_eoip.c.orig 2022-09-13 07:45:40 UTC
++++ ng_mikrotik_eoip.c
+@@ -193,26 +193,54 @@ static ng_fn_eachhook check_id;
+ #ifndef NO_LINEAR_HOOK_LOOKUP
+ static ng_fn_eachhook check_id;
+
++#if __FreeBSD_version >= 1400057
++struct check_id_data {
++ hook_p result;
++ uint16_t id;
++};
++#endif
++
+ static int
+-check_id(hook_p hook, void *id)
++check_id(hook_p hook, void *arg)
+ {
+ struct tunnel_info *info = NG_HOOK_PRIVATE(hook);
++#if __FreeBSD_version >= 1400057
++ struct check_id_data *data = arg;
++#endif
++ uint16_t id;
+
+- if (info != NULL && info->id == (uint16_t)(*((unsigned int *)id)))
++#if __FreeBSD_version >= 1400057
++ id = data->id;
++#else
++ id = *((unsigned int *)id;
++#endif
++ if (info != NULL && info->id == id) {
++#if __FreeBSD_version >= 1400057
++ data->result = hook;
++#endif
+ return 0;
+- else
++ } else
+ return 1;
+ }
+
+ static hook_p
+ find_hook(node_p node, uint16_t id)
+ {
++#if __FreeBSD_version >= 1400057
++ struct check_id_data data;
++
++ data.result = NULL;
++ data.id = id;
++ NG_NODE_FOREACH_HOOK(node, check_id, &data);
++ return data.result;
++#else
+ hook_p result = NULL;
+ unsigned int val = id;
+
+ NG_NODE_FOREACH_HOOK(node, check_id, (void*)&val, result);
+
+ return result;
++#endif
+ }
+ #endif /* NO_LINEAR_HOOK_LOOKUP */
+