int
ripng_interface_delete (int command, struct zclient *zclient,
			zebra_size_t length)
{
  struct interface *ifp;
  struct stream *s;

  s = zclient->ibuf;
  /*  zebra_interface_state_read() updates interface structure in iflist */
  ifp = zebra_interface_state_read(s);

  if (ifp == NULL)
    return 0;

  if (if_is_up (ifp)) {
    ripng_if_down(ifp);
  }

  zlog_info("interface delete %s index %d flags %#"PRIx64" metric %d mtu %d",
            ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6);

  /* To support pseudo interface do not free interface structure.  */
  /* if_delete(ifp); */
  ifp->ifindex = IFINDEX_INTERNAL;

  return 0;
}
/* Inteface link down message processing. */
int
ripng_interface_down (int command, struct zclient *zclient,
		      zebra_size_t length)
{
  struct stream *s;
  struct interface *ifp;

  /* zebra_interface_state_read() updates interface structure in iflist. */
  s = zclient->ibuf;
  ifp = zebra_interface_state_read (s);

  if (ifp == NULL)
    return 0;

  ripng_if_down (ifp);

  if (IS_RIPNG_DEBUG_ZEBRA)
    zlog_debug ("interface down %s index %d flags %#"PRIx64" metric %d mtu %d",
		ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu6);

  return 0;
}
Exemple #3
0
/* Inteface link down message processing. */
int
ripng_interface_down (int command, struct zclient *zclient,
		      kroute_size_t length)
{
  struct stream *s;
  struct interface *ifp;

  /* kroute_interface_state_read() updates interface structure in iflist. */
  s = zclient->ibuf;
  ifp = kroute_interface_state_read (s);

  if (ifp == NULL)
    return 0;

  ripng_if_down (ifp);

  if (IS_RIPNG_DEBUG_KROUTE)
    zlog_debug ("interface down %s index %d flags %#llx metric %d mtu %d",
		ifp->name, ifp->ifindex,
		(unsigned long long) ifp->flags, ifp->metric, ifp->mtu6);

  return 0;
}
/* Check RIPng is enabed on this interface. */
void
ripng_enable_apply (struct interface *ifp)
{
  int ret;
  struct ripng_interface *ri = NULL;

  /* Check interface. */
  if (! if_is_up (ifp))
    return;
  
  ri = ifp->info;

  /* Is this interface a candidate for RIPng ? */
  ret = ripng_enable_network_lookup_if (ifp);

  /* If the interface is matched. */
  if (ret > 0)
    ri->enable_network = 1;
  else
    ri->enable_network = 0;

  /* Check interface name configuration. */
  ret = ripng_enable_if_lookup (ifp->name);
  if (ret >= 0)
    ri->enable_interface = 1;
  else
    ri->enable_interface = 0;

  /* any candidate interface MUST have a link-local IPv6 address */
  if ((! ripng_if_ipv6_lladdress_check (ifp)) &&
      (ri->enable_network || ri->enable_interface)) {
    ri->enable_network = 0;
    ri->enable_interface = 0;
    zlog_warn("Interface %s does not have any link-local address",
              ifp->name);
  }

  /* Update running status of the interface. */
  if (ri->enable_network || ri->enable_interface)
    {
	{
	  if (IS_RIPNG_DEBUG_EVENT)
	    zlog_debug ("RIPng turn on %s", ifp->name);

	  /* Add interface wake up thread. */
	  if (! ri->t_wakeup)
	    ri->t_wakeup = thread_add_timer (master, ripng_interface_wakeup,
					     ifp, 1);

	  ripng_connect_set (ifp, 1);
	}
    }
  else
    {
      if (ri->running)
	{
	  /* Might as well clean up the route table as well
	   * ripng_if_down sets to 0 ri->running, and displays "turn off %s"
	   **/
	  ripng_if_down(ifp);

	  ripng_connect_set (ifp, 0);
	}
    }
}