diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index f4a83d720b..168dbd0122 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -700,16 +700,16 @@ bgp_show_dampening_parameters (struct vty *vty, afi_t afi, safi_t safi) if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) { - vty_out (vty, "Half-life time: %ld min%s", - damp->half_life / 60, VTY_NEWLINE); + vty_out (vty, "Half-life time: %lld min%s", + (long long)damp->half_life / 60, VTY_NEWLINE); vty_out (vty, "Reuse penalty: %d%s", - damp->reuse_limit, VTY_NEWLINE); + damp->reuse_limit, VTY_NEWLINE); vty_out (vty, "Suppress penalty: %d%s", - damp->suppress_value, VTY_NEWLINE); - vty_out (vty, "Max suppress time: %ld min%s", - damp->max_suppress_time / 60, VTY_NEWLINE); + damp->suppress_value, VTY_NEWLINE); + vty_out (vty, "Max suppress time: %lld min%s", + (long long)damp->max_suppress_time / 60, VTY_NEWLINE); vty_out (vty, "Max supress penalty: %u%s", - damp->ceiling, VTY_NEWLINE); + damp->ceiling, VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE); } else diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fd6718e2ac..2e001b3a9d 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -7431,7 +7431,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js /* BGP Version. */ json_object_int_add(json_neigh, "bgpVersion", 4); - json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); + json_object_string_add(json_neigh, "remoteRouterId", + inet_ntop (AF_INET, &p->remote_id, buf1, sizeof(buf1))); /* Confederation */ if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) @@ -7498,7 +7499,8 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js /* BGP Version. */ vty_out (vty, " BGP version 4"); - vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), + vty_out (vty, ", remote router ID %s%s", + inet_ntop (AF_INET, &p->remote_id, buf1, sizeof(buf1)), VTY_NEWLINE); /* Confederation */ @@ -8300,9 +8302,12 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js { if (use_json) { - json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); - json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); - json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); + json_object_string_add(json_neigh, "nexthop", + inet_ntop (AF_INET, &p->nexthop.v4, buf1, sizeof(buf1))); + json_object_string_add(json_neigh, "nexthopGlobal", + inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, sizeof(buf1))); + json_object_string_add(json_neigh, "nexthopLocal", + inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, sizeof(buf1))); if (p->shared_network) json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); else @@ -8311,17 +8316,17 @@ bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *js else { vty_out (vty, "Nexthop: %s%s", - inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), - VTY_NEWLINE); + inet_ntop (AF_INET, &p->nexthop.v4, buf1, sizeof(buf1)), + VTY_NEWLINE); vty_out (vty, "Nexthop global: %s%s", - inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), - VTY_NEWLINE); + inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, sizeof(buf1)), + VTY_NEWLINE); vty_out (vty, "Nexthop local: %s%s", - inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), - VTY_NEWLINE); + inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, sizeof(buf1)), + VTY_NEWLINE); vty_out (vty, "BGP connection: %s%s", - p->shared_network ? "shared network" : "non shared network", - VTY_NEWLINE); + p->shared_network ? "shared network" : "non shared network", + VTY_NEWLINE); } } diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 26325b5816..e6fdb7180e 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -113,7 +113,7 @@ rfapiDebugBacktrace (void) for (i = 0; i < size && i < RFAPI_DEBUG_BACKTRACE_NENTRIES; ++i) { - vnc_zlog_debug_verbose ("backtrace[%2lu]: %s", i, syms[i]); + vnc_zlog_debug_verbose ("backtrace[%2zu]: %s", i, syms[i]); } free (syms); diff --git a/cumulus/start-stop-daemon.c b/cumulus/start-stop-daemon.c index 4d447d9051..a195e9e2fc 100644 --- a/cumulus/start-stop-daemon.c +++ b/cumulus/start-stop-daemon.c @@ -223,6 +223,7 @@ clear(struct pid_list **list) *list = NULL; } +#ifdef linux static const char * next_dirname(const char *s) { @@ -242,7 +243,6 @@ next_dirname(const char *s) return cur; } -#ifdef linux static void add_namespace(const char *path) { diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c index 8775e12a24..3a5eaf5585 100644 --- a/isisd/isis_bpf.c +++ b/isisd/isis_bpf.c @@ -78,7 +78,10 @@ open_bpf_dev (struct isis_circuit *circuit) int i = 0, fd; char bpfdev[128]; struct ifreq ifr; - u_int blen, immediate, seesent; + u_int blen, immediate; +#ifdef BIOCSSEESENT + u_int seesent; +#endif struct timeval timeout; struct bpf_program bpf_prog; diff --git a/lib/wheel.h b/lib/wheel.h index ddb79988b4..79d21e124b 100644 --- a/lib/wheel.h +++ b/lib/wheel.h @@ -40,9 +40,49 @@ struct timer_wheel void (*slot_run) (void *); }; +/* + * Creates a timer wheel + * + * master - Thread master structure for the process + * period - The Time in seconds that the timer wheel will + * take before it starts issuing commands again + * for items in each slot + * slots - The number of slots to have in this particular + * timer wheel + * slot_key - A hashing function of some sort that will allow + * the timer wheel to put items into individual slots + * slot_run - The function to run over each item in a particular slot + * + * Creates a timer wheel that will wake up 'slots' times over the entire + * wheel. Each time the timer wheel wakes up it will iterate through + * and run the slot_run function for each item stored in that particular + * slot. + * + * The timer code is 'intelligent' in that it notices if anything is + * in a particular slot and can schedule the next timer to skip + * the empty slot. + * + * The general purpose of a timer wheel is to reduce events in a system. + * A perfect example of usage for this is say hello packets that need + * to be sent out to all your neighbors. Suppose a large routing protocol + * has to send keepalive packets every Y seconds to each of it's peers. + * At scale we can have a very large number of peers, X. + * This means that we will have X timing events every Y seconds. + * If you replace these events with a timer wheel that has Z slots + * you will have at most Y/Z timer events if each slot has a work item + * in it. + * + * When X is large the number of events in a system can quickly escalate + * and cause significant amount of time handling thread events instead + * of running your code. + */ struct timer_wheel *wheel_init (struct thread_master *master, int period, size_t slots, unsigned int (*slot_key) (void *), void (*slot_run) (void *)); + +/* + * Delete the specified timer wheel created + */ void wheel_delete (struct timer_wheel *); /* @@ -51,17 +91,25 @@ void wheel_delete (struct timer_wheel *); int wheel_stop (struct timer_wheel *wheel); /* - * Start the wheel from running again + * Start the wheel running again */ int wheel_start (struct timer_wheel *wheel); /* + * wheel - The Timer wheel being modified + * item - The generic data structure that will be handed + * to the slot_run function. + * * Add item to a slot setup by the slot_key, * possibly change next time pop. */ int wheel_add_item (struct timer_wheel *wheel, void *item); /* + * wheel - The Timer wheel being modified. + * item - The item to remove from one of the slots in + * the timer wheel. + * * Remove a item to a slot setup by the slot_key, * possibly change next time pop. */ diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 36b0a6c795..a4498a84f6 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -105,7 +105,7 @@ interface_list_ioctl (void) #ifdef OPEN_BSD for (n = 0; n < ifconf.ifc_len; ) { - int size; + unsigned int size; ifreq = (struct ifreq *)((caddr_t) ifconf.ifc_req + n); ifp = if_get_by_name_len(ifreq->ifr_name, diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 6d81c9d052..fd059dfee7 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -927,7 +927,7 @@ rtm_read (struct rt_msghdr *rtm) int ret; if (! IS_ZEBRA_DEBUG_RIB) return; - ret = rib_lookup_ipv4_route (&p, &gate, VRF_DEFAULT); + ret = rib_lookup_ipv4_route ((struct prefix_ipv4 *)&p, &gate, VRF_DEFAULT); prefix2str (&p, buf, sizeof(buf)); switch (rtm->rtm_type) { @@ -951,7 +951,7 @@ rtm_read (struct rt_msghdr *rtm) case ZEBRA_RIB_FOUND_EXACT: /* RIB RR == FIB RR */ zlog_debug ("%s: %s %s: done Ok", __func__, lookup (rtm_type_str, rtm->rtm_type), buf); - rib_lookup_and_dump (&p, VRF_DEFAULT); + rib_lookup_and_dump ((struct prefix_ipv4 *)&p, VRF_DEFAULT); return; break; } @@ -964,18 +964,18 @@ rtm_read (struct rt_msghdr *rtm) case ZEBRA_RIB_FOUND_EXACT: zlog_debug ("%s: %s %s: desync: RR is still in RIB, while already not in FIB", __func__, lookup (rtm_type_str, rtm->rtm_type), buf); - rib_lookup_and_dump (&p, VRF_DEFAULT); + rib_lookup_and_dump ((struct prefix_ipv4 *)&p, VRF_DEFAULT); break; case ZEBRA_RIB_FOUND_CONNECTED: case ZEBRA_RIB_FOUND_NOGATE: zlog_debug ("%s: %s %s: desync: RR is still in RIB, plus gate differs", __func__, lookup (rtm_type_str, rtm->rtm_type), buf); - rib_lookup_and_dump (&p, VRF_DEFAULT); + rib_lookup_and_dump ((struct prefix_ipv4 *)&p, VRF_DEFAULT); break; case ZEBRA_RIB_NOTFOUND: /* RIB RR == FIB RR */ zlog_debug ("%s: %s %s: done Ok", __func__, lookup (rtm_type_str, rtm->rtm_type), buf); - rib_lookup_and_dump (&p, VRF_DEFAULT); + rib_lookup_and_dump ((struct prefix_ipv4 *)&p, VRF_DEFAULT); return; break; } diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 8b337152b4..d91cda9fb0 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -883,7 +883,9 @@ zfpm_encode_route (rib_dest_t *dest, struct rib *rib, char *in_buf, size_t in_buf_len, fpm_msg_type_e *msg_type) { size_t len; +#ifdef HAVE_NETLINK int cmd; +#endif len = 0; *msg_type = FPM_MSG_TYPE_NONE; diff --git a/zebra/zserv.c b/zebra/zserv.c index 6a15b9a251..f53b2270f1 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2386,7 +2386,7 @@ zebra_find_client (u_char proto) return NULL; } - +#ifdef HAVE_NETLINK /* Display default rtm_table for all clients. */ DEFUN (show_table, show_table_cmd, @@ -2419,6 +2419,7 @@ DEFUN (no_config_table, zebrad.rtm_table_default = 0; return CMD_SUCCESS; } +#endif DEFUN (ip_forwarding, ip_forwarding_cmd,