Diff for /embedaddon/quagga/ripngd/ripng_interface.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:12
Line 35 Line 35
 #include "table.h"  #include "table.h"
 #include "thread.h"  #include "thread.h"
 #include "privs.h"  #include "privs.h"
   #include "vrf.h"
   
 #include "ripngd/ripngd.h"  #include "ripngd/ripngd.h"
 #include "ripngd/ripng_debug.h"  #include "ripngd/ripng_debug.h"
 /* If RFC2133 definition is used. */  /* If RFC2133 definition is used. */
 #ifndef IPV6_JOIN_GROUP  #ifndef IPV6_JOIN_GROUP
 #define IPV6_JOIN_GROUP  IPV6_ADD_MEMBERSHIP   #define IPV6_JOIN_GROUP  IPV6_ADD_MEMBERSHIP 
Line 163  ripng_if_down (struct interface *ifp) Line 164  ripng_if_down (struct interface *ifp)
   struct route_node *rp;    struct route_node *rp;
   struct ripng_info *rinfo;    struct ripng_info *rinfo;
   struct ripng_interface *ri;    struct ripng_interface *ri;
     struct list *list = NULL;
     struct listnode *listnode = NULL, *nextnode = NULL;
   
   if (ripng)    if (ripng)
    {    for (rp = route_top (ripng->table); rp; rp = route_next (rp))
      for (rp = route_top (ripng->table); rp; rp = route_next (rp))      if ((list = rp->info) != NULL)
        if ((rinfo = rp->info) != NULL)        for (ALL_LIST_ELEMENTS (list, listnode, nextnode, rinfo))
          {          if (rinfo->ifindex == ifp->ifindex)
            /* Routes got through this interface. */            ripng_ecmp_delete (rinfo);
            if (rinfo->ifindex == ifp->ifindex 
                && rinfo->type == ZEBRA_ROUTE_RIPNG 
                && rinfo->sub_type == RIPNG_ROUTE_RTE) 
              { 
                ripng_zebra_ipv6_delete ((struct prefix_ipv6 *) &rp->p, 
                                         &rinfo->nexthop, 
                                         rinfo->ifindex); 
   
                 ripng_redistribute_delete (rinfo->type, rinfo->sub_type,  
                                            (struct prefix_ipv6 *)&rp->p,  
                                            rinfo->ifindex);  
               }  
             else  
               {  
                 /* All redistributed routes got through this interface,  
                  * but the static and system ones are kept. */  
                 if ((rinfo->ifindex == ifp->ifindex) &&  
                     (rinfo->type != ZEBRA_ROUTE_STATIC) &&  
                     (rinfo->type != ZEBRA_ROUTE_SYSTEM))  
                   ripng_redistribute_delete (rinfo->type, rinfo->sub_type,  
                                              (struct prefix_ipv6 *) &rp->p,  
                                              rinfo->ifindex);  
               }  
           }  
     }  
   
   ri = ifp->info;    ri = ifp->info;
       
   if (ri->running)    if (ri->running)
Line 214  ripng_if_down (struct interface *ifp) Line 192  ripng_if_down (struct interface *ifp)
   
 /* Inteface link up message processing. */  /* Inteface link up message processing. */
 int  int
