]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Allows some modifications of dest attribute in filters.
authorOndrej Zajicek <santiago@crfreenet.org>
Sat, 28 Apr 2012 23:35:52 +0000 (01:35 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Sat, 28 Apr 2012 23:35:52 +0000 (01:35 +0200)
doc/bird.sgml
filter/config.Y
filter/filter.c

index a94fb9e14141ecb5e2ece960eaff11333f9e8e9a..3edd6e0e565947a65a742d23fe118c0d8152a541 100644 (file)
@@ -1072,7 +1072,16 @@ undefined value is regarded as empty clist for most purposes.
        routes). Read-only.
 
        <tag><m/enum/ dest</tag>
-       Type of destination the packets should be sent to (<cf/RTD_ROUTER/ for forwarding to a neighboring router, <cf/RTD_DEVICE/ for routing to a directly-connected network, <cf/RTD_BLACKHOLE/ for packets to be silently discarded, <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that should be returned with ICMP host unreachable / ICMP administratively prohibited messages). Read-only.
+       Type of destination the packets should be sent to
+       (<cf/RTD_ROUTER/ for forwarding to a neighboring router,
+       <cf/RTD_DEVICE/ for routing to a directly-connected network,
+       <cf/RTD_MULTIPATH/ for multipath destinations,
+       <cf/RTD_BLACKHOLE/ for packets to be silently discarded,
+       <cf/RTD_UNREACHABLE/, <cf/RTD_PROHIBIT/ for packets that
+       should be returned with ICMP host unreachable / ICMP
+       administratively prohibited messages). Can be changed, but
+       only to <cf/RTD_BLACKHOLE/, <cf/RTD_UNREACHABLE/ or
+       <cf/RTD_PROHIBIT/.
 
        <tag><m/int/ igp_metric</tag>
        The optional attribute that can be used to specify a distance
index 2e8b522e39ec39f9369a1c8b5c550b64dd2153c4..0eeb2ce1748b77ad60f6495c38db245d579ed0e1 100644 (file)
@@ -703,7 +703,7 @@ static_attr:
  | SOURCE  { $$ = f_new_inst(); $$->aux = T_ENUM_RTS;   $$->a2.i = OFFSETOF(struct rta, source); }
  | SCOPE   { $$ = f_new_inst(); $$->aux = T_ENUM_SCOPE; $$->a2.i = OFFSETOF(struct rta, scope);  $$->a1.i = 1; }
  | CAST    { $$ = f_new_inst(); $$->aux = T_ENUM_RTC;   $$->a2.i = OFFSETOF(struct rta, cast); }
- | DEST    { $$ = f_new_inst(); $$->aux = T_ENUM_RTD;   $$->a2.i = OFFSETOF(struct rta, dest); }
+ | DEST    { $$ = f_new_inst(); $$->aux = T_ENUM_RTD;   $$->a2.i = OFFSETOF(struct rta, dest);   $$->a1.i = 1; }
  ;
 
 term:
index acdcfd2beece844f0c51341ac5f3330b4ba45715..49b67391a673552d5e48019a6543ab08b547d10a 100644 (file)
@@ -852,12 +852,25 @@ interpret(struct f_inst *what)
     {
       struct rta *rta = (*f_rte)->attrs;
       switch (what->aux) {
-      case T_ENUM:
-       * ((char *) rta + what->a2.i) = v1.val.i;
-       break;
+
       case T_IP:
        * (ip_addr *) ((char *) rta + what->a2.i) = v1.val.px.ip;
        break;
+
+      case T_ENUM_SCOPE:
+       rta->scope = v1.val.i;
+       break;
+
+      case T_ENUM_RTD:
+       i = v1.val.i;
+       if ((i != RTD_BLACKHOLE) && (i != RTD_UNREACHABLE) && (i != RTD_PROHIBIT))
+         runtime( "Destination can be changed only to blackhole, unreachable or prohibit" );
+       rta->dest = i;
+       rta->gw = IPA_NONE;
+       rta->iface = NULL;
+       rta->nexthops = NULL;
+       break;
+
       default:
        bug( "Unknown type in set of static attribute" );
       }