diff --git a/net/ng_mikrotik_eoip/Makefile b/net/ng_mikrotik_eoip/Makefile index b1450a92f9cc..e419c78eb4bf 100644 --- a/net/ng_mikrotik_eoip/Makefile +++ b/net/ng_mikrotik_eoip/Makefile @@ -1,25 +1,23 @@ PORTNAME= ng_mikrotik_eoip PORTVERSION= 1.0 CATEGORIES= net kld MASTER_SITES= http://projects.ukrweb.net/files/ \ http://imax.in.ua/files/ MAINTAINER= gelraen.ua@gmail.com COMMENT= Netgraph node for Mikrotik EoIP tunneling WWW= http://imax.in.ua/ng_mikrotik_eoip/ LICENSE= BSD2CLAUSE -BROKEN= compilation fails due to a C error: id = *((unsigned int *)id; error: cast to 'unsigned int *' from smaller integer type 'uint16_t' - USES= kmod uidfix OPTIONS_DEFINE= PTABLE PTABLE_DESC= Use O(1) lookup for tunnel hooks # This option enables usage of static pointer table to find needed decimal-named hook, # which increases memory usage for each node by 65536*sizeof(hook_p). You probably want # this option if you have many tunnels with single remote IP. PTABLE_MAKE_ARGS= NO_LINEAR_HOOK_LOOKUP=1 .include diff --git a/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c b/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c index 4649334fe687..327d32335e6d 100644 --- a/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c +++ b/net/ng_mikrotik_eoip/files/patch-ng__mikrotik__eoip.c @@ -1,60 +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; ++ id = *((unsigned int *)arg); +#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 */