Show
Ignore:
Timestamp:
09/14/11 15:59:49 (3 years ago)
Author:
gdusbabek <gdusbabek@gmail.com>
git-committer:
gdusbabek <gdusbabek@gmail.com> 1316015989 -0500
git-parent:

[1f3d77e42e6c55977e550e9ba33cd3ebe2228a1b]

git-author:
gdusbabek <gdusbabek@gmail.com> 1315924790 -0500
Message:

validate resolve_rtype and show in xml

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_check.h

    r1f3d77e ra33aa52  
    7676#define NP_TRY_OTHER_RESOLVE 0x00008000 
    7777 
     78#define NP_PREFER_IPV4 "prefer-ipv4" 
     79#define NP_PREFER_IPV6 "prefer-ipv6" 
     80#define NP_FORCE_IPV4  "force-ipv4" 
     81#define NP_FORCE_IPV6  "force-ipv6" 
     82 
    7883#define NP_UNKNOWN '0'             /* stats_t.{available,state} */ 
    7984#define NP_AVAILABLE 'A'           /* stats_t.available */ 
  • src/noit_check_rest.c

    r09ecd28 ra33aa52  
    197197  SHOW_ATTR(attr,node,module); 
    198198  SHOW_ATTR(attr,node,target); 
     199  SHOW_ATTR(attr,node,resolve_rtype); 
    199200  SHOW_ATTR(attr,node,period); 
    200201  SHOW_ATTR(attr,node,timeout); 
     
    246247                              const char **error) { 
    247248  xmlNodePtr root, tl, an; 
    248   int name=0, module=0, target=0, period=0, timeout=0, filterset=0; 
     249  int name=0, module=0, target=0, resolve_rtype=0, period=0, timeout=0, filterset=0; 
    249250  *a = *c = NULL; 
    250251  root = xmlDocGetRootElement(doc); 
     
    283284          } 
    284285          target = 1; 
     286        } 
     287        else CHECK_N_SET(resolve_rtype) { 
     288          xmlChar *tmp; 
     289          noit_boolean invalid; 
     290          tmp = xmlNodeGetContent(an); 
     291          invalid = strcmp((char *)tmp, NP_PREFER_IPV4) && strcmp((char *)tmp, NP_PREFER_IPV6) && strcmp((char *)tmp, NP_FORCE_IPV4) && strcmp((char *)tmp, NP_FORCE_IPV6); 
     292          xmlFree(tmp); 
     293          if(invalid) { 
     294            *error = "invalid reslove_rtype"; 
     295            return 0; 
     296          } 
     297          resolve_rtype = 1; 
    285298        } 
    286299        else CHECK_N_SET(period) { 
     
    356369    ATTR2PROP(name); 
    357370    ATTR2PROP(target); 
     371    ATTR2PROP(resolve_rtype); 
    358372    ATTR2PROP(module); 
    359373    ATTR2PROP(period);