]> git.puffer.fish Git - matthieu/frr.git/commitdiff
[zebra] fix some small compile errors, mark several functions static
authorpaul <paul>
Wed, 23 Nov 2005 13:02:08 +0000 (13:02 +0000)
committerpaul <paul>
Wed, 23 Nov 2005 13:02:08 +0000 (13:02 +0000)
2005-11-23 Paul Jakma <paul.jakma@sun.com>

* (general) fix some small compile errors, and mark several
          functions as static.
        * kernel_socket.c: (ifan_read) should be static.
          fix missing brackets.
          (ifm_read,ifam_read,rtm_read_mesg,kernel_read) Make static
          (ifam_read_mesg) make static. fix incorrect variable name.
          (rtm_read) make static. Fix call to rib_delete_ipv4 which
          should be rib_delete_ipv6.
          (routing_socket,kernel_init) should be static. Void argument
          should be specified as such, not left incomplete.
        * rt_netlink.c: rt.h should be included, contains prototypes of
          exported functions.
          (kernel_delete_ipv6_old) fix sign of index argument.
        * rt_socket.c: Exact same as previous. Also, make various
          functions static.
        * rtread_getmsg.c: Include zserv.h, which prototypes
          route_read. Make static.
        * rtread_sysctl.c: zserv.h and rt.h should be included.
          fix definition of route_read.

zebra/ChangeLog
zebra/kernel_socket.c
zebra/rt_netlink.c
zebra/rt_socket.c
zebra/rtread_getmsg.c
zebra/rtread_sysctl.c

index 16f83ae754156ef3e60fea64b498719eb8bd3bee..734dd84b1610b92ba5cd29fbd04c3e594a2a31be 100644 (file)
@@ -1,3 +1,25 @@
+2005-11-23 Paul Jakma <paul.jakma@sun.com>
+
+       * (general) fix some small compile errors, and mark several
+          functions as static.
+        * kernel_socket.c: (ifan_read) should be static.
+          fix missing brackets.
+          (ifm_read,ifam_read,rtm_read_mesg,kernel_read) Make static
+          (ifam_read_mesg) make static. fix incorrect variable name.
+          (rtm_read) make static. Fix call to rib_delete_ipv4 which
+          should be rib_delete_ipv6.
+          (routing_socket,kernel_init) should be static. Void argument
+          should be specified as such, not left incomplete.
+        * rt_netlink.c: rt.h should be included, contains prototypes of  
+          exported functions.
+          (kernel_delete_ipv6_old) fix sign of index argument.   
+        * rt_socket.c: Exact same as previous. Also, make various
+          functions static.
+        * rtread_getmsg.c: Include zserv.h, which prototypes
+          route_read. Make static.
+        * rtread_sysctl.c: zserv.h and rt.h should be included.
+          fix definition of route_read.
+   
 2005-11-14 Paul Jakma <paul.jakma@sun.com>
 
        * zebra_rib.c: (rib_process) convert to new workqueue specs and
index b4643dca2ee3736adf4761f51aa2e8a672123a04..903d67908ad98440e6324274a970dd520ed7fda0 100644 (file)
@@ -240,7 +240,7 @@ rtm_flag_dump (int flag)
 
 #ifdef RTM_IFANNOUNCE
 /* Interface adding function */
