"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cfparse.y" between
mrouted-3.9.7.tar.gz and mrouted-3.9.8.tar.gz

About: mrouted is an implementation of the DVMRP multicast routing protocol.

cfparse.y  (mrouted-3.9.7):cfparse.y  (mrouted-3.9.8)
skipping to change at line 18 skipping to change at line 18
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include "defs.h" #include "defs.h"
#include <netdb.h> #include <netdb.h>
#include <ifaddrs.h> #include <ifaddrs.h>
/* /*
* Local function declarations * Local function declarations
*/ */
static void fatal(char *fmt, ...); static void fatal(const char *fmt, ...)
static void warn(char *fmt, ...); __attribute__((__format__ (printf, 1, 2)))
__attribute__((__nonnull__ (1)));
static void warn(const char *fmt, ...)
__attribute__((__format__ (printf, 1, 2)))
__attribute__((__nonnull__ (1)));
static void yyerror(char *s); static void yyerror(char *s);
static char * next_word(void); static char * next_word(void);
static int yylex(void); static int yylex(void);
static uint32_t valid_if(char *s); static uint32_t valid_if(char *s);
static const char * ifconfaddr(uint32_t a); static const char * ifconfaddr(uint32_t a);
int yyparse(void); int yyparse(void);
static FILE *f; static FILE *f;
char *configfilename = _PATH_MROUTED_CONF; char *configfilename = _PATH_MROUTED_CONF;
skipping to change at line 329 skipping to change at line 333
v->uv_subnetbcast = subnet | ~mask; v->uv_subnetbcast = subnet | ~mask;
} }
| NETMASK | NETMASK
{ {
warn("Expected address after netmask keyword, ignored"); warn("Expected address after netmask keyword, ignored");
} }
| ALTNET addrmask | ALTNET addrmask
{ {
struct phaddr *ph; struct phaddr *ph;
ph = (struct phaddr *)malloc(sizeof(struct phaddr)); ph = malloc(sizeof(struct phaddr));
if (!ph) { if (!ph) {
fatal("out of memory"); fatal("Failed allocating memory for 'struct phaddr'");
return 0; /* Never reached */ return 0;
} }
if ($2.mask) { if ($2.mask) {
VAL_TO_MASK(ph->pa_subnetmask, $2.mask); VAL_TO_MASK(ph->pa_subnetmask, $2.mask);
} else { } else {
ph->pa_subnetmask = v->uv_subnetmask; ph->pa_subnetmask = v->uv_subnetmask;
} }
ph->pa_subnet = $2.addr & ph->pa_subnetmask; ph->pa_subnet = $2.addr & ph->pa_subnetmask;
ph->pa_subnetbcast = ph->pa_subnet | ~ph->pa_subnetmask; ph->pa_subnetbcast = ph->pa_subnet | ~ph->pa_subnetmask;
skipping to change at line 412 skipping to change at line 416
v->uv_rate_limit = $2; v->uv_rate_limit = $2;
} }
| RATE_LIMIT | RATE_LIMIT
{ {
warn("Expected number after rate_limit keyword, ignored"); warn("Expected number after rate_limit keyword, ignored");
} }
| BOUNDARY bound | BOUNDARY bound
{ {
struct vif_acl *v_acl; struct vif_acl *v_acl;
v_acl = (struct vif_acl *)malloc(sizeof(struct vif_acl)); v_acl = malloc(sizeof(struct vif_acl));
if (!v_acl) { if (!v_acl) {
fatal("out of memory"); fatal("Failed allocating memory for 'struct vif_acl'");
return 0; /* Never reached */ return 0;
} }
VAL_TO_MASK(v_acl->acl_mask, $2.mask); VAL_TO_MASK(v_acl->acl_mask, $2.mask);
v_acl->acl_addr = $2.addr & v_acl->acl_mask; v_acl->acl_addr = $2.addr & v_acl->acl_mask;
if ($2.addr & ~v_acl->acl_mask) if ($2.addr & ~v_acl->acl_mask)
warn("Boundary spec %s/%d has host bits set", warn("Boundary spec %s/%d has host bits set",
inet_fmt($2.addr, s1, sizeof(s1)), $2.mask); inet_fmt($2.addr, s1, sizeof(s1)), $2.mask);
v_acl->acl_next = v->uv_acl; v_acl->acl_next = v->uv_acl;
v->uv_acl = v_acl; v->uv_acl = v_acl;
} }
skipping to change at line 474 skipping to change at line 478
if ($2 < MIN_PRUNE_LIFETIME) if ($2 < MIN_PRUNE_LIFETIME)
warn("prune_lifetime %d must be at least %d", $2, MIN_PRUNE_LIFET IME); warn("prune_lifetime %d must be at least %d", $2, MIN_PRUNE_LIFET IME);
else else
v->uv_prune_lifetime = $2; v->uv_prune_lifetime = $2;
} }
| ACCEPT filter | ACCEPT filter
{ {
if (v->uv_filter == NULL) { if (v->uv_filter == NULL) {
struct vif_filter *v_filter; struct vif_filter *v_filter;
v_filter = (struct vif_filter *)malloc(sizeof(struct vif_filter)) ; v_filter = malloc(sizeof(struct vif_filter));
if (!v_filter) { if (!v_filter) {
fatal("out of memory"); fatal("Failed allocating memory for 'struct vif_filter'");
return 0; /* Never reached */ return 0;
} }
v_filter->vf_flags = 0; v_filter->vf_flags = 0;
v_filter->vf_type = VFT_ACCEPT; v_filter->vf_type = VFT_ACCEPT;
v_filter->vf_filter = $2; v_filter->vf_filter = $2;
v->uv_filter = v_filter; v->uv_filter = v_filter;
} else if (v->uv_filter->vf_type != VFT_ACCEPT) { } else if (v->uv_filter->vf_type != VFT_ACCEPT) {
fatal("Cannot accept and deny"); fatal("Cannot accept and deny");
} else { } else {
struct vf_element *p; struct vf_element *p;
skipping to change at line 504 skipping to change at line 508
} }
| ACCEPT | ACCEPT
{ {
warn("Expected filter spec after accept keyword, ignored"); warn("Expected filter spec after accept keyword, ignored");
} }
| DENY filter | DENY filter
{ {
if (!v->uv_filter) { if (!v->uv_filter) {
struct vif_filter *v_filter; struct vif_filter *v_filter;
v_filter = (struct vif_filter *)malloc(sizeof(struct vif_filter)) ; v_filter = malloc(sizeof(struct vif_filter));
if (!v_filter) { if (!v_filter) {
fatal("out of memory"); fatal("Failed allocating memory for 'struct vif_filter'");
return 0; /* Never reached */ return 0;
} }
v_filter->vf_flags = 0; v_filter->vf_flags = 0;
v_filter->vf_type = VFT_DENY; v_filter->vf_type = VFT_DENY;
v_filter->vf_filter = $2; v_filter->vf_filter = $2;
v->uv_filter = v_filter; v->uv_filter = v_filter;
} else if (v->uv_filter->vf_type != VFT_DENY) { } else if (v->uv_filter->vf_type != VFT_DENY) {
fatal("Cannot accept and deny"); fatal("Cannot accept and deny");
} else { } else {
struct vf_element *p; struct vf_element *p;
skipping to change at line 623 skipping to change at line 627
; ;
filtelement : filtelem { $$ = $1; } filtelement : filtelem { $$ = $1; }
| filtelem EXACT { $1->vfe_flags |= VFEF_EXACT; $$ = $1; } | filtelem EXACT { $1->vfe_flags |= VFEF_EXACT; $$ = $1; }
; ;
filtelem : ADDRMASK filtelem : ADDRMASK
{ {
struct vf_element *vfe; struct vf_element *vfe;
vfe = (struct vf_element *)malloc(sizeof(struct vf_element)); vfe = malloc(sizeof(struct vf_element));
if (!vfe) { if (!vfe) {
fatal("out of memory"); fatal("Failed allocating memory for 'struct vf_element'");
return 0; /* Never reached */ return 0;
} }
vfe->vfe_addr = $1.addr; vfe->vfe_addr = $1.addr;
VAL_TO_MASK(vfe->vfe_mask, $1.mask); VAL_TO_MASK(vfe->vfe_mask, $1.mask);
vfe->vfe_flags = 0; vfe->vfe_flags = 0;
vfe->vfe_next = NULL; vfe->vfe_next = NULL;
$$ = vfe; $$ = vfe;
} }
%% %%
static void fatal(char *fmt, ...) static void fatal(const char *fmt, ...)
{ {
va_list ap; va_list ap;
char buf[MAXHOSTNAMELEN + 100]; char buf[MAXHOSTNAMELEN + 100];
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap); va_end(ap);
logit(LOG_ERR, 0, "%s: %s near line %d", configfilename, buf, lineno); logit(LOG_ERR, 0, "%s: %s near line %d", configfilename, buf, lineno);
} }
static void warn(char *fmt, ...) static void warn(const char *fmt, ...)
{ {
va_list ap; va_list ap;
char buf[200]; char buf[200];
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap); va_end(ap);
logit(LOG_WARNING, 0, "%s: %s near line %d", configfilename, buf, lineno); logit(LOG_WARNING, 0, "%s: %s near line %d", configfilename, buf, lineno);
} }
 End of changes. 13 change blocks. 
19 lines changed or deleted 23 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS