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

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

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