static int babel_if_new_hook (struct interface *ifp);
static int babel_if_delete_hook (struct interface *ifp);
static int interface_config_write (struct vty *vty);
-static babel_interface_nfo * babel_interface_allocate ();
+static babel_interface_nfo * babel_interface_allocate (void);
static void babel_interface_free (babel_interface_nfo *bi);
/* functions to allocate or free memory for a babel_interface_nfo, filling
needed fields */
static babel_interface_nfo *
-babel_interface_allocate ()
+babel_interface_allocate (void)
{
babel_interface_nfo *babel_ifp;
babel_ifp = XMALLOC(MTYPE_BABEL_IF, sizeof(babel_interface_nfo));
delay = timeval_minus_msec(&babel_now, &neigh->ihu_time);
- if(neigh->ihu_interval > 0 && delay < neigh->ihu_interval * 10 * 3)
+ if(neigh->ihu_interval > 0 && delay < neigh->ihu_interval * 10U * 3U)
return 0;
/* If we're losing a lot of packets, we probably lost an IHU too */
if(delay >= 180000 || (neigh->reach & 0xFFF0) == 0 ||
(neigh->ihu_interval > 0 &&
- delay >= neigh->ihu_interval * 10 * 10)) {
+ delay >= neigh->ihu_interval * 10U * 10U)) {
neigh->txcost = INFINITY;
neigh->ihu_time = babel_now;
return 1;
update_neighbour_metric(neigh, changed);
if(neigh->hello_interval > 0)
- msecs = MIN(msecs, neigh->hello_interval * 10);
+ msecs = MIN(msecs, neigh->hello_interval * 10U);
if(neigh->ihu_interval > 0)
- msecs = MIN(msecs, neigh->ihu_interval * 10);
+ msecs = MIN(msecs, neigh->ihu_interval * 10U);
neigh = neigh->next;
}
short installed;
};
-static inline int
+static inline unsigned short
route_metric(const struct babel_route *route)
{
return route->metric;
#include "log.h"
#if defined(i386) || defined(__mc68020__) || defined(__x86_64__)
-#define DO_NTOHS(_d, _s) do { _d = ntohs(*(unsigned short*)(_s)); } while(0)
-#define DO_NTOHL(_d, _s) do { _d = ntohl(*(unsigned*)(_s)); } while(0)
-#define DO_HTONS(_d, _s) do { *(unsigned short*)(_d) = htons(_s); } while(0)
-#define DO_HTONL(_d, _s) do { *(unsigned*)(_d) = htonl(_s); } while(0)
+#define DO_NTOHS(_d, _s) do{ _d = ntohs(*(const unsigned short*)(_s)); }while(0)
+#define DO_NTOHL(_d, _s) do{ _d = ntohl(*(const unsigned*)(_s)); } while(0)
+#define DO_HTONS(_d, _s) do{ *(unsigned short*)(_d) = htons(_s); } while(0)
+#define DO_HTONL(_d, _s) do{ *(unsigned*)(_d) = htonl(_s); } while(0)
/* Some versions of gcc seem to be buggy, and ignore the packed attribute.
Disable this code until the issue is clarified. */
/* #elif defined __GNUC__*/