Revision 26c09e1d

View differences:

filter/config.Y
20 20
	INT, BOOL, IP, PREFIX, PAIR, SET, STRING, BGPMASK, BGPPATH, CLIST,
21 21
	IF, THEN, ELSE, CASE,
22 22
	TRUE, FALSE,
23
	FROM, GW, NET, MASK, SOURCE,
23
	FROM, GW, NET, MASK, SOURCE, SCOPE, CAST, DEST,
24 24
	LEN,
25 25
	DEFINED,
26 26
	ADD, DELETE, CONTAINS, RESET,
......
301 301
rtadot: /* EMPTY, we are not permitted RTA. prefix */
302 302
 ;
303 303

  
304

  
305

  
306

  
307 304
function_call:
308 305
   SYM '(' var_list ')' {
309 306
     struct symbol *sym;
......
329 326

  
330 327
static_attr:
331 328
/* FIXME (maybe?) rta.from read/write */
332
   FROM    { $$ = f_new_inst(); $$->aux = T_IP;       $$->a2.i = OFFSETOF(struct rta, from); }
329
   FROM    { $$ = f_new_inst(); $$->aux = T_IP;         $$->a2.i = OFFSETOF(struct rta, from); }
333 330

  
334
/* FIXME Gw read/write */
335
 | GW      { $$ = f_new_inst(); $$->aux = T_IP;       $$->a2.i = OFFSETOF(struct rta, gw); }
336
 | NET     { $$ = f_new_inst(); $$->aux = T_PREFIX;   $$->a2.i = 0x12345678; /* This is actually ok - T_PREFIX is special-cased. */ }
337
 | SOURCE  { $$ = f_new_inst(); $$->aux = T_ENUM_RTS; $$->a2.i = OFFSETOF(struct rta, source); }
331
 | GW      { $$ = f_new_inst(); $$->aux = T_IP;         $$->a2.i = OFFSETOF(struct rta, gw); }    /* FIXME: want it read/write */
332
 | NET     { $$ = f_new_inst(); $$->aux = T_PREFIX;     $$->a2.i = 0x12345678; /* This is actually ok - T_PREFIX is special-cased. */ }
333
 | SOURCE  { $$ = f_new_inst(); $$->aux = T_ENUM_RTS;   $$->a2.i = OFFSETOF(struct rta, source); }
334
 | SCOPE   { $$ = f_new_inst(); $$->aux = T_ENUM_SCOPE; $$->a2.i = OFFSETOF(struct rta, scope); } /* FIXME: want it read/write */
335
 | CAST    { $$ = f_new_inst(); $$->aux = T_ENUM_RTC;   $$->a2.i = OFFSETOF(struct rta, cast); }
336
 | DEST    { $$ = f_new_inst(); $$->aux = T_ENUM_RTD;   $$->a2.i = OFFSETOF(struct rta, dest); }
338 337
 ;
339 338

  
340
/* FIXME rta.Scope - read/write */
341
/* FIXME rta.Cast - read */
342
/* FIXME rta.Dest - read */
343

  
344

  
345 339
term:
346 340
   '(' term ')'      { $$ = $2; }
347 341
 | term '+' term     { $$ = f_new_inst(); $$->code = '+';        $$->a1.p = $1; $$->a2.p = $3; }
filter/filter.c
200 200
static int f_flags;
201 201
static rta *f_rta_copy;
202 202

  
203
void
204
rta_cow(void)
205
{
206
  if (!f_rta_copy) {
207
    f_rta_copy = lp_alloc(f_pool, sizeof(rta));
208
    memcpy(f_rta_copy, (*f_rte)->attrs, sizeof(rta));
209
    f_rta_copy->aflags = 0;
210
    *f_rte = rte_cow(*f_rte);
211
    (*f_rte)->attrs = f_rta_copy;
212
  }
213
}
214

  
203 215
#define runtime(x) do { \
204 216
    log( L_ERR "filters, line %d: %s", what->lineno, x); \
205 217
    res.type = T_RETURN; \
......
477 489
      }
478 490

  
479 491
      if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) {
480
	if (!f_rta_copy) {
481
	  f_rta_copy = lp_alloc(f_pool, sizeof(rta));
482
	  memcpy(f_rta_copy, (*f_rte)->attrs, sizeof(rta));
483
	  f_rta_copy->aflags = 0;
484
	  *f_rte = rte_cow(*f_rte);
485
	  (*f_rte)->attrs = f_rta_copy;
486
	}
492
	rta_cow();
487 493
	l->next = f_rta_copy->eattrs;
488 494
	f_rta_copy->eattrs = l;
489 495
      } else {
filter/filter.h
109 109

  
110 110
#define T_ENUM_RTS 0x30
111 111
#define T_ENUM_BGP_ORIGIN 0x31
112
#define T_ENUM_SCOPE 0x32
113
#define T_ENUM_RTC 0x33
114
#define T_ENUM_RTD 0x34
112 115
/* new enums go here */
113 116
#define T_ENUM_EMPTY 0x3f	/* Special hack for atomic_aggr */
114 117

  
nest/config.Y
26 26

  
27 27
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
28 28
	RIP, OSPF, OSPF_EXT, OSPF_IA, OSPF_BOUNDARY, BGP, PIPE)
29
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE)
30
CF_ENUM(T_ENUM_RTC, RTC_, UNICAST, BROADCAST, MULTICAST, ANYCAST)
31
CF_ENUM(T_ENUM_RTD, RTD_, ROUTER, DEVICE, BLACKHOLE, UNREACHABLE, PROHIBIT)
29 32

  
30 33
%type <i32> idval
31 34
%type <f> imexport

Also available in: Unified diff