Diff for /embedaddon/quagga/zebra/zebra_routemap.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 17:26:11 version 1.1.1.2, 2016/11/02 10:09:10
Line 28 Line 28
 #include "command.h"  #include "command.h"
 #include "filter.h"  #include "filter.h"
 #include "plist.h"  #include "plist.h"
   #include "vrf.h"
   
 #include "zebra/zserv.h"  #include "zebra/zserv.h"
   
Line 123  zebra_route_set_delete (struct vty *vty, struct route_ Line 124  zebra_route_set_delete (struct vty *vty, struct route_
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
 /* `match interface IFNAME' */  /* `match interface IFNAME' */
 /* Match function return 1 if match is success else return zero. */  /* Match function return 1 if match is success else return zero. */
 static route_map_result_t  static route_map_result_t
 route_match_interface (void *rule, struct prefix *prefix,  route_match_interface (void *rule, struct prefix *prefix,
                        route_map_object_t type, void *object)                         route_map_object_t type, void *object)
 {  {
     struct nexthop_vrfid *nh_vrf;
   struct nexthop *nexthop;    struct nexthop *nexthop;
   char *ifname = rule;    char *ifname = rule;
  unsigned int ifindex;  ifindex_t ifindex;
   
   if (type == RMAP_ZEBRA)    if (type == RMAP_ZEBRA)
     {      {
       if (strcasecmp(ifname, "any") == 0)        if (strcasecmp(ifname, "any") == 0)
         return RMAP_MATCH;          return RMAP_MATCH;
      ifindex = ifname2ifindex(ifname);      nh_vrf = object;
       if (!nh_vrf)
         return RMAP_NOMATCH;
       ifindex = ifname2ifindex_vrf (ifname, nh_vrf->vrf_id);
       if (ifindex == 0)        if (ifindex == 0)
         return RMAP_NOMATCH;          return RMAP_NOMATCH;
      nexthop = object;      nexthop = nh_vrf->nexthop;
       if (!nexthop)        if (!nexthop)
         return RMAP_NOMATCH;          return RMAP_NOMATCH;
       if (nexthop->ifindex == ifindex)        if (nexthop->ifindex == ifindex)
Line 365  DEFUN (set_src, Line 370  DEFUN (set_src,
        "src address\n")         "src address\n")
 {  {
   struct in_addr src;    struct in_addr src;
  struct interface *pif;  struct interface *pif = NULL;
   vrf_iter_t iter;
   
   if (inet_pton(AF_INET, argv[0], &src) <= 0)    if (inet_pton(AF_INET, argv[0], &src) <= 0)
     {      {
Line 373  DEFUN (set_src, Line 379  DEFUN (set_src,
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
    pif = if_lookup_exact_address (src);  for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
    if (!pif)    if ((pif = if_lookup_exact_address_vrf (src, vrf_iter2id (iter))) != NULL)
      {      break;
        vty_out (vty, "%% not a local address%s", VTY_NEWLINE);
        return CMD_WARNING;  if (!pif)
      }    {
       vty_out (vty, "%% not a local address%s", VTY_NEWLINE);
       return CMD_WARNING;
     }
 
   return zebra_route_set_add (vty, vty->index, "src", argv[0]);    return zebra_route_set_add (vty, vty->index, "src", argv[0]);
 }  }
   
Line 422  route_match_ip_next_hop (void *rule, struct prefix *pr Line 432  route_match_ip_next_hop (void *rule, struct prefix *pr
       switch (nexthop->type) {        switch (nexthop->type) {
       case NEXTHOP_TYPE_IFINDEX:        case NEXTHOP_TYPE_IFINDEX:
       case NEXTHOP_TYPE_IFNAME:        case NEXTHOP_TYPE_IFNAME:
           /* Interface routes can't match ip next-hop */
           return RMAP_NOMATCH;
       case NEXTHOP_TYPE_IPV4_IFINDEX:        case NEXTHOP_TYPE_IPV4_IFINDEX:
       case NEXTHOP_TYPE_IPV4_IFNAME:        case NEXTHOP_TYPE_IPV4_IFNAME:
         if (nexthop->rtype != NEXTHOP_TYPE_IPV4)  
                 return RMAP_NOMATCH;  
         p.family = AF_INET;  
         p.prefix = nexthop->rgate.ipv4;  
         p.prefixlen = IPV4_MAX_BITLEN;  
         break;  
       case NEXTHOP_TYPE_IPV4:        case NEXTHOP_TYPE_IPV4:
         p.family = AF_INET;          p.family = AF_INET;
         p.prefix = nexthop->gate.ipv4;          p.prefix = nexthop->gate.ipv4;
Line 471  static struct route_map_rule_cmd route_match_ip_next_h Line 477  static struct route_map_rule_cmd route_match_ip_next_h
   route_match_ip_next_hop_compile,    route_match_ip_next_hop_compile,
   route_match_ip_next_hop_free    route_match_ip_next_hop_free
 };  };
 /* `match ip next-hop prefix-list PREFIX_LIST' */  /* `match ip next-hop prefix-list PREFIX_LIST' */
   
 static route_map_result_t  static route_map_result_t
Line 488  route_match_ip_next_hop_prefix_list (void *rule, struc Line 494  route_match_ip_next_hop_prefix_list (void *rule, struc
       switch (nexthop->type) {        switch (nexthop->type) {
       case NEXTHOP_TYPE_IFINDEX:        case NEXTHOP_TYPE_IFINDEX:
       case NEXTHOP_TYPE_IFNAME:        case NEXTHOP_TYPE_IFNAME:
           /* Interface routes can't match ip next-hop */
           return RMAP_NOMATCH;
       case NEXTHOP_TYPE_IPV4_IFINDEX:        case NEXTHOP_TYPE_IPV4_IFINDEX:
       case NEXTHOP_TYPE_IPV4_IFNAME:        case NEXTHOP_TYPE_IPV4_IFNAME:
         if (nexthop->rtype != NEXTHOP_TYPE_IPV4)  
                 return RMAP_NOMATCH;  
         p.family = AF_INET;  
         p.prefix = nexthop->rgate.ipv4;  
         p.prefixlen = IPV4_MAX_BITLEN;  
         break;  
       case NEXTHOP_TYPE_IPV4:        case NEXTHOP_TYPE_IPV4:
         p.family = AF_INET;          p.family = AF_INET;
         p.prefix = nexthop->gate.ipv4;          p.prefix = nexthop->gate.ipv4;
Line 533  static struct route_map_rule_cmd route_match_ip_next_h Line 535  static struct route_map_rule_cmd route_match_ip_next_h
   route_match_ip_next_hop_prefix_list_compile,    route_match_ip_next_hop_prefix_list_compile,
   route_match_ip_next_hop_prefix_list_free    route_match_ip_next_hop_prefix_list_free
 };  };
 /* `match ip address IP_ACCESS_LIST' */  /* `match ip address IP_ACCESS_LIST' */
   
 /* Match function should return 1 if match is success else return  /* Match function should return 1 if match is success else return
Line 579  static struct route_map_rule_cmd route_match_ip_addres Line 581  static struct route_map_rule_cmd route_match_ip_addres
   route_match_ip_address_compile,    route_match_ip_address_compile,
   route_match_ip_address_free    route_match_ip_address_free
 };  };
 /* `match ip address prefix-list PREFIX_LIST' */  /* `match ip address prefix-list PREFIX_LIST' */
   
 static route_map_result_t  static route_map_result_t
Line 620  static struct route_map_rule_cmd route_match_ip_addres Line 622  static struct route_map_rule_cmd route_match_ip_addres
   route_match_ip_address_prefix_list_free    route_match_ip_address_prefix_list_free
 };  };
   
 /* `set src A.B.C.D' */  /* `set src A.B.C.D' */
   
 /* Set src. */  /* Set src. */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>