File:  [ELWIX - Embedded LightWeight unIX -] / fwsync / patches / alias_db.patch
Revision 1.6: download - view: text, annotated - select for diffs - revision graph
Tue Aug 23 14:27:13 2022 UTC (21 months, 3 weeks ago) by misho
Branches: MAIN
CVS tags: fwsync1_2, fwsync1_1, HEAD, FWSYNC1_1
fix compiler scope of view for userland

    1: diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
    2: index 4612b32c139..7ef0282fdb8 100644
    3: --- a/sys/netinet/libalias/alias_db.c
    4: +++ b/sys/netinet/libalias/alias_db.c
    5: @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
    6:  #include <netinet/libalias/alias_local.h>
    7:  #include <netinet/libalias/alias_mod.h>
    8:  #include <net/if.h>
    9: +#include <net/vnet.h>
   10:  #else
   11:  #include "alias.h"
   12:  #include "alias_local.h"
   13: @@ -63,6 +64,23 @@ __FBSDID("$FreeBSD$");
   14:  
   15:  #include "alias_db.h"
   16:  
   17: +#ifdef _KERNEL
   18: +#ifndef V_hook_alias
   19: +typedef int (*ipfw_hook_t)(const void *arg, const void *extdata);
   20: +/* callback hooks for notify on update of internal states and aliases */
   21: +VNET_DECLARE(ipfw_hook_t, hook_state);
   22: +#define V_hook_state		VNET(hook_state)
   23: +VNET_DECLARE(ipfw_hook_t, hook_alias);
   24: +#define V_hook_alias		VNET(hook_alias)
   25: +VNET_DECLARE(ipfw_hook_t, sync_state);
   26: +#define V_sync_state		VNET(sync_state)
   27: +VNET_DECLARE(ipfw_hook_t, sync_alias);
   28: +#define V_sync_alias		VNET(sync_alias)
   29: +#endif
   30: +
   31: +VNET_DEFINE(ipfw_hook_t, hook_alias) = NULL;
   32: +#endif
   33: +
   34:  static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead);
   35:  int LibAliasTime;
   36:  
   37: @@ -566,9 +584,14 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr,
   38:      int alias_port_param, int link_type)
   39:  {
   40:  	struct alias_link *lnk;
   41: +	int sync = 0;
   42:  
   43:  	LIBALIAS_LOCK_ASSERT(la);
   44:  
   45: +	if (link_type & LINK_SYNC_MASK)
   46: +		sync = 42;
   47: +	link_type &= ~LINK_SYNC_MASK;
   48: +
   49:  	lnk = malloc(sizeof(struct alias_link));
   50:  	if (lnk == NULL) {
   51:  #ifdef LIBALIAS_DEBUG
   52: @@ -708,6 +731,11 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr,
   53:  	if (la->packetAliasMode & PKT_ALIAS_LOG)
   54:  		ShowAliasStats(la);
   55:  
   56: +#ifdef _KERNEL
   57: +	if (!sync && lnk && V_hook_alias)
   58: +		V_hook_alias(lnk, NULL);
   59: +#endif
   60: +
   61:  	return (lnk);
   62:  }
   63:  

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>