-int
+static int
 ifan_read (struct if_announcemsghdr *ifan)
 {
   struct interface *ifp;
@@ -251,8 +251,8 @@ ifan_read (struct if_announcemsghdr *ifan)
     assert ( (ifp->ifindex == ifan->ifan_index) 
              || (ifp->ifindex == IFINDEX_INTERNAL) );
 
-  if ( (ifp == NULL || (ifp->ifindex == IFINDEX_INTERNAL)
-      && ifan->ifan_what == IFAN_ARRIVAL)
+  if ( (ifp == NULL) || (ifp->ifindex == IFINDEX_INTERNAL)
+      && (ifan->ifan_what == IFAN_ARRIVAL) )
     {
       if (IS_ZEBRA_DEBUG_KERNEL)
         zlog_debug ("%s: creating interface for ifindex %d, name %s",
@@ -286,7 +286,7 @@ ifan_read (struct if_announcemsghdr *ifan)
  * sysctl (from interface_list).  There may or may not be sockaddrs
  * present after the header.
  */
-int
+static int
 ifm_read (struct if_msghdr *ifm)
 {
   struct interface *ifp = NULL;
@@ -471,7 +471,7 @@ ifm_read (struct if_msghdr *ifm)
 }
 \f
 /* Address read from struct ifa_msghdr. */
-void
+static void
 ifam_read_mesg (struct ifa_msghdr *ifm,
                union sockunion *addr,
                union sockunion *mask,
@@ -487,7 +487,7 @@ ifam_read_mesg (struct ifa_msghdr *ifm,
   /* Be sure structure is cleared */
   memset (mask, 0, sizeof (union sockunion));
   memset (addr, 0, sizeof (union sockunion));
-  memset (dest, 0, sizeof (union sockunion));
+  memset (brd, 0, sizeof (union sockunion));
 
   /* We fetch each socket variable into sockunion. */
   RTA_ADDR_GET (NULL, RTA_DST, ifm->ifam_addrs, pnt);
@@ -510,7 +510,7 @@ ifam_read_mesg (struct ifa_msghdr *ifm,
 }
 
 /* Interface's address information get. */
-int
+static int
 ifam_read (struct ifa_msghdr *ifam)
 {
   struct interface *ifp = NULL;
@@ -577,7 +577,7 @@ ifam_read (struct ifa_msghdr *ifam)
 }
 \f
 /* Interface function for reading kernel routing table information. */
-int
+static int
 rtm_read_mesg (struct rt_msghdr *rtm,
               union sockunion *dest,
               union sockunion *mask,
@@ -624,7 +624,7 @@ rtm_read_mesg (struct rt_msghdr *rtm,
   return rtm->rtm_flags;
 }
 
-void
+static void
 rtm_read (struct rt_msghdr *rtm)
 {
   int flags;
@@ -725,7 +725,7 @@ rtm_read (struct rt_msghdr *rtm)
        * to specify the route really
        */
       if (rtm->rtm_type == RTM_CHANGE)
-        rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, zebra_flags, &p,
+        rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, zebra_flags, &p,
                          NULL, 0, 0);
       
       if (rtm->rtm_type == RTM_GET 
@@ -741,7 +741,9 @@ rtm_read (struct rt_msghdr *rtm)
 }
 
 /* Interface function for the kernel routing table updates.  Support
-   for RTM_CHANGE will be needed. */
+ * for RTM_CHANGE will be needed.
+ * Exported only for rt_socket.c
+ */
 int
 rtm_write (int message,
           union sockunion *dest,
@@ -914,7 +916,7 @@ rtmsg_debug (struct rt_msghdr *rtm)
 #endif /* RTAX_MAX */
 
 /* Kernel routing table and interface updates via routing socket. */
-int
+static int
 kernel_read (struct thread *thread)
 {
   int sock;
@@ -1022,8 +1024,8 @@ kernel_read (struct thread *thread)
 }
 
 /* Make routing socket. */
-void
-routing_socket ()
+static void
+routing_socket (void)
 {
   if ( zserv_privs.change (ZPRIVS_RAISE) )
     zlog_err ("routing_socket: Can't raise privileges");
@@ -1055,7 +1057,7 @@ routing_socket ()
 /* Exported interface function.  This function simply calls
    routing_socket (). */
 void
-kernel_init ()
+kernel_init (void)
 {
   routing_socket ();
 }
index 6db8496de6ae29f318c16527de72964d3ec3258c..6e91408754f1e59f1140b42c27ba8a5ad7c95216 100644 (file)
@@ -37,6 +37,7 @@
 #include "privs.h"
 
 #include "zebra/zserv.h"
+#include "zebra/rt.h"
 #include "zebra/redistribute.h"
 #include "zebra/interface.h"
 #include "zebra/debug.h"
@@ -1087,7 +1088,7 @@ netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h)
 
 /* Interface lookup by netlink socket. */
 int
-interface_lookup_netlink ()
+interface_lookup_netlink (void)
 {
   int ret;
   int flags;
@@ -1138,7 +1139,7 @@ interface_lookup_netlink ()
 /* Routing table read function using netlink interface.  Only called
    bootstrap time. */
 int
-netlink_route_read ()
+netlink_route_read (void)
 {
   int ret;
   int flags;
@@ -1795,7 +1796,7 @@ kernel_delete_ipv6 (struct prefix *p, struct rib *rib)
 /* Delete IPv6 route from the kernel. */
 int
 kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
-                        int index, int flags, int table)
+                        unsigned int index, int flags, int table)
 {
   return netlink_route (RTM_DELROUTE, AF_INET6, &dest->prefix,
                         dest->prefixlen, gate, index, flags, table);
@@ -1884,7 +1885,7 @@ kernel_read (struct thread *thread)
 /* Exported interface function.  This function simply calls
    netlink_socket (). */
 void
-kernel_init ()
+kernel_init (void)
 {
   unsigned long groups;
 
index fa2f172c3bacbcfa7753e0b49a6a7968f60c5869..67d29538b00a3f5d052cdc2b9b38647d81342b28 100644 (file)
 
 #include "zebra/debug.h"
 #include "zebra/rib.h"
+#include "zebra/rt.h"
 
 extern struct zebra_privs_t zserv_privs;
 
-int
-rtm_write (int message,
-          union sockunion *dest,
-          union sockunion *mask,
-          union sockunion *gate,
-          unsigned int index,
-          int zebra_flags,
-          int metric);
+/* kernel socket export */
+extern int rtm_write (int message, union sockunion *dest,
+                      union sockunion *mask, union sockunion *gate,
+                      unsigned int index, int zebra_flags, int metric);
 
 /* Adjust netmask socket length. Return value is a adjusted sin_len
    value. */
-int
+static int
 sin_masklen (struct in_addr mask)
 {
   char *p, *lim;
@@ -67,7 +64,7 @@ sin_masklen (struct in_addr mask)
 }
 
 /* Interface between zebra message and rtm message. */
-int
+static int
 kernel_rtm_ipv4 (int cmd, struct prefix *p, struct rib *rib, int family)
 
 {
@@ -218,7 +215,7 @@ kernel_delete_ipv4 (struct prefix *p, struct rib *rib)
 #ifdef HAVE_IPV6
 
 /* Calculate sin6_len value for netmask socket value. */
-int
+static int
 sin6_masklen (struct in6_addr mask)
 {
   struct sockaddr_in6 sin6;
@@ -246,7 +243,7 @@ sin6_masklen (struct in6_addr mask)
 }
 
 /* Interface between zebra message and rtm message. */
-int
+static int
 kernel_rtm_ipv6 (int message, struct prefix_ipv6 *dest,
                 struct in6_addr *gate, int index, int flags)
 {
@@ -307,7 +304,7 @@ kernel_rtm_ipv6 (int message, struct prefix_ipv6 *dest,
 }
 
 /* Interface between zebra message and rtm message. */
-int
+static int
 kernel_rtm_ipv6_multipath (int cmd, struct prefix *p, struct rib *rib,
                           int family)
 {
@@ -468,7 +465,7 @@ kernel_delete_ipv6 (struct prefix *p, struct rib *rib)
 /* Delete IPv6 route from the kernel. */
 int
 kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
-                   int index, int flags, int table)
+                       unsigned int index, int flags, int table)
 {
   int route;
 
index ff6d7bc029d36cf5971ce99d3c9a37d42c9f0a34..1b0c8965f919135be1d582672f7cda0d16d58afc 100644 (file)
@@ -27,6 +27,7 @@
 #include "if.h"
 
 #include "zebra/rib.h"
+#include "zebra/zserv.h"
 
 #include <sys/stream.h>
 #include <sys/tihdr.h>
@@ -65,7 +66,8 @@
 
 #define RT_BUFSIZ              8192
 
-void handle_route_entry (mib2_ipRouteEntry_t *routeEntry)
+static void 
+handle_route_entry (mib2_ipRouteEntry_t *routeEntry)
 {
        struct prefix_ipv4      prefix;
        struct in_addr          tmpaddr, gateway;
@@ -91,7 +93,8 @@ void handle_route_entry (mib2_ipRouteEntry_t *routeEntry)
                      &gateway, 0, 0, 0, 0);
 }
 
-void route_read ()
+void
+route_read (void)
 {
        char                    storage[RT_BUFSIZ];
 
index 78864f2b4c2f63dcda26f4beeb9b38e8641ad1e4..e39d8cb153447e3a9b30eb5d3cb4756b71d351b2 100644 (file)
 #include "memory.h"
 #include "log.h"
 
+#include "zebra/zserv.h"
+#include "zebra/rt.h"
+
 /* Kernel routing table read up by sysctl function. */
-int
-route_read ()
+void
+route_read (void)
 {
   caddr_t buf, end, ref;
   size_t bufsiz;