Annotation of fwsync/patches/alias_db.patch, revision 1.6

1.1       misho       1: diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
1.6     ! misho       2: index 4612b32c139..7ef0282fdb8 100644
1.1       misho       3: --- a/sys/netinet/libalias/alias_db.c
                      4: +++ b/sys/netinet/libalias/alias_db.c
1.3       misho       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"
1.6     ! misho      13: @@ -63,6 +64,23 @@ __FBSDID("$FreeBSD$");
1.3       misho      14:  
                     15:  #include "alias_db.h"
                     16:  
1.6     ! misho      17: +#ifdef _KERNEL
1.3       misho      18: +#ifndef V_hook_alias
1.4       misho      19: +typedef int (*ipfw_hook_t)(const void *arg, const void *extdata);
1.3       misho      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)
1.4       misho      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)
1.3       misho      29: +#endif
                     30: +
                     31: +VNET_DEFINE(ipfw_hook_t, hook_alias) = NULL;
1.6     ! misho      32: +#endif
1.3       misho      33: +
                     34:  static LIST_HEAD(, libalias) instancehead = LIST_HEAD_INITIALIZER(instancehead);
                     35:  int LibAliasTime;
                     36:  
1.6     ! misho      37: @@ -566,9 +584,14 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr,
1.5       misho      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
1.6     ! misho      52: @@ -708,6 +731,11 @@ AddLink(struct libalias *la, struct in_addr src_addr, struct in_addr dst_addr,
1.2       misho      53:        if (la->packetAliasMode & PKT_ALIAS_LOG)
1.1       misho      54:                ShowAliasStats(la);
1.2       misho      55:  
1.6     ! misho      56: +#ifdef _KERNEL
1.5       misho      57: +      if (!sync && lnk && V_hook_alias)
1.4       misho      58: +              V_hook_alias(lnk, NULL);
1.6     ! misho      59: +#endif
1.5       misho      60: +
1.1       misho      61:        return (lnk);
                     62:  }
                     63:  

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