]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/interface.c
zebra: Fix --disable-rtadv to actually compile
[mirror_frr.git] / zebra / interface.c
index 9abb54cec8bd6580665a087887760a7ba51c68f8..9393305f06f89e307e8bf3c4d512f034aa30382a 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.  
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -190,6 +189,7 @@ if_unlink_per_ns (struct interface *ifp)
 {
   ifp->node->info = NULL;
   route_unlock_node(ifp->node);
+  ifp->node = NULL;
 }
 
 /* Look up an interface by identifier within a NS */
@@ -210,6 +210,23 @@ if_lookup_by_index_per_ns (struct zebra_ns *ns, u_int32_t ifindex)
   return ifp;
 }
 
+/* Look up an interface by name within a NS */
+struct interface *
+if_lookup_by_name_per_ns (struct zebra_ns *ns, const char *ifname)
+{
+  struct route_node *rn;
+  struct interface *ifp;
+
+  for (rn = route_top (ns->if_table); rn; rn = route_next (rn))
+    {
+      ifp = (struct interface *)rn->info;
+      if (ifp && strcmp (ifp->name, ifname) == 0)
+       return (ifp);
+    }
+
+  return NULL;
+}
+
 const char *
 ifindex2ifname_per_ns (struct zebra_ns *zns, unsigned int ifindex)
 {
@@ -691,6 +708,11 @@ if_delete_update (struct interface *ifp)
      for setting ifindex to IFINDEX_INTERNAL after processing the
      interface deletion message. */
   ifp->ifindex = IFINDEX_INTERNAL;
+  ifp->node = NULL;
+
+  /* if the ifp is in a vrf, move it to default so vrf can be deleted if desired */
+  if (ifp->vrf_id)
+    if_handle_vrf_change (ifp, VRF_DEFAULT);
 }
 
 /* VRF change for an interface */
@@ -752,6 +774,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
                                       struct in6_addr *address,
                                       int add)
 {
+  struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
   char buf[16] = "169.254.0.1";
   struct in_addr ipv4_ll;
   char mac[6];
@@ -760,6 +783,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
 
   ipv6_ll_address_to_mac(address, (u_char *)mac);
   kernel_neigh_update (add, ifp->ifindex, ipv4_ll.s_addr, mac, 6);
+  zvrf->neigh_updates++;
 }
 
 static void
@@ -825,6 +849,7 @@ if_up (struct interface *ifp)
 
   if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (ifp);
 
+#if defined (HAVE_RTADV)
   /* Enable fast tx of RA if enabled && RA interval is not in msecs */
   if (zif->rtadv.AdvSendAdvertisements &&
       (zif->rtadv.MaxRtrAdvInterval >= 1000))
@@ -832,6 +857,7 @@ if_up (struct interface *ifp)
       zif->rtadv.inFastRexmit = 1;
       zif->rtadv.NumFastReXmitsRemain = RTADV_NUM_FAST_REXMITS;
     }
+#endif
 
   /* Install connected routes to the kernel. */
   if_install_connected (ifp);
@@ -1056,8 +1082,8 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
       return;
     }
 
-  vty_out (vty, "  index %d metric %d mtu %d ",
-          ifp->ifindex, ifp->metric, ifp->mtu);
+  vty_out (vty, "  index %d metric %d mtu %d speed %u ",
+          ifp->ifindex, ifp->metric, ifp->mtu, ifp->speed);
   if (ifp->mtu6 != ifp->mtu)
     vty_out (vty, "mtu6 %d ", ifp->mtu6);
   vty_out (vty, "%s  flags: %s%s", VTY_NEWLINE,
@@ -1688,6 +1714,8 @@ link_param_cmd_set_float (struct interface *ifp, float *field,
 static void
 link_param_cmd_unset (struct interface *ifp, uint32_t type)
 {
+  if (ifp->link_params == NULL)
+    return;
 
   /* Unset field */
   UNSET_PARAM(ifp->link_params, type);
@@ -1697,7 +1725,7 @@ link_param_cmd_unset (struct interface *ifp, uint32_t type)
     zebra_interface_parameters_update (ifp);
 }
 
-DEFUN (link_params,
+DEFUN_NOSH (link_params,
        link_params_cmd,
        "link-params",
        LINK_PARAMS_STR)
@@ -1708,7 +1736,7 @@ DEFUN (link_params,
   return CMD_SUCCESS;
 }
 
-DEFUN (exit_link_params,
+DEFUN_NOSH (exit_link_params,
        exit_link_params_cmd,
        "exit-link-params",
        "Exit from Link Params configuration mode\n")