Ejemplo n.º 1
0
int
isis_zebra_if_state_up (int command, struct zclient *zclient,
                        zebra_size_t length)
{
    struct interface *ifp;

    ifp = zebra_interface_if_lookup (zclient->ibuf);

    if (!ifp)
        return 0;

    if (if_is_operative (ifp))
    {
        zebra_interface_if_set_value (zclient->ibuf, ifp);
        /* HT: This is wrong actually. We can't assume that circuit exist
         * if we delete circuit during if_state_down event. Needs rethink.
         * TODO */
        isis_circuit_update_params (circuit_scan_by_ifp (ifp), ifp);
        return 0;
    }

    zebra_interface_if_set_value (zclient->ibuf, ifp);
    isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

    return 0;
}
Ejemplo n.º 2
0
int
isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length)
{
    struct interface *ifp;
    struct stream *s;

    s = zclient->ibuf;
    ifp = zebra_interface_state_read (s);

    if (!ifp)
        return 0;

    if (if_is_operative (ifp))
        zlog_warn ("Zebra: got delete of %s, but interface is still up",
                   ifp->name);

    zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d",
                ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);

    if_delete (ifp);

    isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

    return 0;
}
Ejemplo n.º 3
0
int
isis_zebra_if_address_add (int command, struct zclient *zclient,
                           zebra_size_t length)
{
    struct connected *c;
    struct prefix *p;
    char buf[BUFSIZ];

    c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,
                                      zclient->ibuf);

    if (c == NULL)
        return 0;

    p = c->address;

    prefix2str (p, buf, BUFSIZ);
#ifdef EXTREME_DEBUG
    if (p->family == AF_INET)
        zlog_debug ("connected IP address %s", buf);
#ifdef HAVE_IPV6
    if (p->family == AF_INET6)
        zlog_debug ("connected IPv6 address %s", buf);
#endif /* HAVE_IPV6 */
#endif /* EXTREME_DEBUG */
    if (if_is_operative (c->ifp))
        isis_circuit_add_addr (circuit_scan_by_ifp (c->ifp), c);

    return 0;
}
Ejemplo n.º 4
0
static int
isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length)
{
  struct interface *ifp;
  struct stream *s;

  s = zclient->ibuf;
  ifp = zebra_interface_state_read (s);

  if (!ifp)
    return 0;

  if (if_is_operative (ifp))
    zlog_warn ("Zebra: got delete of %s, but interface is still up",
	       ifp->name);

  if (isis->debugs & DEBUG_ZEBRA)
    zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d",
		ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu);


  /* Cannot call if_delete because we should retain the pseudo interface
     in case there is configuration info attached to it. */
  if_delete_retain(ifp);

  isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

  ifp->ifindex = IFINDEX_INTERNAL;

  return 0;
}
Ejemplo n.º 5
0
/* Search MPLS TE Circuit context from Interface */
static struct mpls_te_circuit *
lookup_mpls_params_by_ifp (struct interface *ifp)
{
  struct isis_circuit *circuit;

  if ((circuit = circuit_scan_by_ifp (ifp)) == NULL)
      return NULL;

  return circuit->mtc;
}
Ejemplo n.º 6
0
static int
isis_zebra_if_state_up (int command, struct zclient *zclient,
			zebra_size_t length, vrf_id_t vrf_id)
{
  struct interface *ifp;

  ifp = zebra_interface_state_read (zclient->ibuf, vrf_id);

  if (ifp == NULL)
    return 0;

  isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

  return 0;
}
Ejemplo n.º 7
0
static int
isis_kroute_if_state_up (int command, struct zclient *zclient,
			kroute_size_t length)
{
  struct interface *ifp;

  ifp = kroute_interface_state_read (zclient->ibuf);

  if (ifp == NULL)
    return 0;

  isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

  return 0;
}
Ejemplo n.º 8
0
int
isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length)
{
    struct interface *ifp;

    ifp = zebra_interface_add_read (zclient->ibuf);


    zlog_debug ("Zebra I/F add: %s index %d flags %ld metric %d mtu %d",
                ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);

    if (if_is_operative (ifp))
        isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

    return 0;
}
Ejemplo n.º 9
0
static int
isis_kroute_if_add (int command, struct zclient *zclient, kroute_size_t length)
{
  struct interface *ifp;

  ifp = kroute_interface_add_read (zclient->ibuf);

  if (isis->debugs & DEBUG_KROUTE)
    zlog_debug ("Kroute I/F add: %s index %d flags %ld metric %d mtu %d",
		ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu);

  if (if_is_operative (ifp))
    isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp);

  return 0;
}
Ejemplo n.º 10
0
int
isis_zebra_if_state_down (int command, struct zclient *zclient,
                          zebra_size_t length)
{
    struct interface *ifp;

    ifp = zebra_interface_if_lookup (zclient->ibuf);

    if (ifp == NULL)
        return 0;

    if (if_is_operative (ifp))
    {
        zebra_interface_if_set_value (zclient->ibuf, ifp);
        isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp);
    }

    return 0;
}
Ejemplo n.º 11
0
static int
isis_zebra_if_state_down (int command, struct zclient *zclient,
			  zebra_size_t length, vrf_id_t vrf_id)
{
  struct interface *ifp;
  struct isis_circuit *circuit;

  ifp = zebra_interface_state_read (zclient->ibuf, vrf_id);

  if (ifp == NULL)
    return 0;

  circuit = isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp),
                                   ifp);
  if (circuit)
    SET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF);

  return 0;
}
Ejemplo n.º 12
0
void
isis_mpls_te_update (struct interface *ifp)
{
  struct isis_circuit *circuit;

  /* Sanity Check */
  if (ifp == NULL)
    return;

  /* Get circuit context from interface */
  if ((circuit = circuit_scan_by_ifp(ifp)) == NULL)
    return;

  /* Update TE TLVs ... */
  isis_link_params_update(circuit, ifp);

  /* ... and LSP */
  if (IS_MPLS_TE(isisMplsTE) && circuit->area)
     lsp_regenerate_schedule (circuit->area, circuit->is_type, 0);

  return;
}
Ejemplo n.º 13
0
static int
isis_zebra_if_address_del (int command, struct zclient *client,
			   zebra_size_t length, vrf_id_t vrf_id)
{
  struct connected *c;
  struct interface *ifp;
#ifdef EXTREME_DEBUG
  struct prefix *p;
  u_char buf[BUFSIZ];
#endif /* EXTREME_DEBUG */

  c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,
				    zclient->ibuf, vrf_id);

  if (c == NULL)
    return 0;

  ifp = c->ifp;

#ifdef EXTREME_DEBUG
  p = c->address;
  prefix2str (p, buf, BUFSIZ);

  if (p->family == AF_INET)
    zlog_debug ("disconnected IP address %s", buf);
#ifdef HAVE_IPV6
  if (p->family == AF_INET6)
    zlog_debug ("disconnected IPv6 address %s", buf);
#endif /* HAVE_IPV6 */
#endif /* EXTREME_DEBUG */

  if (if_is_operative (ifp))
    isis_circuit_del_addr (circuit_scan_by_ifp (ifp), c);
  connected_free (c);

  return 0;
}