version 1.1, 2022/06/22 13:01:55
|
version 1.5, 2022/08/16 00:32:41
|
Line 1
|
Line 1
|
diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c |
diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c |
index 1f85a606b2d..82caa0a2218 100644 | index 4612b32c139..cd18638ac17 100644 |
--- a/sys/netinet/libalias/alias_db.c |
--- a/sys/netinet/libalias/alias_db.c |
+++ b/sys/netinet/libalias/alias_db.c |
+++ b/sys/netinet/libalias/alias_db.c |
@@ -1054,6 +1054,11 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, | @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); |
if (la->packetAliasMode & PKT_ALIAS_LOG) { | #include <netinet/libalias/alias_local.h> |
| #include <netinet/libalias/alias_mod.h> |
| #include <net/if.h> |
| +#include <net/vnet.h> |
| #else |
| #include "alias.h" |
| #include "alias_local.h" |
| @@ -63,6 +64,21 @@ __FBSDID("$FreeBSD$"); |
| |
| #include "alias_db.h" |
| |
| +#ifndef V_hook_alias |
| +typedef int (*ipfw_hook_t)(const void *arg, const void *extdata); |
| +/* callback hooks for notify on update of internal states and aliases */ |
| +VNET_DECLARE(ipfw_hook_t, hook_state); |
| +#define V_hook_state VNET(hook_state) |
| +VNET_DECLARE(ipfw_hook_t, hook_alias); |
| +#define V_hook_alias VNET(hook_alias) |
| +VNET_DECLARE(ipfw_hook_t, sync_state); |
| +#define V_sync_state VNET(sync_state) |
| +VNET_DECLARE(ipfw_hook_t, sync_alias); |
| +#define V_sync_alias VNET(sync_alias) |
| +#endif |
| + |
| +VNET_DEFINE(ipfw_hook_t, hook_alias) = NULL; |
| + |
| static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead); |
| int LibAliasTime; |
| |
| @@ -566,9 +582,14 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, |
| int alias_port_param, int link_type) |
| { |
| struct alias_link *lnk; |
| + int sync = 0; |
| |
| LIBALIAS_LOCK_ASSERT(la); |
| |
| + if (link_type & LINK_SYNC_MASK) |
| + sync = 42; |
| + link_type &= ~LINK_SYNC_MASK; |
| + |
| lnk = malloc(sizeof(struct alias_link)); |
| if (lnk == NULL) { |
| #ifdef LIBALIAS_DEBUG |
| @@ -708,6 +729,9 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr, |
| if (la->packetAliasMode & PKT_ALIAS_LOG) |
ShowAliasStats(la); |
ShowAliasStats(la); |
} | |
| + if (!sync && lnk && V_hook_alias) |
| + V_hook_alias(lnk, NULL); |
+ |
+ |
+#ifdef IPFW_INTERNAL |
|
+ if (lnk && V_hook_alias) |
|
+ V_hook_alias((void*) lnk); |
|
+#endif |
|
return (lnk); |
return (lnk); |
} |
} |
|
|