ripng_interface_up (int command, struct zclient *zclient, zebra_size_t length)ripng_interface_up (int command, struct zclient *zclient, zebra_size_t length,
     vrf_id_t vrf_id)
 {  {
   struct stream *s;    struct stream *s;
   struct interface *ifp;    struct interface *ifp;
   
   /* zebra_interface_state_read() updates interface structure in iflist. */    /* zebra_interface_state_read() updates interface structure in iflist. */
   s = zclient->ibuf;    s = zclient->ibuf;
  ifp = zebra_interface_state_read (s);  ifp = zebra_interface_state_read (s, vrf_id);
   
   if (ifp == NULL)    if (ifp == NULL)
     return 0;      return 0;
Line 246  ripng_interface_up (int command, struct zclient *zclie Line 225  ripng_interface_up (int command, struct zclient *zclie
 /* Inteface link down message processing. */  /* Inteface link down message processing. */
 int  int
 ripng_interface_down (int command, struct zclient *zclient,  ripng_interface_down (int command, struct zclient *zclient,
                      zebra_size_t length)                      zebra_size_t length, vrf_id_t vrf_id)
 {  {
   struct stream *s;    struct stream *s;
   struct interface *ifp;    struct interface *ifp;
   
   /* zebra_interface_state_read() updates interface structure in iflist. */    /* zebra_interface_state_read() updates interface structure in iflist. */
   s = zclient->ibuf;    s = zclient->ibuf;
  ifp = zebra_interface_state_read (s);  ifp = zebra_interface_state_read (s, vrf_id);
   
   if (ifp == NULL)    if (ifp == NULL)
     return 0;      return 0;
Line 270  ripng_interface_down (int command, struct zclient *zcl Line 249  ripng_interface_down (int command, struct zclient *zcl
   
 /* Inteface addition message from zebra. */  /* Inteface addition message from zebra. */
 int  int
ripng_interface_add (int command, struct zclient *zclient, zebra_size_t length)ripng_interface_add (int command, struct zclient *zclient, zebra_size_t length,
     vrf_id_t vrf_id)
 {  {
   struct interface *ifp;    struct interface *ifp;
   
  ifp = zebra_interface_add_read (zclient->ibuf);  ifp = zebra_interface_add_read (zclient->ibuf, vrf_id);
   
   if (IS_RIPNG_DEBUG_ZEBRA)    if (IS_RIPNG_DEBUG_ZEBRA)
     zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d",      zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d",
Line 295  ripng_interface_add (int command, struct zclient *zcli Line 275  ripng_interface_add (int command, struct zclient *zcli
   
 int  int
 ripng_interface_delete (int command, struct zclient *zclient,  ripng_interface_delete (int command, struct zclient *zclient,
                        zebra_size_t length)                        zebra_size_t length, vrf_id_t vrf_id)
 {  {
   struct interface *ifp;    struct interface *ifp;
   struct stream *s;    struct stream *s;
   
   s = zclient->ibuf;    s = zclient->ibuf;
   /*  zebra_interface_state_read() updates interface structure in iflist */    /*  zebra_interface_state_read() updates interface structure in iflist */
  ifp = zebra_interface_state_read(s);  ifp = zebra_interface_state_read (s, vrf_id);
   
   if (ifp == NULL)    if (ifp == NULL)
     return 0;      return 0;
Line 409  ripng_apply_address_add (struct connected *ifc) { Line 389  ripng_apply_address_add (struct connected *ifc) {
   
 int  int
 ripng_interface_address_add (int command, struct zclient *zclient,  ripng_interface_address_add (int command, struct zclient *zclient,
                             zebra_size_t length)                             zebra_size_t length, vrf_id_t vrf_id)
 {  {
   struct connected *c;    struct connected *c;
   struct prefix *p;    struct prefix *p;
   
   c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,     c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, 
                                    zclient->ibuf);                                    zclient->ibuf, vrf_id);
   
   if (c == NULL)    if (c == NULL)
     return 0;      return 0;
Line 476  ripng_apply_address_del (struct connected *ifc) { Line 456  ripng_apply_address_del (struct connected *ifc) {
   
 int  int
 ripng_interface_address_delete (int command, struct zclient *zclient,  ripng_interface_address_delete (int command, struct zclient *zclient,
                                zebra_size_t length)                                zebra_size_t length, vrf_id_t vrf_id)
 {  {
   struct connected *ifc;    struct connected *ifc;
   struct prefix *p;    struct prefix *p;
   char buf[INET6_ADDRSTRLEN];    char buf[INET6_ADDRSTRLEN];
   
   ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,     ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, 
                                      zclient->ibuf);                                      zclient->ibuf, vrf_id);
       
   if (ifc)    if (ifc)
     {      {
Line 505  ripng_interface_address_delete (int command, struct zc Line 485  ripng_interface_address_delete (int command, struct zc
   
   return 0;    return 0;
 }  }
 /* RIPng enable interface vector. */  /* RIPng enable interface vector. */
 vector ripng_enable_if;  vector ripng_enable_if;
   
Line 812  ripng_enable_apply_all (void) Line 792  ripng_enable_apply_all (void)
   for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))    for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
     ripng_enable_apply (ifp);      ripng_enable_apply (ifp);
 }  }
 /* Clear all network and neighbor configuration */  /* Clear all network and neighbor configuration */
 void  void
 ripng_clean_network ()  ripng_clean_network ()
Line 835  ripng_clean_network () Line 815  ripng_clean_network ()
       vector_slot (ripng_enable_if, i) = NULL;        vector_slot (ripng_enable_if, i) = NULL;
     }      }
 }  }
 /* Vector to store passive-interface name. */  /* Vector to store passive-interface name. */
 vector Vripng_passive_interface;  vector Vripng_passive_interface;
   
Line 1103  DEFUN (no_ripng_passive_interface, Line 1083  DEFUN (no_ripng_passive_interface,
 {  {
   return ripng_passive_interface_unset (vty, argv[0]);    return ripng_passive_interface_unset (vty, argv[0]);
 }  }
 static struct ripng_interface *  static struct ripng_interface *
 ri_new (void)  ri_new (void)
 {  {
Line 1200  void Line 1180  void
 ripng_if_init ()  ripng_if_init ()
 {  {
   /* Interface initialize. */    /* Interface initialize. */
   iflist = list_new ();  
   if_add_hook (IF_NEW_HOOK, ripng_if_new_hook);    if_add_hook (IF_NEW_HOOK, ripng_if_new_hook);
   if_add_hook (IF_DELETE_HOOK, ripng_if_delete_hook);    if_add_hook (IF_DELETE_HOOK, ripng_if_delete_hook);
   

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


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