Fix VS_ISEQ macro.
authorAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 11:26:46 +0000 (13:26 +0200)
committerAlexandre Cassen <acassen@freebox.fr>
Mon, 28 Sep 2009 11:26:46 +0000 (13:26 +0200)
VS_ISEQ macro considered that virtual servers from different virtual server groups could be equal because no comparison was done with vs->vsgname. This macro is only used when reloading configuration and therefore, the configuration was cleaned too much.

keepalived/check/ipwrapper.c
keepalived/include/check_data.h

index fb13b57..d0279d6 100644 (file)
@@ -566,15 +566,9 @@ vs_exist(virtual_server * old_vs)
                vs = ELEMENT_DATA(e);
                if (VS_ISEQ(old_vs, vs)) {
                        /* Check if group exist */
-                       if ((vs->vsgname && !old_vs->vsgname) ||
-                           (!vs->vsgname && old_vs->vsgname))
-                               return 0;
-
                        if (vs->vsgname) {
-                               if (strcmp(vs->vsgname, old_vs->vsgname) != 0)
-                                       return 0;
                                vsg = ipvs_get_group_by_name(old_vs->vsgname,
-                                                           check_data->vs_group);
+                                                            check_data->vs_group);
                                if (!vsg)
                                        return 0;
                                else
index 2749b36..d7aa3f5 100644 (file)
@@ -154,7 +154,10 @@ typedef struct _check_conf_data {
                         (X)->nat_mask                == (Y)->nat_mask &&               \
                         (X)->granularity_persistence == (Y)->granularity_persistence &&\
                         !strcmp((X)->sched, (Y)->sched) &&                             \
-                        !strcmp((X)->timeout_persistence, (Y)->timeout_persistence))
+                        !strcmp((X)->timeout_persistence, (Y)->timeout_persistence) && \
+                        (((X)->vsgname && (Y)->vsgname &&                              \
+                        !strcmp((X)->vsgname, (Y)->vsgname)) ||                        \
+                        (!(X)->vsgname && !(Y)->vsgname)))
 
 #define VSGE_ISEQ(X,Y) ((X)->addr_ip   == (Y)->addr_ip &&      \
                         (X)->range     == (Y)->range &&        \