summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/config.Y3
-rw-r--r--filter/data.h1
-rw-r--r--filter/f-inst.c19
3 files changed, 22 insertions, 1 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 5cd52e40..7820e719 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -278,7 +278,7 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
SET, STRING, BGPMASK, BGPPATH, CLIST, ECLIST, LCLIST,
IF, THEN, ELSE, CASE,
TRUE, FALSE, RT, RO, UNKNOWN, GENERIC,
- FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX, WEIGHT,
+ FROM, GW, NET, MASK, PROTO, SOURCE, SCOPE, DEST, IFNAME, IFINDEX, WEIGHT, GW_MPLS,
PREFERENCE,
ROA_CHECK, ASN, SRC, DST,
IS_V4, IS_V6,
@@ -751,6 +751,7 @@ static_attr:
| IFNAME { $$ = f_new_static_attr(T_STRING, SA_IFNAME, 0); }
| IFINDEX { $$ = f_new_static_attr(T_INT, SA_IFINDEX, 1); }
| WEIGHT { $$ = f_new_static_attr(T_INT, SA_WEIGHT, 0); }
+ | GW_MPLS { $$ = f_new_static_attr(T_INT, SA_GW_MPLS, 0); }
;
term:
diff --git a/filter/data.h b/filter/data.h
index 61cdb43e..d296776d 100644
--- a/filter/data.h
+++ b/filter/data.h
@@ -100,6 +100,7 @@ enum f_sa_code {
SA_IFNAME,
SA_IFINDEX,
SA_WEIGHT,
+ SA_GW_MPLS,
} PACKED;
/* Static attribute definition (members of struct rta) */
diff --git a/filter/f-inst.c b/filter/f-inst.c
index 1378fe4a..b876a937 100644
--- a/filter/f-inst.c
+++ b/filter/f-inst.c
@@ -533,6 +533,7 @@
case SA_IFNAME: RESULT(sa.f_type, s, rta->nh.iface ? rta->nh.iface->name : ""); break;
case SA_IFINDEX: RESULT(sa.f_type, i, rta->nh.iface ? rta->nh.iface->index : 0); break;
case SA_WEIGHT: RESULT(sa.f_type, i, rta->nh.weight + 1); break;
+ case SA_GW_MPLS: RESULT(sa.f_type, i, rta->nh.labels ? rta->nh.label[0] : MPLS_NULL); break;
default:
bug("Invalid static attribute access (%u/%u)", sa.f_type, sa.sa_code);
@@ -569,6 +570,7 @@
rta->nh.iface = n->iface;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
}
break;
@@ -587,6 +589,7 @@
rta->nh.iface = NULL;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
}
break;
@@ -601,6 +604,22 @@
rta->nh.iface = ifa;
rta->nh.next = NULL;
rta->hostentry = NULL;
+ rta->nh.labels = 0;
+ }
+ break;
+
+ case SA_GW_MPLS:
+ {
+ if (v1.val.i >= 0x100000)
+ runtime( "Invalid MPLS label" );
+
+ if (v1.val.i != MPLS_NULL)
+ {
+ rta->nh.label[0] = v1.val.i;
+ rta->nh.labels = 1;
+ }
+ else
+ rta->nh.labels = 0;
}
break;