Renamed FF_OUTGOING to FF_FORCE_TMPATTR which much better fits the semantics.

Call rte_cow() instead of rte_do_cow(), so that COW works properly.

Stripped "\n" off several (de)bug messages.
This commit is contained in:
Martin Mares 2000-03-30 08:50:30 +00:00
parent 6d2b32114f
commit 3076b5aedc
2 changed files with 12 additions and 11 deletions

View file

@ -57,7 +57,8 @@ val_compare(struct f_val v1, struct f_val v2)
case T_IP: case T_IP:
case T_PREFIX: case T_PREFIX:
return ipa_compare(v1.val.px.ip, v2.val.px.ip); return ipa_compare(v1.val.px.ip, v2.val.px.ip);
default: { printf( "Error comparing\n" ); return CMP_ERROR; } default:
return CMP_ERROR;
} }
} }
@ -256,7 +257,7 @@ interpret(struct f_inst *what)
* (struct f_val *) sym->aux2 = v2; * (struct f_val *) sym->aux2 = v2;
break; break;
default: default:
bug( "Set to invalid type\n" ); bug( "Set to invalid type" );
} }
break; break;
@ -324,18 +325,18 @@ interpret(struct f_inst *what)
break; break;
} }
default: default:
bug( "Invalid type for rta access (%x)\n" ); bug( "Invalid type for rta access (%x)", res.type );
} }
} }
break; break;
case P('e','a'): /* Access to extended attributes */ case P('e','a'): /* Access to extended attributes */
{ {
eattr *e = NULL; eattr *e = NULL;
if (!(f_flags & FF_OUTGOING)) if (!(f_flags & FF_FORCE_TMPATTR))
e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i ); e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i );
if (!e) if (!e)
e = ea_find( (*f_tmp_attrs), what->a2.i ); e = ea_find( (*f_tmp_attrs), what->a2.i );
if ((!e) && (f_flags & FF_OUTGOING)) if ((!e) && (f_flags & FF_FORCE_TMPATTR))
e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i ); e = ea_find( (*f_rte)->attrs->eattrs, what->a2.i );
if (!e) { if (!e) {
@ -353,7 +354,7 @@ interpret(struct f_inst *what)
case P('e','S'): case P('e','S'):
ONEARG; ONEARG;
if (v1.type != what->aux) if (v1.type != what->aux)
runtime("Wrong type when setting dynamic attribute\n"); runtime("Wrong type when setting dynamic attribute");
{ {
struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr)); struct ea_list *l = lp_alloc(f_pool, sizeof(struct ea_list) + sizeof(eattr));
@ -377,8 +378,8 @@ interpret(struct f_inst *what)
break; break;
} }
if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_OUTGOING))) { if (!(what->aux & EAF_TEMP) && (!(f_flags & FF_FORCE_TMPATTR))) {
*f_rte = rte_do_cow(*f_rte); *f_rte = rte_cow(*f_rte);
l->next = (*f_rte)->attrs->eattrs; l->next = (*f_rte)->attrs->eattrs;
(*f_rte)->attrs->eattrs = l; (*f_rte)->attrs->eattrs = l;
} else { } else {
@ -396,7 +397,7 @@ interpret(struct f_inst *what)
switch(res.type) { switch(res.type) {
case T_INT: res.val.i = v1.val.px.len; break; case T_INT: res.val.i = v1.val.px.len; break;
case T_IP: res.val.px.ip = v1.val.px.ip; break; case T_IP: res.val.px.ip = v1.val.px.ip; break;
default: bug( "Unknown prefix to conversion\n" ); default: bug( "Unknown prefix to conversion" );
} }
break; break;
case 'r': case 'r':
@ -424,7 +425,7 @@ interpret(struct f_inst *what)
} }
} }
if (!t->data) if (!t->data)
die( "Impossible: no code associated!\n" ); bug( "Impossible: no code associated!" );
return interpret(t->data); return interpret(t->data);
} }
break; break;

View file

@ -122,6 +122,6 @@ struct f_tree {
#define NEW_F_VAL struct f_val * val; val = cfg_alloc(sizeof(struct f_val)); #define NEW_F_VAL struct f_val * val; val = cfg_alloc(sizeof(struct f_val));
#define FF_OUTGOING 1 #define FF_FORCE_TMPATTR 1 /* Force all attributes to be temporary */
#endif #endif