]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zserv.c
[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
[mirror_frr.git] / zebra / zserv.c
index f8bfcfaa0e46ff0256c2a1b137c498c42ac0aef8..ef79eaad3da06f9dbfbf3b4dd17b951e5d2384aa 100644 (file)
@@ -52,34 +52,6 @@ static void zebra_event (enum event event, int sock, struct zserv *client);
 
 extern struct zebra_privs_t zserv_privs;
 \f
-/* For logging of zebra meesages. */
-static const char *zebra_command_str [] =
-{
-  "NULL",
-  "ZEBRA_INTERFACE_ADD",
-  "ZEBRA_INTERFACE_DELETE",
-  "ZEBRA_INTERFACE_ADDRESS_ADD",
-  "ZEBRA_INTERFACE_ADDRESS_DELETE",
-  "ZEBRA_INTERFACE_UP",
-  "ZEBRA_INTERFACE_DOWN",
-  "ZEBRA_IPV4_ROUTE_ADD",
-  "ZEBRA_IPV4_ROUTE_DELETE",
-  "ZEBRA_IPV6_ROUTE_ADD",
-  "ZEBRA_IPV6_ROUTE_DELETE",
-  "ZEBRA_REDISTRIBUTE_ADD",
-  "ZEBRA_REDISTRIBUTE_DELETE",
-  "ZEBRA_REDISTRIBUTE_DEFAULT_ADD",
-  "ZEBRA_REDISTRIBUTE_DEFAULT_DELETE",
-  "ZEBRA_IPV4_NEXTHOP_LOOKUP",
-  "ZEBRA_IPV6_NEXTHOP_LOOKUP",
-  "ZEBRA_IPV4_IMPORT_LOOKUP",
-  "ZEBRA_IPV6_IMPORT_LOOKUP",
-  "ZEBRA_ROUTER_ID_ADD",
-  "ZEBRA_ROUTER_ID_DELETE",
-  "ZEBRA_ROUTER_ID_UPDATE"
-};
-\f
-
 static void zebra_client_close (struct zserv *client);
 
 static int
@@ -138,7 +110,6 @@ zebra_server_send_message(struct zserv *client)
       client->t_suicide = thread_add_event(zebrad.master, zserv_delayed_close,
                                           client, 0);
       return -1;
-      break;
     case BUFFER_EMPTY:
       THREAD_OFF(client->t_write);
       break;
@@ -195,13 +166,13 @@ zsend_interface_add (struct zserv *client, struct interface *ifp)
   stream_putl (s, ifp->mtu);
   stream_putl (s, ifp->mtu6);
   stream_putl (s, ifp->bandwidth);
-#ifdef HAVE_SOCKADDR_DL
+#ifdef HAVE_STRUCT_SOCKADDR_DL
   stream_put (s, &ifp->sdl, sizeof (ifp->sdl));
 #else
   stream_putl (s, ifp->hw_addr_len);
   if (ifp->hw_addr_len)
     stream_put (s, ifp->hw_addr, ifp->hw_addr_len);
-#endif /* HAVE_SOCKADDR_DL */
+#endif /* HAVE_STRUCT_SOCKADDR_DL */
 
   /* Write packet size. */
   stream_putw_at (s, 0, stream_get_endp (s));
@@ -810,7 +781,7 @@ zread_ipv4_add (struct zserv *client, u_short length)
              break;
            case ZEBRA_NEXTHOP_IPV4:
              nexthop.s_addr = stream_get_ipv4 (s);
-             nexthop_ipv4_add (rib, &nexthop);
+             nexthop_ipv4_add (rib, &nexthop, NULL);
              break;
            case ZEBRA_NEXTHOP_IPV6:
              stream_forward_getp (s, IPV6_MAX_BYTELEN);
@@ -830,6 +801,8 @@ zread_ipv4_add (struct zserv *client, u_short length)
   if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
     rib->metric = stream_getl (s);
     
+  /* Table */
+  rib->table=zebrad.rtm_table_default;
   rib_add_ipv4_multipath (&p, rib);
   return 0;
 }
@@ -1257,7 +1230,7 @@ zebra_client_read (struct thread *thread)
 
   if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV)
     zlog_debug ("zebra message received [%s] %d", 
-              zebra_command_str[command], length);
+              zserv_command_string (command), length);
 
   switch (command) 
     {
@@ -1382,9 +1355,9 @@ zebra_serv ()
   memset (&addr, 0, sizeof (struct sockaddr_in));
   addr.sin_family = AF_INET;
   addr.sin_port = htons (ZEBRA_PORT);
-#ifdef HAVE_SIN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
   addr.sin_len = sizeof (struct sockaddr_in);
-#endif /* HAVE_SIN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
   addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 
   sockopt_reuseaddr (accept_sock);
@@ -1453,11 +1426,11 @@ zebra_serv_un (const char *path)
   memset (&serv, 0, sizeof (struct sockaddr_un));
   serv.sun_family = AF_UNIX;
   strncpy (serv.sun_path, path, strlen (path));
-#ifdef HAVE_SUN_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = serv.sun_len = SUN_LEN(&serv);
 #else
   len = sizeof (serv.sun_family) + strlen (serv.sun_path);
-#endif /* HAVE_SUN_LEN */
+#endif /* HAVE_STRUCT_SOCKADDR_UN_SUN_LEN */
 
   ret = bind (sock, (struct sockaddr *) &serv, len);
   if (ret < 0)
@@ -1760,4 +1733,7 @@ zebra_init (void)
   install_element (CONFIG_NODE, &ipv6_forwarding_cmd);
   install_element (CONFIG_NODE, &no_ipv6_forwarding_cmd);
 #endif /* HAVE_IPV6 */
+
+  /* Route-map */
+  zebra_route_map_init ();
 }