Ejemplo n.º 1
0
struct interface *
if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id)
{
  struct interface *ifp;

  return ((ifp = if_lookup_by_name_len_vrf (name, namelen, vrf_id)) != NULL) ? \
         ifp : if_create_vrf (name, namelen, vrf_id);
}
Ejemplo n.º 2
0
/* 
 * Read interface up/down msg (ZEBRA_INTERFACE_UP/ZEBRA_INTERFACE_DOWN)
 * from zebra server.  The format of this message is the same as
 * that sent for ZEBRA_INTERFACE_ADD/ZEBRA_INTERFACE_DELETE (see
 * comments for zebra_interface_add_read), except that no sockaddr_dl
 * is sent at the tail of the message.
 */
struct interface *
zebra_interface_state_read (struct stream *s, vrf_id_t vrf_id)
{
  struct interface *ifp;
  char ifname_tmp[INTERFACE_NAMSIZ];

  /* Read interface name. */
  stream_get (ifname_tmp, s, INTERFACE_NAMSIZ);

  /* Lookup this by interface index. */
  ifp = if_lookup_by_name_len_vrf (ifname_tmp,
                                   strnlen (ifname_tmp, INTERFACE_NAMSIZ),
                                   vrf_id);

  /* If such interface does not exist, indicate an error */
  if (! ifp)
     return NULL;

  zebra_interface_if_set_value (s, ifp);

  return ifp;
}
Ejemplo n.º 3
0
struct interface *
if_lookup_by_name_len(const char *name, size_t namelen)
{
  return if_lookup_by_name_len_vrf (name, namelen, VRF_DEFAULT);
}