Exemplo n.º 1
0
Arquivo: zserv.c Projeto: OPSF/uClinux
/* Register zebra server interface information.  Send current all
   interface and address information. */
static void
zread_interface_add (struct zserv *client, u_short length)
{
  struct listnode *ifnode;
  struct listnode *cnode;
  struct interface *ifp;
  struct connected *c;

  /* Interface information is needed. */
  client->ifinfo = 1;

  for (ifnode = listhead (iflist); ifnode; ifnode = nextnode (ifnode))
    {
      ifp = getdata (ifnode);

      /* Skip pseudo interface. */
      if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
	continue;

      zsend_interface_add (client, ifp);

      for (cnode = listhead (ifp->connected); cnode; nextnode (cnode))
	{
	  c = getdata (cnode);
	  if (CHECK_FLAG (c->conf, ZEBRA_IFC_REAL))
	    zsend_interface_address (ZEBRA_INTERFACE_ADDRESS_ADD, client, 
				     ifp, c);
	}
    }
}
Exemplo n.º 2
0
/* Register zebra server interface information.  Send current all
   interface and address information. */
static int
zread_interface_add (struct zserv *client, u_short length)
{
  struct listnode *ifnode, *ifnnode;
  struct listnode *cnode, *cnnode;
  struct interface *ifp;
  struct connected *c;

  /* Interface information is needed. */
  client->ifinfo = 1;

  for (ALL_LIST_ELEMENTS (iflist, ifnode, ifnnode, ifp))
    {
      /* Skip pseudo interface. */
      if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
	continue;

      if (zsend_interface_add (client, ifp) < 0)
        return -1;

      for (ALL_LIST_ELEMENTS (ifp->connected, cnode, cnnode, c))
	{
	  if (CHECK_FLAG (c->conf, ZEBRA_IFC_REAL) &&
	      (zsend_interface_address (ZEBRA_INTERFACE_ADDRESS_ADD, client, 
				        ifp, c) < 0))
	    return -1;
	}
    }
  return 0;
}