summaryrefslogtreecommitdiff
path: root/net-mgmt/netmond/files/patch-AA
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2014-03-07 16:20:41 +0000
committerRene Ladan <rene@FreeBSD.org>2014-03-07 16:20:41 +0000
commit1510b743f230c8b6af6cc251122903f0afdc1461 (patch)
treecb3aab37d5b013aa902d99bdc47ab0c6aa90afc5 /net-mgmt/netmond/files/patch-AA
parentConvert c* to USES=zip (diff)
Bring net-mgmt/netmond back into shape.
From PR submitter: - Fix build (partially) - Clean up patches - Unexpire - Mark jobs unsafe - Bump PORTREVISION From myself: - Stage support, introduce pkg-plist - Use option helpers - Convert patch site for documentation into an optional distribution file PR: ports/186654 Submitted by: Vsevolod Volkov <vvv@colocall.net>
Diffstat (limited to 'net-mgmt/netmond/files/patch-AA')
-rw-r--r--net-mgmt/netmond/files/patch-AA1048
1 files changed, 867 insertions, 181 deletions
diff --git a/net-mgmt/netmond/files/patch-AA b/net-mgmt/netmond/files/patch-AA
index 992b498a4d26..e0db89ef9a14 100644
--- a/net-mgmt/netmond/files/patch-AA
+++ b/net-mgmt/netmond/files/patch-AA
@@ -1,5 +1,5 @@
---- Makefile.in.orig Tue Nov 14 17:37:41 2006
-+++ Makefile.in Tue Nov 14 17:37:41 2006
+--- Makefile.in.orig Tue Jul 20 19:28:20 2004
++++ Makefile.in Thu Nov 2 13:35:27 2006
@@ -47,7 +47,7 @@
NETMOND_C = netmond.c netstate.c event.c session.c mib.c snmp.c router.c \
@@ -9,8 +9,8 @@
NETMOND_Y = calc.y parseconf.y
NETMOND_L = scanconf.l
NETMOND_G = version.c
---- dns.c.orig Tue Nov 14 17:37:41 2006
-+++ dns.c Tue Nov 14 17:37:41 2006
+--- dns.c.orig Mon Aug 25 18:19:04 2003
++++ dns.c Thu Nov 2 13:35:27 2006
@@ -149,6 +149,8 @@
{
SESSION *sd = method->sd;
@@ -63,8 +63,8 @@
{ 0, 0 }, /* no parameters used */
/* Non-initialized data */
---- event.c.orig Tue Nov 14 17:37:41 2006
-+++ event.c Tue Nov 14 17:37:41 2006
+--- event.c.orig Thu Feb 27 17:42:32 2003
++++ event.c Tue Nov 14 17:40:52 2006
@@ -288,7 +288,7 @@
#ifdef HAVE_PTHREAD
pthread_mutex_lock(&localtime_lock);
@@ -74,8 +74,8 @@
defect = tm->tm_sec + 60 * tm->tm_min + 3600 * tm->tm_hour + off;
#ifdef HAVE_PTHREAD
pthread_mutex_unlock(&localtime_lock);
---- netmon.h.orig Tue Nov 14 17:37:41 2006
-+++ netmon.h Tue Nov 14 17:37:41 2006
+--- netmon.h.orig Tue Aug 26 10:00:38 2003
++++ netmon.h Thu Dec 28 13:31:06 2006
@@ -14,6 +14,9 @@
#include <sys/socket.h>
#include <sys/time.h>
@@ -98,16 +98,21 @@
#define DEFAULT_WATCHDOG 600 /* 10 min */
#define POLLING_MIN 30 /* 30 sec */
-@@ -90,6 +96,8 @@
+@@ -88,9 +94,13 @@
+ typedef struct timeval TIMEVAL;
+ typedef unsigned long oid;
++#define STATE_UNKNOWN 0
#define STATE_UP 1
#define STATE_DOWN 2
+#define STATE_DEGRADED 3
+#define STATE_WARNING 4
#define BGP_ESTABLISHED 6
++#define ENV_NORMAL 1
#define ENV_NOTPRESENT 5
-@@ -111,6 +119,9 @@
+ #define OBJ_STATE 0
+@@ -111,6 +121,9 @@
#define TYPE_ENVFAN 9
#define TYPE_ENVPS 10
@@ -117,7 +122,31 @@
struct object_ent;
struct method_ent;
-@@ -385,13 +396,14 @@
+@@ -250,6 +263,7 @@
+
+ int state; /* current operational status (UP/DOWN/...) */
+ int prev_state; /* previous operational status */
++ int ignore_state; /* if =1, ignore this interface while parent object state evaluating */
+ TIMEVAL last_request; /* last time interface requested */
+ TIMEVAL prev_request; /* previous time interface requested */
+ TIMEVAL last_reply; /* last time interface reply */
+@@ -294,6 +308,7 @@
+ int asn; /* AS number */
+ char *descr; /* AS description */
+ char *datadir; /* directory where store data */
++ int ignore_state; /* if =1, ignore this AS while parent object state evaluating */
+ SAVE *save_list; /* list of save methods */
+ GROUP_REF *ns_acl; /* netstate client access list */
+
+@@ -325,6 +340,7 @@
+ int type; /* type of gauge: TYPE_ENVTEMP, etc */
+ char *descr; /* env mon description */
+ char *datadir; /* directory where store data */
++ int ignore_state; /* if =1, ignore this ENV while parent object state evaluating */
+ SAVE *save_list; /* list of save methods */
+ GROUP_REF *ns_acl; /* netstate client access list */
+
+@@ -385,13 +401,14 @@
struct method_ent *method; /* session method */
int sock; /* socket file descriptor */
struct sockaddr peer; /* address of peer */
@@ -133,7 +162,7 @@
/* returned values */
int data_int; /* data length or chat-script matchs */
char *data_ptr; /* pointer to resulting data if any */
-@@ -428,6 +440,8 @@
+@@ -428,6 +445,8 @@
u_short rport; /* remote port number, 0=unused */
int timeout; /* number of seconds until first timeout */
int retries; /* number of retries before timeout */
@@ -142,7 +171,7 @@
union {
struct ping_param {
short send; /* ICMP echo request packets to send */
-@@ -530,7 +544,9 @@
+@@ -530,7 +549,9 @@
char *descr; /* object description */
char *datadir; /* directory where store data */
char *address; /* domain name or dotted IP address */
@@ -152,17 +181,18 @@
int polling; /* polling period in seconds */
int saving; /* saving period in seconds */
int sync; /* polling counter to synchronize saving */
-@@ -544,6 +560,9 @@
+@@ -544,6 +565,10 @@
int state; /* current operational status (UP/DOWN/...) */
int prev_state; /* previous operational status */
++ int ignore_state; /* if =1, ignore this obj while parent object state evaluating */
+ int mths_ok; /* count of Ok finished methods */
+ int mths_fail; /* count of Failed methods */
+ int smths_fail; /* count of Failed services methods */
TIMEVAL last_request; /* last time method requested */
TIMEVAL prev_request; /* previous time method requested */
TIMEVAL last_reply; /* last time method reply */
-@@ -574,7 +593,14 @@
+@@ -574,17 +599,29 @@
typedef struct config_ent {
char *rootdir; /* default work directory */
@@ -177,7 +207,8 @@
int polling; /* default polling interval in seconds */
int saving; /* default saving interval in seconds */
int timeout; /* default timeout in seconds */
-@@ -582,9 +608,13 @@
+ int retries; /* default number of retries */
++ int compatibility_flag; /* */
int enable_traps; /* enable SNMP traps */
int source_traps; /* match src-addr and agent-addr of traps */
@@ -191,7 +222,15 @@
int ns_timo; /* client timeout in seconds */
GROUP_REF *ns_acl; /* netstate client access list */
-@@ -733,6 +763,19 @@
+@@ -616,6 +653,7 @@
+ extern int netstate_sock;
+ extern int Cflag;
+ extern int syslog_initialized;
++extern int compatibility_flag;
+
+ /*
+ * Function prototypes
+@@ -733,6 +771,19 @@
void tcp_start __P((METHOD *));
void tcp_stop __P((METHOD *));
int match_expect __P((SESSION *, CHATSCRIPT *, char *));
@@ -211,9 +250,18 @@
/* udp.c */
int udp_init __P((OBJECT *, METHOD *));
---- netmond.c.orig Tue Nov 14 17:37:41 2006
-+++ netmond.c Tue Nov 14 17:37:41 2006
-@@ -79,7 +79,6 @@
+--- netmond.c.orig Tue Jul 20 17:57:19 2004
++++ netmond.c Thu Dec 28 13:31:06 2006
+@@ -62,6 +62,8 @@
+ pid_t mypid; /* my self PID */
+ int syslog_initialized; /* syslog ready to use */
+ int syslog_facility; /* current syslog facility */
++int compatibility_flag = 1; /* version backward compatibility flag.
++ default - work like previous version */
+
+ #ifdef HAVE_PTHREAD
+ pthread_t main_thr;
+@@ -79,7 +81,6 @@
static int reconfig_pending;
static int watchdog_timeout;
static int watchdog_pending;
@@ -221,7 +269,7 @@
static struct sighandler_ent {
int sig;
int flags;
-@@ -254,8 +253,7 @@
+@@ -254,8 +255,7 @@
/*
* Make pid file.
*/
@@ -231,7 +279,17 @@
if ((fp = fopen(buf, "w")) != NULL) {
fprintf(fp, "%d\n", (int)mypid);
fclose(fp);
-@@ -626,6 +624,11 @@
+@@ -380,7 +380,8 @@
+ #ifdef HAVE_PTHREAD
+ reconfig_pending = 0;
+ #else
+- reconfig_pending = -1;
++ // reconfig_pending = -1;
++ reconfig_pending = 0;
+ #endif
+ }
+ }
+@@ -626,73 +627,159 @@
TIMEVAL tv;
VARIABLE *var;
OBJECT *service;
@@ -240,41 +298,41 @@
+ BGP_PEER *bgp_peer;
+ ENV_MON *env;
+ ENV_GAUGE *gauge;
++ char *buf;
++ ssize_t buf_len;
/* current timestamp */
gettimeofday(&tv, NULL);
-@@ -638,19 +641,38 @@
- /*
- * Method list aborted or Start Trap received.
- */
-+ object->mths_fail++;
-+ } else {
-+ object->mths_ok++;
-+ }
-+ if (method->next) {
-+ /*
-+ * Advance to next object method.
-+ */
-+ method = method->next;
-+ (*method->start)(method);
-+ return;
-+ }
-+
-+// report(LOG_ERR, "method_finished: '%s' ok=%d f=%d sf=%d",object->name,object->mths_ok,object->mths_fail);
-+ /*
-+ * Method list done.
-+ */
-+
-+ object->prev_reply = object->last_reply;
-+ object->last_reply = tv; /* last reply timestamp */
-
+-
+ /* save method diagnostic */
+- if (method && diag && (var = get_var(object->var_list, method->name)) != NULL)
+- str2var(var, diag);
+-
+- if (!method || !ok) {
+- /*
+- * Method list aborted or Start Trap received.
+- */
+-
- /* update object operational status */
- object->prev_state = object->state;
-+ /* update object operational status */
-+ object->prev_state = object->state;
-+ if ( object->mths_ok == 0 ) {
++ if (method && diag && (var = get_var(object->var_list, method->name)) != NULL) {
++ str2var(var, diag);
++ /* save method return value */
++ buf_len = strlen(method->name)+4;
++ buf = malloc(buf_len);
++ if ( buf ) {
++ snprintf(buf,buf_len,"%s.ok",method->name);
++ if ((var = get_var(object->var_list, buf)) != NULL)
++ set_var(var, INTEGER, &ok, sizeof(ok));
++ free(buf);
++ } else {
++ report(LOG_ERR, "method_finished(%s!):.ok malloc: %m", object->name,method->name);
++ }
++ }
++ if ( compatibility_flag ) {
++ if (!method || !ok) {
object->state = STATE_DOWN;
-
+-
if (object->state != object->prev_state)
object->last_change = tv;
-
@@ -285,8 +343,20 @@
-
/* stop anything here */
object_stop(object);
+-
+ for (service = object->service; service; service = service->next)
+ object_stop(service);
-@@ -670,29 +692,48 @@
+ set_none_state(object);
+-
+ save_object_state(object);
+-
+ /* stop data saving on the object */
+ remove_event(save_object_data, object);
+-
+ /* keep touching the object if required */
+ if (object->polling > 0) {
+ tv.tv_sec += object->polling / 2;
add_event(&tv, start_method_list, object);
}
return;
@@ -297,68 +367,129 @@
- * Advance to next object method.
- */
-
-- method = method->next;
-- (*method->start)(method);
-- return;
++ }
++ if (method->next) {
++ method = method->next;
++ (*method->start)(method);
++ return;
++ }
++ object->prev_reply = object->last_reply;
++ object->last_reply = tv; /* last reply timestamp */
++
++ /* update object operational status */
++ object->prev_state = object->state;
++ object->state = STATE_UP;
++
++ } else {
++ if (!method || !ok) {
++ object->mths_fail++;
++ } else {
++ object->mths_ok++;
++ }
++ if (method && method->next) {
++ /* Advance to next object method. */
+ method = method->next;
+ (*method->start)(method);
+ return;
- }
--
++ }
++ /* Method list done. */
++ object->prev_reply = object->last_reply;
++ object->last_reply = tv; /* last reply timestamp */
++
++ /* update object operational status */
++ object->prev_state = object->state;
++ if ( object->mths_ok == 0 ) {
++ object->state = STATE_DOWN;
+
- /*
- * Method list done.
- */
--
++ if (object->state != object->prev_state)
++ object->last_change = tv;
++#ifdef DEBUG
++ if (object->prev_state != STATE_DOWN)
++ dprintf(("object \"%s\" change state to DOWN\n", object->name));
++#endif
++ /* stop anything here */
++ object_stop(object);
+
- object->prev_reply = object->last_reply;
- object->last_reply = tv; /* last reply timestamp */
--
++ for (service = object->service; service; service = service->next)
++ object_stop(service);
+
- /* update object operational status */
- object->prev_state = object->state;
- object->state = STATE_UP;
--
-+ } else {
-+ if ( object->mths_fail ) {
-+ object->state = STATE_DEGRADED;
++ set_none_state(object);
++
++ save_object_state(object);
++
++ /* stop data saving on the object */
++ remove_event(save_object_data, object);
+
++ /* keep touching the object if required */
++ if (object->polling > 0) {
++ tv.tv_sec += object->polling / 2;
++ add_event(&tv, start_method_list, object);
++ }
++ return;
+ } else {
-+ object->state = STATE_UP;
-+ for (service = object->service; service; service = service->next) {
-+ if (service->state != STATE_UP) {
-+ object->state = STATE_WARNING;
-+ break;
++ if ( object->mths_fail ) {
++ object->state = STATE_DEGRADED;
++ } else {
++ object->state = STATE_UP;
++ for (service = object->service; service; service = service->next) {
++ if (!service->ignore_state && service->state != STATE_UP) {
++ object->state = STATE_WARNING;
++ break;
++ }
+ }
-+ }
-+ for (interface = object->interface; interface; interface = interface->next) {
-+ if (interface->state != STATE_UP) {
++ for (interface = object->interface; interface; interface = interface->next) {
++ if (!interface->ignore_state && interface->state != STATE_UP) {
+ object->state = STATE_WARNING;
+ break;
+ }
-+ }
-+ for ( bgp = object->bgp; bgp; bgp = bgp->next) {
-+ for ( bgp_peer = bgp->peer; bgp_peer; bgp_peer=bgp_peer->next) {
++ }
++ for ( bgp = object->bgp; bgp; bgp = bgp->next) {
++ if (bgp->ignore_state ) continue;
++ for ( bgp_peer = bgp->peer; bgp_peer; bgp_peer=bgp_peer->next) {
+ if ( bgp_peer->state != BGP_ESTABLISHED){
+ object->state = STATE_WARNING;
+ break;
+ }
-+ }
++ }
+ if (object->state == STATE_WARNING)
+ break;
-+ }
-+ for (env = object->env; env; env = env->next) {
-+ for( gauge = env->gauge; gauge; gauge=gauge->next) {
-+ if (gauge->state != STATE_UP) {
-+ object->state = STATE_WARNING;
-+ break;
-+ }
++ }
++ for (env = object->env; env; env = env->next) {
++ if (env->ignore_state ) continue;
++ for( gauge = env->gauge; gauge; gauge=gauge->next) {
++ if (gauge->state != ENV_NORMAL && gauge->state != ENV_NOTPRESENT ) {
++ object->state = STATE_WARNING;
++ break;
++ }
++ }
++ if (object->state == STATE_WARNING)
++ break;
+ }
-+ if (object->state == STATE_WARNING)
-+ break;
-+ }
++ }
+ }
++ object->mths_ok = 0;
++ object->mths_fail = 0;
++ object->smths_fail = 0;
+ }
-+ object->mths_ok = 0;
-+ object->mths_fail = 0;
-+ object->smths_fail = 0;
if (object->state != object->prev_state)
object->last_change = tv;
-@@ -831,6 +872,20 @@
+@@ -827,10 +914,25 @@
+ /* child would be terminated by signals */
+ sigprocmask(SIG_SETMASK, NULL, &sigmask);
+ sigprocmask(SIG_UNBLOCK, &sigmask, NULL);
+-
++ close(netstate_sock);
++
/* make session leader to be able killpg() latter */
setsid();
@@ -379,7 +510,7 @@
execve(file, av, environ);
report(LOG_ERR, "execve %s: %m", file);
_exit(127);
-@@ -928,8 +983,7 @@
+@@ -928,8 +1030,7 @@
#endif
{
char pidfile[100];
@@ -389,8 +520,8 @@
(void)unlink(pidfile);
report(LOG_CRIT, "aborted by signal %d", sig);
} else report(LOG_INFO, "interrupted by signal %d", sig);
---- netstate.c.orig Tue Nov 14 17:37:41 2006
-+++ netstate.c Tue Nov 14 17:37:41 2006
+--- netstate.c.orig Tue Aug 26 10:54:09 2003
++++ netstate.c Thu Nov 2 13:35:27 2006
@@ -128,7 +128,7 @@
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
@@ -427,17 +558,25 @@
next = input;
if ((cp = my_strsep(&next, " ")) == NULL) {
bad_input++;
---- parseconf.y.orig Tue Nov 14 17:37:41 2006
-+++ parseconf.y Tue Nov 14 17:37:41 2006
+--- parseconf.y.orig Tue Aug 26 10:53:30 2003
++++ parseconf.y Thu Dec 28 13:31:06 2006
@@ -13,6 +13,7 @@
#endif
#include <sys/types.h>
-+#include <limits.h>
++#include <sys/limits.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
-@@ -197,11 +198,36 @@
+@@ -117,6 +118,7 @@
+ first_save = NULL;
+
+ global_var_list = 0;
++ config.compatibility_flag = 1;
+ }
+
+ static char *
+@@ -197,11 +199,37 @@
BGP_AS *bgp;
ENV_MON *env;
char *cp, buf[1024];
@@ -448,6 +587,7 @@
report(LOG_ERR, "%s: rootdir unspecified", config_file);
return NULL;
}
++ compatibility_flag = config.compatibility_flag;
+ if (!config.srcaddress)
+ bzero(&config.ip_srcaddr, sizeof(struct in_addr));
+ if (!config.ns_address)
@@ -474,7 +614,7 @@
if (config.polling) {
if (!config.timeout)
config.timeout = TIMEOUT_DEFAULT;
-@@ -273,6 +299,7 @@
+@@ -273,6 +301,7 @@
for (service = target->service; service; service = service->next) {
service->ip_addr = target->ip_addr;
@@ -482,7 +622,42 @@
service->parent = target;
(void)strcpy(cp, "/");
-@@ -901,7 +928,9 @@
+@@ -329,6 +358,8 @@
+ METHOD *method;
+ CHATSCRIPT *cs;
+ REFERENCE *ref;
++ char *buf;
++ ssize_t buf_len;
+
+ /* sanity check */
+ if (!chain || !item) {
+@@ -362,6 +393,16 @@
+ yyerror("Out of memory");
+ return 0;
+ }
++ buf_len = strlen(method->name)+4 ;
++ buf = malloc( buf_len );
++ if (buf)
++ snprintf(buf,buf_len,"%s.ok",method->name);
++ if (!buf || !add_var(&curr->var_list, buf)) {
++ yyerror("Out of memory");
++ return 0;
++ }
++ free(buf);
++
+ /* bind variable references */
+ for (cs = method->chatscript; cs; cs = cs->next) {
+ for (ref = cs->var_ref; ref; ref = ref->next) {
+@@ -854,7 +895,7 @@
+ }
+ /* check for duplicates */
+ for (curr = *chain; curr; curr = curr->next) {
+- if (!strcasecmp(curr->name, item->name)) {
++ if ( chain == &first_save && !strcasecmp(curr->name, item->name)) {
+ yyerror("save name \"%s\" duplicated", item->name);
+ return 0;
+ }
+@@ -901,7 +942,9 @@
char *argument;
{
METHOD *new;
@@ -493,7 +668,7 @@
if ((new = (METHOD *)malloc(sizeof(METHOD))) == NULL) {
yyerror("Out of memory");
return NULL;
-@@ -915,10 +944,24 @@
+@@ -915,10 +958,24 @@
yyerror("Out of memory");
return 0;
}
@@ -520,7 +695,7 @@
if (new->chatscript) {
new->chatscript = dup_chatscript(new->name, new->argument, new->chatscript);
if (!new->chatscript) return NULL;
-@@ -1342,6 +1385,9 @@
+@@ -1342,11 +1399,15 @@
/* Lexical analyzer return values */
%token TOKEN_ROOTDIR
@@ -530,7 +705,13 @@
%token TOKEN_TIMEFMT
%token TOKEN_POLLING
%token TOKEN_SAVING
-@@ -1354,6 +1400,7 @@
+ %token TOKEN_TIMEOUT
+ %token TOKEN_RETRIES
++%token TOKEN_OMULSTATES
+
+ %token TOKEN_GROUP
+ %token TOKEN_PERMIT
+@@ -1354,6 +1415,7 @@
%token TOKEN_NETSTATE
%token TOKEN_PORT
@@ -538,7 +719,7 @@
%token TOKEN_SAVE
%token TOKEN_FILE
-@@ -1365,6 +1412,7 @@
+@@ -1365,6 +1427,7 @@
%token TOKEN_OBJECT
%token TOKEN_ADDRESS
@@ -546,7 +727,7 @@
%token TOKEN_DESCRIPTION
%token TOKEN_SERVICE
%token TOKEN_INTERFACE
-@@ -1398,6 +1446,7 @@
+@@ -1398,11 +1461,13 @@
%token TOKEN_V2
%token TOKEN_TRAP
@@ -554,7 +735,22 @@
%token TOKEN_SOURCECHECK
%token TOKEN_COMMUNITY
%token TOKEN_ENTERPRISE
-@@ -1442,6 +1491,60 @@
+ %token TOKEN_SPECIFIC
+ %token TRAP_GENERIC
++%token TOKEN_IGNORESTATE
+
+ %token <number> TOKEN_NUMBER
+ %token <string> TOKEN_STRING
+@@ -1410,7 +1475,7 @@
+ %token <string> VAR_OID
+
+ %type <number> optional_number
+-%type <string> optional_string quoted_string legal_string multiline_string
++%type <string> optional_string quoted_string legal_string multiline_string optional_multiline_string
+ %type <save> get_save
+ %type <method> get_method
+ %type <trap> get_trap
+@@ -1442,6 +1507,60 @@
YYABORT;
}
}
@@ -615,7 +811,18 @@
| TOKEN_TIMEFMT quoted_string
{
if (config.timefmt) {
-@@ -1531,6 +1634,17 @@
+@@ -1485,6 +1604,10 @@
+ }
+ config.retries = $2;
+ }
++ | TOKEN_OMULSTATES
++ {
++ config.compatibility_flag = 0;
++ }
+ | TOKEN_NETSTATE '{' netstate_config '}'
+ {
+ if (!config.ns_port) {
+@@ -1531,6 +1654,17 @@
{
config.source_traps = 1;
}
@@ -633,7 +840,7 @@
| TOKEN_TRAP legal_string '{' trap_config '}'
{
trap.name = $2;
-@@ -1556,6 +1670,13 @@
+@@ -1556,6 +1690,13 @@
yyerror("object address unspecified");
YYABORT;
}
@@ -647,7 +854,7 @@
/* if ((object.interface || object.ifgroup ||
object.bgp || object.env) &&
!find_method(object.method_list, "ROUTER")) {
-@@ -1637,6 +1758,17 @@
+@@ -1637,6 +1778,17 @@
YYABORT;
}
}
@@ -665,7 +872,16 @@
| TOKEN_PERMIT quoted_string
{
/* for backward compatibility */
-@@ -1763,6 +1895,19 @@
+@@ -1701,7 +1853,7 @@
+ }
+ save.state = $2;
+ }
+- | TOKEN_WHEN multiline_string TOKEN_NUMBER optional_string
++ | TOKEN_WHEN multiline_string TOKEN_NUMBER optional_multiline_string
+ {
+ if (save.when) {
+ yyerror("save when condition duplicated");
+@@ -1763,6 +1915,19 @@
method.start = echo_start;
method.stop = echo_stop;
}
@@ -685,11 +901,11 @@
| TOKEN_PORT TOKEN_NUMBER
{
if (method.protocol &&
-@@ -1808,12 +1953,30 @@
+@@ -1808,12 +1973,30 @@
}
}
}
-+ | TOKEN_WHEN multiline_string TOKEN_NUMBER optional_string
++ | TOKEN_WHEN multiline_string TOKEN_NUMBER optional_multiline_string
+ {
+ method.protocol = WHEN_PROTO;
+ if (method.when) {
@@ -716,7 +932,7 @@
if ($2 < 1 || $2 > POLLING_MIN) {
yyerror("invalid timeout value (min 1 max %d sec.)",
POLLING_MIN);
-@@ -1827,6 +1990,10 @@
+@@ -1827,6 +2010,10 @@
yyerror("retries statement duplicated");
YYABORT;
}
@@ -727,7 +943,7 @@
if ($2 < 1 || $2 > POLLING_MIN) {
yyerror("invalid retries number (min 1 max %d)",
POLLING_MIN);
-@@ -1838,7 +2005,8 @@
+@@ -1838,7 +2025,8 @@
{
if (method.protocol &&
method.protocol != IPPROTO_TCP &&
@@ -737,7 +953,7 @@
yyerror("no suitable method protocol");
YYABORT;
}
-@@ -2095,6 +2263,18 @@
+@@ -2095,6 +2283,18 @@
}
object.address = $2;
}
@@ -756,7 +972,7 @@
| TOKEN_POLLING TOKEN_NUMBER
{
if (object.polling) {
-@@ -2241,7 +2421,7 @@
+@@ -2241,7 +2441,7 @@
}
| TOKEN_INTERFACE TOKEN_NUMBER
{
@@ -765,7 +981,7 @@
yyerror("interface index out of range");
YYABORT;
}
-@@ -2252,7 +2432,7 @@
+@@ -2252,7 +2452,7 @@
}
| TOKEN_INTERFACE TOKEN_NUMBER '{' interface_config '}'
{
@@ -774,9 +990,76 @@
yyerror("interface index out of range");
YYABORT;
}
---- ping.c.orig Tue Nov 14 17:37:41 2006
-+++ ping.c Tue Nov 14 17:37:41 2006
-@@ -368,6 +368,7 @@
+@@ -2473,6 +2673,10 @@
+ YYABORT;
+ }
+ }
++ | TOKEN_IGNORESTATE
++ {
++ subobject.ignore_state = 1;
++ }
+ ;
+
+ interface_config: /* empty */
+@@ -2530,6 +2734,10 @@
+ YYABORT;
+ }
+ }
++ | TOKEN_IGNORESTATE
++ {
++ interface.ignore_state = 1;
++ }
+ ;
+
+ bgp_config: /* empty */
+@@ -2580,6 +2788,10 @@
+ }
+ free($2);
+ }
++ | TOKEN_IGNORESTATE
++ {
++ bgp_as.ignore_state = 1;
++ }
+ ;
+
+ env_config: /* empty */
+@@ -2629,6 +2841,10 @@
+ YYABORT;
+ }
+ }
++ | TOKEN_IGNORESTATE
++ {
++ env_mon.ignore_state = 1;
++ }
+ ;
+
+ get_save: legal_string optional_string
+@@ -2918,6 +3134,12 @@
+ $$ = NULL;
+ }
+ | quoted_string
++ ;
++optional_multiline_string:
++ {
++ $$ = NULL;
++ }
++ | multiline_string
+ ;
+
+ %%
+--- ping.c.orig Fri Aug 22 11:07:53 2003
++++ ping.c Thu Dec 28 13:31:06 2006
+@@ -352,7 +352,8 @@
+ dprintf(("check_netpath(%s)\n", target->name));
+
+ for (nexthop = target->nexthop; nexthop; nexthop = nexthop->next) {
+- if ((nexthop->target && nexthop->target->state != STATE_UP) ||
++ if ((nexthop->target && nexthop->target->state == STATE_UNKNOWN) ||
++ (nexthop->target && nexthop->target->state == STATE_DOWN) ||
+ (nexthop->interface && nexthop->interface->state != STATE_UP))
+ return 0;
+ }
+@@ -368,6 +369,7 @@
u_char buf[MAX_PACKETSZ];
struct ip *ip;
struct icmp *icmp;
@@ -784,7 +1067,7 @@
struct sockaddr_in *to = (struct sockaddr_in *)&sd->peer;
int header_len = sizeof(struct ip);
int total_len = method->rport ? method->rport : MIN_PACKETSZ;
-@@ -400,7 +401,7 @@
+@@ -400,7 +402,7 @@
#endif
ip->ip_ttl = IPDEFTTL;
ip->ip_p = IPPROTO_ICMP;
@@ -793,7 +1076,7 @@
ip->ip_dst = to->sin_addr;
if (rr_opt) { /* IP Option: Record Route */
-@@ -423,6 +424,7 @@
+@@ -423,6 +425,7 @@
memcpy(icmp->icmp_data, &sd->buf, sizeof(TIMEVAL *));
icmp->icmp_cksum = in_cksum((u_short *)icmp, total_len - header_len);
@@ -801,7 +1084,7 @@
#ifdef NO_ICMP_ERRORS
total_len = send(sd->sock, (char *)buf, total_len, 0);
#else
-@@ -600,6 +602,8 @@
+@@ -600,6 +603,8 @@
{
SESSION *sd = method->sd;
int tmpval;
@@ -810,7 +1093,7 @@
/* sanity check */
if (!sd) return;
-@@ -616,6 +620,13 @@
+@@ -616,6 +621,13 @@
echo_reply(errno, sd, 0);
return;
}
@@ -824,7 +1107,7 @@
#ifdef SO_BSDCOMPAT
/* The following option is only necessary on Linux machines because
* they have the unusual behavior of returning some ICMP errors to
-@@ -701,7 +712,12 @@
+@@ -701,7 +713,12 @@
if (sd->pkt_recv > 1) msec /= (double)sd->pkt_recv;
sprintf(buf, "%g", msec);
diag = buf;
@@ -838,7 +1121,7 @@
} else {
op = -1;
diag = icmp_error(sd->data_int);
-@@ -740,8 +756,9 @@
+@@ -740,8 +757,9 @@
METHOD *method;
{
SESSION template;
@@ -849,7 +1132,7 @@
dprintf(("echo_init(%s/%s)\n", target->name, method->name));
-@@ -758,6 +775,9 @@
+@@ -758,6 +776,9 @@
to = (struct sockaddr_in *)&template.peer;
to->sin_family = AF_INET;
to->sin_addr = method->address ? method->ip_addr : target->ip_addr;
@@ -859,7 +1142,7 @@
template.timeout = method->timeout * 1000000L; /* make microseconds */
template.retries = method->retries;
template.send = echo_send;
-@@ -798,6 +818,7 @@
+@@ -798,6 +819,7 @@
IPPROTO_ICMP, /* network protocol */
0, /* no packet size for built-in method */
0, 0, /* timeout and retries undefined yet */
@@ -867,8 +1150,284 @@
{ 1, 1 }, /* send/expect packet counter */
/* Non-initialized data */
---- radius.c.orig Tue Nov 14 17:37:41 2006
-+++ radius.c Tue Nov 14 17:37:41 2006
+--- /dev/null 2014-03-07 15:59:00.000000000 +0200
++++ pipe.c 2014-01-24 02:14:07.000000000 +0200
+@@ -0,0 +1,273 @@
++/*
++ * Copyright (c) 1999-2002 Rinet Corp., Novosibirsk, Russia
++ * partial (c) vfom@narod.ru
++ *
++ * Redistribution and use in source forms, with and without modification,
++ * are permitted provided that this entire comment appears intact.
++ *
++ * THIS SOURCE CODE IS PROVIDED ``AS IS'' WITHOUT ANY WARRANTIES OF ANY KIND.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <signal.h>
++#include <stdio.h>
++#include <string.h>
++#include <unistd.h>
++#include <syslog.h>
++#include <errno.h>
++#ifdef HAVE_DMALLOC_H
++#include <dmalloc.h>
++#else
++#include "malloc.h"
++#endif
++#include "assert.h"
++
++#include "netmon.h"
++#include "regex.h"
++
++extern int errno;
++extern CONFIG *cf; /* current configuration */
++
++static int pipe_execfile __P ((char *, char *,pid_t *, OBJECT *));
++
++void
++pipe_start(method)
++ METHOD *method;
++{
++ SESSION *sd = method->sd;
++ OBJECT *target = sd->owner;
++ int tmpval;
++
++ /* sanity check */
++ if (!sd) return;
++
++ tcp_stop(method); /* stop the method if still running */
++ if ((method->sd)->pid > 0) { kill((method->sd)->pid, SIGTERM); }
++ sd->pid = -1;
++
++ /* open stream socket near before TCP session */
++ if ((sd->sock = pipe_execfile(method->when, method->argument, &(sd->pid), target)) < 0) {
++ tcp_close(errno, sd, 0);
++ return;
++ }
++
++ /* turn on non-blocking I/O before connecting */
++ if (set_socket_async(sd->sock, TRUE) < 0) {
++ tcp_close(errno, sd, 0);
++ if ((method->sd)->pid > 0) { kill((method->sd)->pid, SIGTERM); }
++ return;
++ }
++
++ /* timeout and retries for connection */
++ sd->timeout = method->timeout * 1000000L; /* make miscroseconds */
++ sd->retries = method->retries;
++ sd->connect = tcp_connect; /* `awaiting' connection */
++
++ if ((tmpval = session_start(sd, NULL)) != 0) {
++ dprintf(("pipe_start(%s/%s): reqid=%d\n",
++ sd->owner->name, method->name, tmpval));
++//report(LOG_INFO, "pipe_start(%s/%s): reqid=%d\n",
++// sd->owner->name, method->name, tmpval);
++ }
++}
++
++int
++pipe_init(target, method)
++ OBJECT *target;
++ METHOD *method;
++{
++ SESSION template;
++
++ dprintf(("pipe_init(%s/%s)\n", target->name, method->name));
++// report(LOG_INFO,"pipe_init(%s/%s)\n", target->name, method->name);
++
++ if (method->sd)
++ session_free(method->sd);
++
++ memset(&template, 0, sizeof(template));
++ template.owner = target;
++ template.method = method;
++ template.sock = -1; /* not yet opened */
++ template.pid = -1;
++ template.timeout = method->timeout * 1000000L; /* make microseconds */
++ template.retries = method->retries;
++ template.connect = tcp_connect;
++ template.send = tcp_send;
++ template.recv = tcp_recv;
++ template.read = tcp_close;
++
++ if ((method->sd = session_create(&template)) == NULL) {
++ errno = ENOMEM;
++ return -1;
++ }
++
++ return 0;
++}
++
++#define MAX_ARGS 50
++int
++pipe_execfile(file, args, p_pid, target)
++ char *file, *args;
++ pid_t *p_pid;
++ OBJECT *target;
++{
++ sigset_t sigmask;
++ int ac = 0, fildes[2];
++ char *av[MAX_ARGS+2];
++ extern char **environ;
++ pid_t pid;
++
++ dprintf(("pipe_execfile: %s %s\n", file, args ? args : "null"));
++// report(LOG_INFO,"pipe_execfile: %s %s\n", file, args ? args : "null");
++
++ if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fildes) < 0) {
++ report(LOG_ERR, "socketpair: %m");
++ return(-1);
++ }
++
++ if (*file != '/') {
++ av[ac++] = "sh";
++ av[ac++] = "-c";
++ av[ac++] = file;
++#ifdef _PATH_BSHELL
++ file = _PATH_BSHELL;
++#else
++ file = "/bin/sh";
++#endif
++ } else av[ac++] = strippath(file);
++
++ ac += make_argv(args, (char ***) &av[ac], MAX_ARGS);
++ av[ac] = NULL;
++
++ switch (pid=vfork()) {
++ case -1:
++ report(LOG_ERR, "fork: %m");
++ close(fildes[0]);
++ close(fildes[1]);
++ return(-1);
++ case 0: /* child */
++ if (fcntl(fildes[0], F_SETFD, 0) < 0) {
++ report(LOG_ERR," fcntl (F_SETFD, 0): %m");
++ _exit(127);
++ }
++ if (fildes[0] != 0) {
++ dup2(fildes[0], 0);
++ close(fildes[0]);
++ }
++ dup2(0, 1);
++ dup2(0, 2);
++
++ /* child would be terminated by signals */
++ sigprocmask(SIG_SETMASK, NULL, &sigmask);
++ sigprocmask(SIG_UNBLOCK, &sigmask, NULL);
++ close(netstate_sock);
++
++ /* make session leader to be able killpg() latter */
++ setsid();
++
++ if ( cf->chrootdir) {
++ if ( chroot( cf->chrootdir ) < 0 ) {
++ report(LOG_ERR, "chroot %s: %s", cf->chrootdir,strerror(*(__error())) );
++ _exit(127);
++ }
++ }
++ if ( setgid(cf->gid) < 0 ) {
++ report(LOG_ERR, "setgid %s[%d]: %s", cf->groupname, cf->gid, strerror(*(__error())) );
++ _exit(127);
++ }
++ if ( (cf->uid != 0) & (setuid(cf->uid) < 0) ) {
++ report(LOG_ERR, "setuid %s[%d]: %s", cf->username, cf->uid, strerror(*(__error())) );
++ _exit(127);
++ }
++
++ setenv ("OBJECT_NAME",target->name,1 );
++ setenv ("OBJECT_ADDRESS",target->address,1 );
++ if (target->srcaddress)
++ setenv ("OBJECT_SRC_ADDRESS",target->srcaddress,1 );
++ if (target->datadir)
++ setenv ("OBJECT_DATADIR",target->datadir,1 );
++ execve(file, av, environ);
++ report(LOG_ERR, "execve %s: %m", file);
++ _exit(127);
++ }
++ /* parent */
++ if ( p_pid != NULL ) { *p_pid = pid; };
++ close(fildes[0]);
++ return(fildes[1]);
++}
++
++void
++when_stop(method)
++ METHOD *method;
++{
++// session_stop(method->sd, 1);
++}
++
++void
++when_start(method)
++ METHOD *method;
++{
++ SESSION *sd = method->sd;
++ OBJECT *target = sd->owner;
++ TIMEVAL tv_now;
++
++ char *diag, buf[4096];
++ int tmpval, matched;
++
++ /* sanity check */
++ if (!sd) return;
++
++ sd->sock=-1;
++
++ /* calculate condition */
++ insert_variables(buf, sizeof(buf), method->when, TYPE_OBJECT, target);
++ matched = (calculate(buf) ? 1 : 0);
++// report(LOG_WARNING, "when_start EVAL: '%s' %d %s %d",buf,matched,target->name,sd->tv_sum.tv_sec);
++ diag = "OK" ;
++ if ( matched ) {
++ gettimeofday(&tv_now,NULL);
++ if ( (u_int64_t)sd->tv_sum.tv_sec != 0 ) {
++ if ( ( (u_int64_t)(tv_now.tv_sec) - (u_int64_t)(sd->tv_sum.tv_sec) ) > method->timeout ) {
++ insert_variables(buf, sizeof(buf), method->when_fmt, TYPE_OBJECT, target);
++ diag = buf;
++ }
++ } else {
++ sd->tv_sum.tv_sec = tv_now.tv_sec;
++ matched = 0;
++ }
++ } else {
++ sd->tv_sum.tv_sec=0;
++ }
++// report(LOG_WARNING, "when_start DIAG: '%s' %d %d",diag,matched,sd->tv_sum.tv_sec);
++
++ dump_var_list(target->var_list);
++ method_finished(target, method, diag, !matched);
++}
++
++int
++when_init(target, method)
++ OBJECT *target;
++ METHOD *method;
++{
++ SESSION template;
++ dprintf(("when_init(%s/%s)\n", target->name, method->name));
++
++ if (method->sd)
++ session_free(method->sd);
++
++ memset(&template, 0, sizeof(template));
++ template.owner = target;
++ template.method = method;
++ template.sock = -1; /* never used socket */
++ if ((method->sd = session_create(&template)) == NULL) {
++ errno = ENOMEM;
++ return -1;
++ }
++ return 0;
++}
+--- radius.c.orig Mon Aug 25 18:20:03 2003
++++ radius.c Mon Nov 13 16:58:49 2006
@@ -33,7 +33,7 @@
* RADIUS specification according to RFC2138.
*/
@@ -929,9 +1488,33 @@
{ 0, 0 }, /* no parameters used */
/* Non-initialized data */
---- reconfig.c.orig Tue Nov 14 17:37:41 2006
-+++ reconfig.c Tue Nov 14 17:37:41 2006
-@@ -395,7 +395,7 @@
+--- reconfig.c.orig Tue Aug 26 10:54:37 2003
++++ reconfig.c Thu Dec 28 13:31:06 2006
+@@ -175,6 +175,7 @@
+
+ rescan = (old->bandwidth != new->bandwidth); /* to force rescan */
+ old->bandwidth = new->bandwidth;
++ old->ignore_state = new->ignore_state;
+
+ splice_var_list(&old->var_list, &new->var_list);
+
+@@ -260,6 +261,7 @@
+
+ /* setup new list of peers */
+ old->handconf = new->handconf;
++ old->ignore_state = new->ignore_state;
+ free_bgp_peers(old, 1);
+ old->peer = new->peer;
+ new->peer = NULL;
+@@ -340,6 +342,7 @@
+
+ /* setup new list of peers */
+ old->handconf = new->handconf;
++ old->ignore_state = new->ignore_state;
+ free_env_gauges(old, 1);
+ old->gauge = new->gauge;
+ new->gauge = NULL;
+@@ -395,7 +398,7 @@
OBJECT *parent;
OBJECT *old, *new;
{
@@ -940,7 +1523,7 @@
OBJECT *service;
object_stop(old);
-@@ -403,9 +403,13 @@
+@@ -403,9 +406,13 @@
ptrswap(&old->descr, &new->descr);
ptrswap(&old->datadir, &new->datadir);
ptrswap(&old->address, &new->address);
@@ -956,7 +1539,7 @@
old->parent = parent;
if (memcmp(&old->ip_addr, ip_addr, sizeof(old->ip_addr))) {
-@@ -418,6 +422,8 @@
+@@ -418,6 +425,8 @@
memset(old->snmpdata, 0, sizeof(SNMP_DATA));
}
}
@@ -965,15 +1548,16 @@
old->polling = new->polling;
old->saving = new->saving;
-@@ -450,6 +456,7 @@
+@@ -450,6 +459,8 @@
service = splice_object_list(old, &old->service, &new->service);
for (; service; service = service->next) {
service->ip_addr = old->ip_addr;
+ service->ip_srcaddr = old->ip_srcaddr;
++ service->ignore_state = old->ignore_state;
service->parent = old;
object_init(service);
}
-@@ -516,21 +523,41 @@
+@@ -516,21 +527,42 @@
}
if (cf_new->rootdir) free(cf_new->rootdir);
@@ -998,6 +1582,7 @@
cf->saving = cf_new->saving;
cf->timeout = cf_new->timeout;
cf->retries = cf_new->retries;
++ compatibility_flag = cf->compatibility_flag = cf_new->compatibility_flag;
- if (cf->enable_traps != cf_new->enable_traps) {
+ if ((cf->enable_traps != cf_new->enable_traps) || memcmp(&cf->trap_ip_addr, &cf_new->trap_ip_addr, sizeof(struct in_addr)) ) {
@@ -1017,7 +1602,7 @@
cf->ns_port = cf_new->ns_port;
netstate_init(cf->ns_port);
}
-@@ -576,6 +603,12 @@
+@@ -576,6 +608,12 @@
free_object_list(cf_cur->target);
if (cf_cur->rootdir) free(cf_cur->rootdir);
@@ -1030,7 +1615,7 @@
if (cf_cur->timefmt) free(cf_cur->timefmt);
trap_init(cf_cur->enable_traps > 0);
-@@ -649,6 +682,7 @@
+@@ -649,6 +687,7 @@
if (obj->descr) free(obj->descr);
if (obj->datadir) free(obj->datadir);
if (obj->address) free(obj->address);
@@ -1038,14 +1623,14 @@
free_trap_list(obj->trap_list);
free_var_list(obj->var_list);
free_save_list(obj->save_list);
---- regex.c.orig Tue Nov 14 17:37:41 2006
-+++ regex.c Tue Nov 14 17:37:41 2006
+--- regex.c.orig Mon Feb 24 14:52:12 2003
++++ regex.c Thu Nov 2 13:35:27 2006
@@ -554,12 +554,12 @@
* the bitset form, since we may wish to extend it
* in the future for other character classifications.
*
- * TRUE for 0-9 A-Z a-z _
-+ * TRUE for 0-9 A-Z a-z _ - -
++ * TRUE for 0-9 A-Z a-z _ а-я А-Я
*/
static char chrtyp[MAXCHR] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1065,8 +1650,8 @@
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, // 120-129
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 130-139
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 140-149
-+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, // 160-169 163=
-+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // 170-179 179=
++ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, // 160-169 163=ё
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // 170-179 179=Ё
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 180-189
+ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 190-199
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 200-209
@@ -1092,8 +1677,8 @@
static char *
pmatch(prog, lp, ap)
---- regex.h.orig Tue Nov 14 17:37:41 2006
-+++ regex.h Tue Nov 14 17:37:41 2006
+--- regex.h.orig Mon Feb 24 14:39:49 2003
++++ regex.h Thu Nov 2 13:38:39 2006
@@ -21,12 +21,12 @@
*/
#define MAXDFA 1024
@@ -1109,9 +1694,17 @@
typedef /*unsigned*/ char CHAR;
---- router.c.orig Tue Nov 14 17:37:41 2006
-+++ router.c Tue Nov 14 17:37:41 2006
-@@ -2214,6 +2214,8 @@
+--- router.c.orig Mon Aug 25 16:07:07 2003
++++ router.c Thu Dec 28 13:31:06 2006
+@@ -309,6 +309,7 @@
+ for (group_ref = proto->ns_acl; group_ref; group_ref = group_ref->next)
+ add_group_ref_copy(&iface->ns_acl, group_ref);
+
++ iface->ignore_state = proto->ignore_state;
+ if (last)
+ last->next = iface;
+ else object->interface = iface;
+@@ -2214,6 +2215,8 @@
METHOD *method;
{
SESSION *sd = method->sd;
@@ -1120,7 +1713,7 @@
/* sanity check */
if (!sd) {
-@@ -2229,7 +2231,13 @@
+@@ -2229,7 +2232,13 @@
router_reply(errno, sd, 0);
return;
}
@@ -1135,7 +1728,7 @@
/* turn on non-blocking I/O */
if (set_socket_async(sd->sock, TRUE) < 0) {
router_reply(errno, sd, 0);
-@@ -2306,7 +2314,7 @@
+@@ -2306,7 +2315,7 @@
METHOD *method;
{
SESSION template;
@@ -1144,7 +1737,7 @@
dprintf(("router_init(%s/%s)\n", target->name, method->name));
-@@ -2321,6 +2329,10 @@
+@@ -2321,6 +2330,10 @@
to->sin_family = AF_INET;
to->sin_port = htons(method->rport);
to->sin_addr = method->address ? method->ip_addr : target->ip_addr;
@@ -1155,7 +1748,7 @@
template.timeout = method->timeout * 1000000L; /* make microseconds */
template.retries = method->retries;
template.send = snmp_send;
-@@ -2359,6 +2371,7 @@
+@@ -2359,6 +2372,7 @@
IPPROTO_UDP, /* network protocol */
SNMPSERVER_PORT,/* server port */
0, 0, /* timeout and retries undefined yet */
@@ -1163,9 +1756,9 @@
{ SNMP_VERSION_1, /* version number */
BATCH_DEFAULT },/* batch value */
---- scanconf.l.orig Tue Nov 14 17:37:41 2006
-+++ scanconf.l Tue Nov 14 17:37:41 2006
-@@ -88,6 +88,9 @@
+--- scanconf.l.orig Thu Sep 18 09:59:48 2003
++++ scanconf.l Thu Dec 28 13:31:06 2006
+@@ -88,11 +88,15 @@
/* token names */
ROOTDIR [Rr]oot[Dd]ir
@@ -1175,7 +1768,13 @@
TIMEFMT [Tt]ime[Ff]mt
POLLING [Pp]olling
SAVING [Ss]aving
-@@ -111,6 +114,8 @@
+ TIMEOUT [Tt]imeout
+ RETRIES [Rr]etries
++OMULSTATES [Oo]bject[Mm]ultiple[Ss]tates
+
+ GROUP [Gg]roup
+ PERMIT [Pp]ermit
+@@ -111,6 +115,8 @@
OBJECT [Oo]bject
ADDRESS [Aa]ddress
@@ -1184,7 +1783,7 @@
DESCRIPTION [Dd]escription|[Cc]omment
SERVICE [Ss]ervice
INTERFACE [Ii]nterface
-@@ -144,6 +149,7 @@
+@@ -144,11 +150,13 @@
V2 [Vv]2
TRAP [Tt]rap
@@ -1192,7 +1791,13 @@
SOURCECHECK [Ss]ource[Cc]heck
COMMUNITY [Cc]ommunity
ENTERPRISE [Ee]nterprise
-@@ -186,6 +192,12 @@
+ SPECIFIC [Ss]pecific
+ GENERIC GENERIC|[Gg]eneric
++IGNORESTATE [Ii]gnore[Ss]tate
+
+ LETTER [a-zA-Z]
+ DIGIT [0-9]
+@@ -186,6 +194,12 @@
{ROOTDIR} { return TOKEN_ROOTDIR; }
@@ -1205,7 +1810,16 @@
{TIMEFMT} { return TOKEN_TIMEFMT; }
{POLLING} { return TOKEN_POLLING; }
-@@ -224,6 +236,10 @@
+@@ -196,6 +210,8 @@
+
+ {RETRIES} { return TOKEN_RETRIES; }
+
++{OMULSTATES} { return TOKEN_OMULSTATES; }
++
+ {GROUP} { return TOKEN_GROUP; }
+
+ {PERMIT} { return TOKEN_PERMIT; }
+@@ -224,6 +240,10 @@
{ADDRESS} { return TOKEN_ADDRESS; }
@@ -1216,17 +1830,26 @@
{DESCRIPTION} { return TOKEN_DESCRIPTION; }
{SERVICE} { return TOKEN_SERVICE; }
-@@ -285,6 +301,8 @@
- {V2} { return TOKEN_V2; }
+@@ -286,6 +306,8 @@
{TRAP} { return TOKEN_TRAP; }
-+
-+{TRAPBINDADDRESS} { return TOKEN_TRAPBINDADDRESS; }
++{TRAPBINDADDRESS} { return TOKEN_TRAPBINDADDRESS; }
++
{SOURCECHECK} { return TOKEN_SOURCECHECK; }
---- session.c.orig Tue Nov 14 17:37:41 2006
-+++ session.c Tue Nov 14 17:37:42 2006
+ {COMMUNITY} { return TOKEN_COMMUNITY; }
+@@ -295,6 +317,8 @@
+ {SPECIFIC} { return TOKEN_SPECIFIC; }
+
+ {GENERIC} { return TRAP_GENERIC; }
++
++{IGNORESTATE} { return TOKEN_IGNORESTATE; }
+
+ \${LETTER}({LETTER}|{DIGIT}|_)+(\.{DIGIT}+)* {
+ yylval.string = &yytext[1];
+--- session.c.orig Sat Aug 2 11:26:38 2003
++++ session.c Thu Nov 2 13:35:27 2006
@@ -59,6 +59,7 @@
curr_session->method = template->method;
curr_session->sock = template->sock;
@@ -1259,8 +1882,8 @@
/*
* For each request outstanding, check to see if it has expired.
*/
---- snmp.c.orig Tue Nov 14 17:37:42 2006
-+++ snmp.c Tue Nov 14 17:37:42 2006
+--- snmp.c.orig Tue Jul 20 17:51:25 2004
++++ snmp.c Thu Nov 2 13:35:27 2006
@@ -1214,6 +1214,8 @@
{
SESSION *sd = method->sd;
@@ -1313,8 +1936,8 @@
{ SNMP_VERSION_1,/* version number */
0 }, /* no parameter used */
---- tacacs.c.orig Tue Nov 14 17:37:42 2006
-+++ tacacs.c Tue Nov 14 17:37:42 2006
+--- tacacs.c.orig Mon Aug 25 18:20:41 2003
++++ tacacs.c Thu Nov 2 13:35:27 2006
@@ -302,6 +302,8 @@
{
SESSION *sd = method->sd;
@@ -1366,8 +1989,8 @@
{ 0, 0 }, /* no parameters used */
/* Non-initialized data */
---- tcp.c.orig Tue Nov 14 17:37:42 2006
-+++ tcp.c Tue Nov 14 17:37:42 2006
+--- tcp.c.orig Wed Sep 17 12:55:52 2003
++++ tcp.c Thu Nov 2 13:35:27 2006
@@ -16,6 +16,7 @@
#include <netinet/in.h>
#include <stdio.h>
@@ -1494,8 +2117,8 @@
template.timeout = method->timeout * 1000000L; /* make microseconds */
template.retries = method->retries;
template.connect = tcp_connect;
---- trap.c.orig Tue Nov 14 17:37:42 2006
-+++ trap.c Tue Nov 14 17:37:42 2006
+--- trap.c.orig Thu Aug 21 09:45:25 2003
++++ trap.c Thu Nov 2 13:35:27 2006
@@ -40,9 +40,10 @@
{
static struct sockaddr_in sin;
@@ -1529,8 +2152,8 @@
return 0;
}
---- udp.c.orig Tue Nov 14 17:37:42 2006
-+++ udp.c Tue Nov 14 17:37:42 2006
+--- udp.c.orig Sat Aug 2 11:40:56 2003
++++ udp.c Thu Nov 2 13:35:27 2006
@@ -197,6 +197,8 @@
{
SESSION *sd = method->sd;
@@ -1595,9 +2218,18 @@
template.timeout = method->timeout * 1000000L; /* make microseconds */
template.retries = method->retries;
template.send = udp_send;
---- util.c.orig Tue Nov 14 17:37:42 2006
-+++ util.c Tue Nov 14 17:37:42 2006
-@@ -1236,11 +1236,9 @@
+--- util.c.orig Tue Aug 26 10:53:17 2003
++++ util.c Thu Dec 28 13:31:06 2006
+@@ -275,6 +275,8 @@
+ if (method->address) free(method->address);
+ if (method->sd) session_free(method->sd);
+ if (method->chatscript) free_chatscript(method->chatscript);
++ if (method->when) free(method->when);
++ if (method->when_fmt) free(method->when_fmt);
+ if (method->snmpreq) {
+ free_var_ref(method->snmpreq->var_ref);
+ free(method->snmpreq);
+@@ -1236,11 +1238,9 @@
if (method->address)
printf("%s\tAddress = \"%s\" [%s]\n", prepend,
method->address, intoa(ipaddr, method->ip_addr));
@@ -1611,7 +2243,7 @@
switch (method->protocol) {
case IPPROTO_ICMP:
if (method->rport)
-@@ -1265,6 +1263,14 @@
+@@ -1265,6 +1265,14 @@
printf("..%d", method->lport_max);
}
break;
@@ -1626,7 +2258,16 @@
default:
printf("Unsupported");
}
-@@ -1415,16 +1421,27 @@
+@@ -1409,22 +1417,36 @@
+ if (cf->saving > 0)
+ printf("Saving = %d sec.\n", cf->saving);
+ else printf("Saving disabled\n");
++ if (cf->compatibility_flag > 0)
++ printf("Compatibility flag SET\n");
++ else printf("Compatibility flag NOT SET\n");
+
+ print_group_list("", cf->group_list);
+
printf("NetState %s\n", cf->ns_port ? "enabled" : "disabled");
if (cf->ns_port) {
printf("\tPort = %d\n", cf->ns_port);
@@ -1654,7 +2295,7 @@
} else printf("disabled");
printf("\n");
-@@ -1434,6 +1451,8 @@
+@@ -1434,6 +1456,8 @@
printf("\tDescription = \"%s\"\n", target->descr);
printf("\tAddress = \"%s\" [%s]\n", target->address,
intoa(ipaddr, target->ip_addr));
@@ -1663,8 +2304,53 @@
if (target->polling > 0)
printf("\tPolling = %d sec.\n", target->polling);
else printf("\tPolling disabled\n");
---- variables.c.orig Tue Nov 14 17:37:42 2006
-+++ variables.c Tue Nov 14 17:37:42 2006
+@@ -1463,6 +1487,8 @@
+ if (iface->ns_acl)
+ print_group_ref("\t\tNetState ", iface->ns_acl);
+ else printf("\t\tNetState Group = free access\n");
++ if (iface->ignore_state)
++ printf("\t\tIgnoreState flag set.\n");
+ print_var_list("\t\t", iface->var_list);
+ print_save_list("\t\t", iface->save_list);
+ }
+@@ -1475,6 +1501,8 @@
+ if (iface->ns_acl)
+ print_group_ref("\t\tNetState ", iface->ns_acl);
+ else printf("\t\tNetState Group = free access\n");
++ if (iface->ignore_state)
++ printf("\t\tIgnoreState flag set.\n");
+ print_var_list("\t\t", iface->var_list);
+ print_save_list("\t\t", iface->save_list);
+ }
+@@ -1495,6 +1523,8 @@
+ if (bgp->ns_acl)
+ print_group_ref("\t\tNetState ", bgp->ns_acl);
+ else printf("\t\tNetState Group = free access\n");
++ if (bgp->ignore_state)
++ printf("\t\tIgnoreState flag set.\n");
+ print_save_list("\t\t", bgp->save_list);
+ }
+
+@@ -1514,6 +1544,8 @@
+ if (env->ns_acl)
+ print_group_ref("\t\tNetState ", env->ns_acl);
+ else printf("\t\tNetState Group = free access\n");
++ if (env->ignore_state)
++ printf("\t\tIgnoreState flag set.\n");
+ print_save_list("\t\t", env->save_list);
+ }
+
+@@ -1524,6 +1556,8 @@
+ if (service->ns_acl)
+ print_group_ref("\t\tNetState ", service->ns_acl);
+ else printf("\t\tNetState Group = free access\n");
++ if (service->ignore_state)
++ printf("\t\tIgnoreState flag set.\n");
+ print_var_list("\t\t", service->var_list);
+ print_method_list("\t\t", service->method_list);
+ print_trap_list("\t\t", service->trap_list);
+--- variables.c.orig Tue Aug 26 10:55:14 2003
++++ variables.c Thu Nov 2 13:35:27 2006
@@ -39,8 +39,8 @@
static char buf[BUFSIZ];
static char *strbuf = NULL;