From 88177fe3eddaf0bad82e85b87556ace1eefbe361 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 25 Jul 2015 15:55:47 -0700 Subject: [PATCH] Fixup of warnings in the code Ticket: None Reviewed by: Trivial Testing: A bunch of warnings have crept in to the code base. This fixes the issue --- bgpd/bgp_community.c | 2 +- bgpd/bgp_nexthop.c | 1 - bgpd/bgp_updgrp.h | 2 ++ bgpd/bgp_updgrp_packet.c | 6 +++--- bgpd/bgp_vty.c | 35 ---------------------------------- bgpd/bgp_zebra.c | 5 +++-- bgpd/bgpd.c | 7 +++---- bgpd/bgpd.h | 4 ++-- lib/bfd.h | 2 +- lib/ptm_lib.c | 2 +- lib/ptm_lib.h | 2 +- ospf6d/ospf6_interface.c | 1 + ospf6d/ospf6_interface.h | 2 +- ospfd/ospf_vty.c | 12 ------------ vtysh/vtysh.c | 1 - vtysh/vtysh_config.c | 1 + vtysh/vtysh_user.c | 2 +- vtysh/vtysh_user.h | 1 + watchquagga/watchquagga.c | 8 +++++--- zebra/interface.c | 11 ++++++----- zebra/kernel_null.c | 1 + zebra/zebra_ptm_null.c | 2 ++ zebra/zebra_ptm_redistribute.c | 5 +++-- zebra/zebra_rib.c | 5 +++-- zebra/zserv.c | 3 ++- 25 files changed, 44 insertions(+), 79 deletions(-) diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index bdef5fbde6..0e42b7d2b1 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -217,7 +217,7 @@ set_community_string (struct community *com) json_object *json_string = NULL; if (!com) - return NULL; + return; com->json = json_object_new_object(); json_community_list = json_object_new_array(); diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 658a4b1fd5..7580f0eb07 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -208,7 +208,6 @@ bgp_connected_add (struct connected *ifc) struct listnode *node, *nnode, *mnode; struct bgp *bgp; struct peer *peer; - u_int32_t saddr; addr = ifc->address; diff --git a/bgpd/bgp_updgrp.h b/bgpd/bgp_updgrp.h index b4e1078b00..ae72214631 100644 --- a/bgpd/bgp_updgrp.h +++ b/bgpd/bgp_updgrp.h @@ -474,6 +474,8 @@ subgroup_trigger_write (struct update_subgroup *subgrp); extern int update_group_clear_update_dbg (struct update_group *updgrp, void *arg); +extern void update_bgp_group_free(struct bgp *bgp); + /* * Inline functions */ diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 9aa7a4301f..979a823f17 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -474,7 +474,7 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) stream_put_in_addr_at (s, vec->offset + 1, mod_v4nh); if (bgp_debug_update(peer, NULL, NULL, 0)) - zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s", + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ nexthop %s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, inet_ntoa (*mod_v4nh)); @@ -542,14 +542,14 @@ bpacket_reformat_for_peer (struct bpacket *pkt, struct peer_af *paf) if (bgp_debug_update(peer, NULL, NULL, 0)) { if (nhlen == 32) - zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s", + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthops %s, %s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, inet_ntop (AF_INET6, mod_v6nhg, buf, BUFSIZ), inet_ntop (AF_INET6, mod_v6nhl, buf2, BUFSIZ)); else - zlog_debug ("u" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s", + zlog_debug ("u%" PRIu64 ":s%" PRIu64 " %s send UPDATE w/ mp_nexthop %s", PAF_SUBGRP(paf)->update_group->id, PAF_SUBGRP(paf)->id, peer->host, diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 625473b254..5f12876b65 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -56,41 +56,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA extern struct in_addr router_id_zebra; -/* Intentional re-definition of the auto-generated macros, without table */ -#define QUAGGA_REDIST_STR_BGPD \ - "(kernel|connected|static|rip|ripng|ospf|ospf6|isis|babel)" -#define QUAGGA_REDIST_HELP_STR_BGPD \ - "Kernel routes (not installed via the zebra RIB)\n" \ - "Connected routes (directly attached subnet or host)\n" \ - "Statically configured routes\n" \ - "Routing Information Protocol (RIP)\n" \ - "Routing Information Protocol next-generation (IPv6) (RIPng)\n" \ - "Open Shortest Path First (OSPFv2)\n" \ - "Open Shortest Path First (IPv6) (OSPFv3)\n" \ - "Intermediate System to Intermediate System (IS-IS)\n" \ - "Babel routing protocol (Babel)\n" -#define QUAGGA_IP_REDIST_STR_BGPD \ - "(kernel|connected|static|rip|ospf|isis|babel)" -#define QUAGGA_IP_REDIST_HELP_STR_BGPD \ - "Kernel routes (not installed via the zebra RIB)\n" \ - "Connected routes (directly attached subnet or host)\n" \ - "Statically configured routes\n" \ - "Routing Information Protocol (RIP)\n" \ - "Open Shortest Path First (OSPFv2)\n" \ - "Intermediate System to Intermediate System (IS-IS)\n" \ - "Babel routing protocol (Babel)\n" -#define QUAGGA_IP6_REDIST_STR_BGPD \ - "(kernel|connected|static|ripng|ospf6|isis|babel)" -#define QUAGGA_IP6_REDIST_HELP_STR_BGPD \ - "Kernel routes (not installed via the zebra RIB)\n" \ - "Connected routes (directly attached subnet or host)\n" \ - "Statically configured routes\n" \ - "Routing Information Protocol next-generation (IPv6) (RIPng)\n" \ - "Open Shortest Path First (IPv6) (OSPFv3)\n" \ - "Intermediate System to Intermediate System (IS-IS)\n" \ - "Babel routing protocol (Babel)\n" - - /* Utility function to get address family from current node. */ afi_t bgp_node_afi (struct vty *vty) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 23de75ae73..8a9beb8f0f 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1335,10 +1335,11 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, if (valid_nh_count) zapi_ipv4_route_ipv6_nexthop (ZEBRA_IPV4_ROUTE_IPV6_NEXTHOP_ADD, - zclient, (struct prefix_ipv4 *) p, &api); + zclient, (struct prefix_ipv4 *) p, + (struct zapi_ipv6 *)&api); else zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, - zclient, (struct prefix_ipv4 *) p, &api); + zclient, (struct prefix_ipv4 *) p, (struct zapi_ipv4 *)&api); } else { diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 53756cb891..16bfb50407 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -36,6 +36,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "linklist.h" #include "workqueue.h" #include "queue.h" +#include "zclient.h" #include "bfd.h" #include "bgpd/bgpd.h" @@ -67,7 +68,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_bfd.h" - /* BGP process wide configuration. */ static struct bgp_master bgp_master; @@ -1180,7 +1180,7 @@ bgp_peer_conf_if_to_su_update (struct peer *peer) if (!peer->conf_if) return; - if (ifp = if_lookup_by_name(peer->conf_if)) + if ((ifp = if_lookup_by_name(peer->conf_if))) { /* if multiple IP addresses assigned to link, we pick the first */ if (!CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) @@ -2520,7 +2520,6 @@ peer_group_unbind (struct bgp *bgp, struct peer *peer, struct peer_group *group, afi_t afi, safi_t safi) { struct peer *other; - int v6only; if (! peer->af_group[afi][safi]) return 0; @@ -5726,7 +5725,7 @@ peer_ttl_security_hops_unset (struct peer *peer) } } - return 0; + return ret; } /* diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 95939fe0a8..851132cb8b 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -613,7 +613,7 @@ struct peer #define PEER_FLAG_LONESOUL (1 << 11) #define PEER_FLAG_DYNAMIC_NEIGHBOR (1 << 12) /* dynamic neighbor */ #define PEER_FLAG_CAPABILITY_ENHE (1 << 13) /* Extended next-hop (rfc 5549)*/ -#define PEER_FLAG_IFPEER_V6ONLY (1 << 14) /* if-based peer is v6 only * +#define PEER_FLAG_IFPEER_V6ONLY (1 << 14) /* if-based peer is v6 only */ /* NSF mode (graceful restart) */ u_char nsf[AFI_MAX][SAFI_MAX]; @@ -814,7 +814,7 @@ u_char last_reset_cause[BGP_MAX_PACKET_SIZE]; #define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */ /* peer specific BFD information */ - void *bfd_info; + struct bfd_info *bfd_info; }; #define PEER_PASSWORD_MINLEN (1) diff --git a/lib/bfd.h b/lib/bfd.h index 6ad1868dc2..f0051d93a2 100644 --- a/lib/bfd.h +++ b/lib/bfd.h @@ -53,7 +53,7 @@ extern struct bfd_info * bfd_info_create(void); extern void -bfd_info_free(void **bfd_info); +bfd_info_free(struct bfd_info **bfd_info); extern int bfd_validate_param(struct vty *vty, const char *dm_str, const char *rx_str, diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c index 175cf1443e..bcf0be623d 100644 --- a/lib/ptm_lib.c +++ b/lib/ptm_lib.c @@ -124,7 +124,7 @@ _ptm_lib_decode_header (csv_t *csv, int ptm_lib_append_msg(ptm_lib_handle_t *hdl, void *ctxt, - const char *key, char *val) + const char *key, const char *val) { ptm_lib_msg_ctxt_t *p_ctxt = ctxt; csv_t *csv; diff --git a/lib/ptm_lib.h b/lib/ptm_lib.h index 1aa2f356f5..e79529a819 100644 --- a/lib/ptm_lib.h +++ b/lib/ptm_lib.h @@ -45,5 +45,5 @@ ptm_lib_handle_t *ptm_lib_register(char *, ptm_cmd_cb, ptm_notify_cb, ptm_respon void ptm_lib_deregister(ptm_lib_handle_t *); int ptm_lib_find_key_in_msg(void *, const char *, char *); int ptm_lib_init_msg(ptm_lib_handle_t *, int, int, void *, void **); -int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, char *); +int ptm_lib_append_msg(ptm_lib_handle_t *, void *, const char *, const char *); int ptm_lib_complete_msg(ptm_lib_handle_t *, void *, char *, int *); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index a45bdd5d6e..63783cc8f0 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -28,6 +28,7 @@ #include "thread.h" #include "prefix.h" #include "plist.h" +#include "zclient.h" #include "bfd.h" #include "ospf6_lsa.h" diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h index 6ef9e37822..3f5c5f041f 100644 --- a/ospf6d/ospf6_interface.h +++ b/ospf6d/ospf6_interface.h @@ -115,7 +115,7 @@ struct ospf6_interface char *plist_name; /* BFD information */ - void *bfd_info; + struct bfd_info *bfd_info; }; /* interface state */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 06cf7fa272..ef6012d3ef 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -52,18 +52,6 @@ #include "ospfd/ospf_dump.h" #include "ospfd/ospf_bfd.h" -#define QUAGGA_REDIST_STR_OSPFD \ - "(kernel|connected|static|rip|isis|bgp|babel)" -#define QUAGGA_REDIST_HELP_STR_OSPFD \ - "Kernel routes (not installed via the zebra RIB)\n" \ - "Connected routes (directly attached subnet or host)\n" \ - "Statically configured routes\n" \ - "Routing Information Protocol (RIP)\n" \ - "Intermediate System to Intermediate System (IS-IS)\n" \ - "Border Gateway Protocol (BGP)\n" \ - "Babel routing protocol (Babel)\n" - - static const char *ospf_network_type_str[] = { "Null", diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index bf2d01ca20..b1c9f453b6 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2020,7 +2020,6 @@ backup_config_file (const char *fbackup) static int write_config_integrated(void) { - int ret; u_int i; char line[] = "write terminal\n"; FILE *fp, *fp1; diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index 2290091efe..b60b83120c 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -25,6 +25,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "memory.h" #include "vtysh/vtysh.h" +#include "vtysh/vtysh_user.h" /* * Compiler is warning about prototypes not being declared. diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c index a17f7a7176..985c53dceb 100644 --- a/vtysh/vtysh_user.c +++ b/vtysh/vtysh_user.c @@ -37,6 +37,7 @@ #include "memory.h" #include "linklist.h" #include "command.h" +#include "vtysh/vtysh_user.h" /* * Compiler is warning about prototypes not being declared. @@ -47,7 +48,6 @@ int vtysh_pam(const char *); struct vtysh_user *user_new(void); void user_free(struct vtysh_user *); struct vtysh_user *user_lookup(const char *); -void user_config_write(void); struct vtysh_user *user_get(const char *); int vtysh_auth(void); void vtysh_user_init(void); diff --git a/vtysh/vtysh_user.h b/vtysh/vtysh_user.h index 8d0a4cf6ae..43d125505c 100644 --- a/vtysh/vtysh_user.h +++ b/vtysh/vtysh_user.h @@ -23,5 +23,6 @@ #define _VTYSH_USER_H int vtysh_auth (); +void user_config_write(void); #endif /* _VTYSH_USER_H */ diff --git a/watchquagga/watchquagga.c b/watchquagga/watchquagga.c index 0b48708b78..1e930f4018 100644 --- a/watchquagga/watchquagga.c +++ b/watchquagga/watchquagga.c @@ -329,7 +329,7 @@ DEFAULT_PERIOD,DEFAULT_TIMEOUT,DEFAULT_RESTART_TIMEOUT,DEFAULT_PIDFILE); } static pid_t -run_background(const char *shell_cmd) +run_background(char *shell_cmd) { pid_t child; @@ -345,8 +345,10 @@ run_background(const char *shell_cmd) if (setpgid(0,0) < 0) zlog_warn("warning: setpgid(0,0) failed: %s",safe_strerror(errno)); { - const char *argv[4] = { "sh", "-c", shell_cmd, NULL}; - execv("/bin/sh",(char *const *)argv); + char shell[] = "sh"; + char dashc[] = "-c"; + char * const argv[4] = { shell, dashc, shell_cmd, NULL}; + execv("/bin/sh", argv); zlog_err("execv(/bin/sh -c '%s') failed: %s", shell_cmd,safe_strerror(errno)); _exit(127); diff --git a/zebra/interface.c b/zebra/interface.c index 70cdf36f8a..4329efd2a0 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -43,6 +43,7 @@ #include "zebra/zebra_ptm.h" #include "zebra/rt_netlink.h" #include "zebra/zserv.h" +#include "zebra/interface.h" #define ZEBRA_PTM_SUPPORT @@ -530,7 +531,7 @@ if_delete_update (struct interface *ifp) ifp->ifindex = IFINDEX_INTERNAL; } -void +static void ipv6_ll_address_to_mac (struct in6_addr *address, u_char *mac) { mac[0] = address->s6_addr[8] ^ 0x02; @@ -548,16 +549,16 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp, { char buf[16] = "169.254.0.1"; struct in_addr ipv4_ll; - u_char mac[6]; + char mac[6]; inet_pton (AF_INET, buf, &ipv4_ll); - ipv6_ll_address_to_mac(address, mac); + ipv6_ll_address_to_mac(address, (u_char *)mac); netlink_neigh_update (add ? RTM_NEWNEIGH : RTM_DELNEIGH, ifp->ifindex, ipv4_ll.s_addr, mac, 6); } -void +static void if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (struct interface *ifp) { if (listhead(ifp->nbr_connected)) @@ -587,7 +588,7 @@ if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface *ifp) } } -void +static void if_down_del_nbr_connected (struct interface *ifp) { struct nbr_connected *nbr_connected; diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c index 9b45acb79b..5f37e0cc7c 100644 --- a/zebra/kernel_null.c +++ b/zebra/kernel_null.c @@ -7,6 +7,7 @@ #include "zebra/rt.h" #include "zebra/redistribute.h" #include "zebra/connected.h" +#include "zebra/rt_netlink.h" int kernel_add_ipv4 (struct prefix *a, struct rib *b) { return 0; } int kernel_update_ipv4 (struct prefix *a, struct rib *b) { return 0; } diff --git a/zebra/zebra_ptm_null.c b/zebra/zebra_ptm_null.c index a9e2333763..ad48f23856 100644 --- a/zebra/zebra_ptm_null.c +++ b/zebra/zebra_ptm_null.c @@ -20,6 +20,8 @@ */ #include #include "prefix.h" +#include "if.h" +#include "zebra_ptm_redistribute.h" void zebra_interface_bfd_update (struct interface *a, struct prefix *dp, struct prefix *sp) diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c index 40394f059c..6166fc0026 100644 --- a/zebra/zebra_ptm_redistribute.c +++ b/zebra/zebra_ptm_redistribute.c @@ -24,11 +24,12 @@ #include "vty.h" #include "stream.h" #include "zebra/zserv.h" +#include "zebra/zebra_ptm_redistribute.h" /* master zebra server structure */ extern struct zebra_t zebrad; -int +static int zsend_interface_bfd_update (int cmd, struct zserv *client, struct interface *ifp, struct prefix *dp, struct prefix *sp) @@ -88,7 +89,7 @@ zebra_interface_bfd_update (struct interface *ifp, struct prefix *dp, } } -int +static int zsend_bfd_peer_replay (int cmd, struct zserv *client) { struct stream *s; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 0d11927e3f..41a7f68b88 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -43,6 +43,7 @@ #include "zebra/debug.h" #include "zebra/zebra_fpm.h" #include "zebra/zebra_rnh.h" +#include "zebra/interface.h" /* Default rtm_table for all clients */ extern struct zebra_t zebrad; @@ -3240,7 +3241,7 @@ rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi, if (!table) return 0; /* Make it sure prefixlen is applied to the prefix. */ - apply_mask_ipv4 (p); + apply_mask_ipv4 ((struct prefix_ipv4 *)p); } else { @@ -3263,7 +3264,7 @@ rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi, return 0; /* Make sure mask is applied. */ - apply_mask_ipv6 (p); + apply_mask_ipv6 ((struct prefix_ipv6 *)p); } diff --git a/zebra/zserv.c b/zebra/zserv.c index 51a69a961b..188665814a 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -45,6 +45,8 @@ #include "zebra/ipforward.h" #include "zebra/zebra_rnh.h" #include "zebra/rt_netlink.h" +#include "zebra/interface.h" +#include "zebra/zebra_ptm.h" /* Event list of zebra. */ enum event { ZEBRA_SERV, ZEBRA_READ, ZEBRA_WRITE }; @@ -1254,7 +1256,6 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length) u_char nexthop_type; unsigned long ifindex; struct prefix_ipv4 p; - u_char ifname_len; safi_t safi; static struct in6_addr nexthops[MULTIPATH_NUM]; static unsigned int ifindices[MULTIPATH_NUM]; -- 2.39.5