From c9e52be3f4d98943b67fbbe5d9a7ccd823b88326 Mon Sep 17 00:00:00 2001 From: hasso Date: Sun, 26 Sep 2004 16:09:34 +0000 Subject: [PATCH] Compiler warnings fixes. --- bgpd/ChangeLog | 4 ++++ bgpd/bgp_aspath.c | 2 +- bgpd/bgp_packet.c | 2 +- bgpd/bgp_vty.c | 2 +- ospfd/ChangeLog | 5 +++++ ospfd/ospf_abr.c | 2 +- ospfd/ospf_dump.c | 2 +- ospfd/ospf_lsa.c | 2 +- ospfd/ospf_packet.c | 2 +- ospfd/ospf_vty.c | 18 +++++++++--------- ospfd/ospf_zebra.c | 2 +- ripngd/ChangeLog | 6 ++++++ ripngd/ripng_nexthop.c | 6 +++--- ripngd/ripngd.c | 18 ++++++++++++------ zebra/ChangeLog | 5 +++++ zebra/irdp_interface.c | 2 +- zebra/irdp_main.c | 1 + zebra/irdp_packet.c | 2 +- zebra/rt_netlink.c | 2 +- zebra/rtadv.c | 2 +- zebra/zebra_vty.c | 2 +- 21 files changed, 58 insertions(+), 31 deletions(-) diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index ee0b3113f..2bcce1c7b 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,7 @@ +2004-09-26 Hasso Tepper + + * bgp_aspath.c, bgp_packet.c, bgp_vty.c: Fix compiler warnings. + 2004-09-23 Hasso Tepper * *.[c|h]: list -> struct list *, listnode -> struct listnode *. diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index d30ef4cc6..bcb8f16f2 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -136,7 +136,7 @@ aspath_make_str_count (struct aspath *as) struct assegment *assegment; int str_size = ASPATH_STR_DEFAULT_LEN; int str_pnt; - u_char *str_buf; + char *str_buf; int count = 0; /* Empty aspath. */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 42820273f..b4cd13016 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2253,7 +2253,7 @@ bgp_read (struct thread *thread) bgp_notify_send_with_data (peer, BGP_NOTIFY_HEADER_ERR, BGP_NOTIFY_HEADER_BAD_MESLEN, - notify_data_length, 2); + (u_char *) notify_data_length, 2); goto done; } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 92918bdfc..27a3c2eb5 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2584,7 +2584,7 @@ DEFUN (neighbor_description, b = buffer_new (1024); for (i = 1; i < argc; i++) { - buffer_putstr (b, (u_char *)argv[i]); + buffer_putstr (b, argv[i]); buffer_putc (b, ' '); } buffer_putc (b, '\0'); diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index 53ae8f29d..8423cab05 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Hasso Tepper + + * ospf_abr.c, ospf_dump.c, ospf_lsa.c, ospf_packet.c, ospf_vty.c, + ospf_zebra.c: Fix compiler warnings. + 2004-09-24 Paul Jakma * ospf_apiserver.{c,h}: lists typedef removal cleanup. diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 9f3a587cb..e23ace205 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -596,7 +596,7 @@ set_metric (struct ospf_lsa *lsa, u_int32_t metric) struct summary_lsa *header; u_char *mp; metric = htonl (metric); - mp = (char *) &metric; + mp = (u_char *) &metric; mp++; header = (struct summary_lsa *) lsa->data; memcpy(header->metric, mp, 3); diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 3711e9f0f..958baa40b 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -649,7 +649,7 @@ ospf_header_dump (struct ospf_header *ospfh) break; case OSPF_AUTH_SIMPLE: memset (buf, 0, 9); - strncpy (buf, ospfh->u.auth_data, 8); + strncpy (buf, (char *) ospfh->u.auth_data, 8); zlog_info (" Simple Password %s", buf); break; case OSPF_AUTH_CRYPTOGRAPHIC: diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 34d71b6c9..944af64d8 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -186,7 +186,7 @@ ospf_lsa_checksum (struct lsa_header *lsa) lsa->checksum = 0; length = ntohs (lsa->length) - 2; - sp = (char *) &lsa->options; + sp = (u_char *) &lsa->options; for (ep = sp + length; sp < ep; sp = q) { diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 5952d184e..67926fc34 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -351,7 +351,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) else { ck = getdata (OSPF_IF_PARAM (oi, auth_crypt)->tail); - auth_key = ck->auth_key; + auth_key = (char *) ck->auth_key; } /* Generate a digest for the entire packet + our secret key. */ diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 6b0dabbd4..ab73f7b13 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -718,7 +718,7 @@ ospf_vl_set_security (struct ospf_vl_data *vl_data, if (vl_config->auth_key) { memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); - strncpy (IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, + strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, OSPF_AUTH_SIMPLE_SIZE); } else if (vl_config->md5_key) @@ -733,7 +733,7 @@ ospf_vl_set_security (struct ospf_vl_data *vl_data, ck = ospf_crypt_key_new (); ck->key_id = vl_config->crypto_key_id; memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy (ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); } @@ -4130,7 +4130,7 @@ DEFUN (ip_ospf_authentication_key, memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); - strncpy (params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); + strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); SET_IF_PARAM (params, auth_simple); return CMD_SUCCESS; @@ -4255,7 +4255,7 @@ DEFUN (ip_ospf_message_digest_key, ck = ospf_crypt_key_new (); ck->key_id = (u_char) key_id; memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); - strncpy (ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); + strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); ospf_crypt_key_add (params->auth_crypt, ck); SET_IF_PARAM (params, auth_crypt); @@ -6882,9 +6882,9 @@ config_write_network_area (struct vty *vty, struct ospf *ospf) /* Create Area ID string by specified Area ID format. */ if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy (buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); + strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); else - sprintf (buf, "%lu", + sprintf ((char *) buf, "%lu", (unsigned long int) ntohl (n->area_id.s_addr)); /* Network print. */ @@ -6908,7 +6908,7 @@ config_write_ospf_area (struct vty *vty, struct ospf *ospf) struct ospf_area *area = getdata (node); struct route_node *rn1; - area_id2str (buf, INET_ADDRSTRLEN, area); + area_id2str ((char *) buf, INET_ADDRSTRLEN, area); if (area->auth_type != OSPF_AUTH_NULL) { @@ -7041,9 +7041,9 @@ config_write_virtual_link (struct vty *vty, struct ospf *ospf) memset (buf, 0, INET_ADDRSTRLEN); if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) - strncpy (buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); + strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); else - sprintf (buf, "%lu", + sprintf ((char *) buf, "%lu", (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); oi = vl_data->vl_oi; diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 5520c0895..6a675a599 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -139,7 +139,7 @@ zebra_interface_if_lookup (struct stream *s) stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); /* Lookup this by interface index. */ - ifp = if_lookup_by_name (ifname_tmp); + ifp = if_lookup_by_name ((char *) ifname_tmp); /* If such interface does not exist, indicate an error */ if (!ifp) diff --git a/ripngd/ChangeLog b/ripngd/ChangeLog index 92dbf6f67..112aa1921 100644 --- a/ripngd/ChangeLog +++ b/ripngd/ChangeLog @@ -1,3 +1,9 @@ +2004-09-26 Hasso Tepper + + * ripingd.c: Access list hook argument function must have struct + access_list * argument. Solution taken from ripd. + * ripngd.c, ripnf_nexthop.c: Fix compiler warnings. + 2004-09-23 Hasso Tepper * *.[c|h]: list -> struct list *, listnode -> struct listnode *. diff --git a/ripngd/ripng_nexthop.c b/ripngd/ripng_nexthop.c index 04b13c50d..e946dc912 100644 --- a/ripngd/ripng_nexthop.c +++ b/ripngd/ripng_nexthop.c @@ -161,7 +161,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, /* A nexthop entry should be at least followed by 1 RTE */ if (num == (rtemax-1)) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) @@ -191,7 +191,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, TAG_OUT(data), METRIC_OUT(data)); if (num == rtemax) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) @@ -204,7 +204,7 @@ ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp, /* If unwritten RTE exist, flush it. */ if (num != 0) { - ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s), + ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s), to, ifp); if (ret >= 0 && IS_RIPNG_DEBUG_SEND) diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 874848c95..4d7c0216e 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -1585,9 +1585,9 @@ ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p, /* Write routing table entry. */ if (!nexthop) - stream_write (s, (caddr_t) &p->prefix, sizeof (struct in6_addr)); + stream_write (s, (u_char *) &p->prefix, sizeof (struct in6_addr)); else - stream_write (s, (caddr_t) nexthop, sizeof (struct in6_addr)); + stream_write (s, (u_char *) nexthop, sizeof (struct in6_addr)); stream_putw (s, tag); if (p) stream_putc (s, p->prefixlen); @@ -2813,7 +2813,7 @@ ripng_distribute_update_interface (struct interface *ifp) /* Update all interface's distribute list. */ void -ripng_distribute_update_all () +ripng_distribute_update_all (struct prefix_list *notused) { struct interface *ifp; struct listnode *node; @@ -2824,6 +2824,12 @@ ripng_distribute_update_all () ripng_distribute_update_interface (ifp); } } + +void +ripng_distribute_update_all_wrapper (struct access_list *notused) +{ + ripng_distribute_update_all(NULL); +} /* delete all the added ripng routes. */ void @@ -2985,7 +2991,7 @@ ripng_routemap_update_redistribute (void) } void -ripng_routemap_update () +ripng_routemap_update (char *unused) { struct interface *ifp; struct listnode *node; @@ -3049,8 +3055,8 @@ ripng_init () /* Access list install. */ access_list_init (); - access_list_add_hook (ripng_distribute_update_all); - access_list_delete_hook (ripng_distribute_update_all); + access_list_add_hook (ripng_distribute_update_all_wrapper); + access_list_delete_hook (ripng_distribute_update_all_wrapper); /* Prefix list initialize.*/ prefix_list_init (); diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 27deda70e..a62fb6cc6 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,8 @@ +2004-09-26 Hasso Tepper + + * irdp_interface.c, irdp_main.c, irdp_packet.c, rt_netlink.c, + rtadv.c, zebra_vty.c: Fix compiler warnings. + 2004-09-24 Paul Jakma * irdp_interface.c: (no_ip_irdp_address_preference_cmd) diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c index 9aace8c43..76654c476 100644 --- a/zebra/irdp_interface.c +++ b/zebra/irdp_interface.c @@ -245,7 +245,7 @@ void irdp_if_start(struct interface *ifp, int multicast, int set_defaults) timer = (random () % IRDP_DEFAULT_INTERVAL) + 1; irdp->AdvPrefList = list_new(); - irdp->AdvPrefList->del = (void *) Adv_free; /* Destructor */ + irdp->AdvPrefList->del = (void (*)(void *)) Adv_free; /* Destructor */ /* And this for startup. Speed limit from 1991 :-). But it's OK*/ diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c index 9e31950e2..5ee50e793 100644 --- a/zebra/irdp_main.c +++ b/zebra/irdp_main.c @@ -41,6 +41,7 @@ #include "if.h" #include "vty.h" #include "sockunion.h" +#include "sockopt.h" #include "prefix.h" #include "command.h" #include "memory.h" diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c index bb3513a31..67609b31f 100644 --- a/zebra/irdp_packet.c +++ b/zebra/irdp_packet.c @@ -227,7 +227,7 @@ int irdp_read_raw(struct thread *r) int irdp_sock = THREAD_FD (r); t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock); - ret = irdp_recvmsg (irdp_sock, buf, IRDP_RX_BUF, &ifindex); + ret = irdp_recvmsg (irdp_sock, (u_char *) buf, IRDP_RX_BUF, &ifindex); if (ret < 0) zlog_warn ("IRDP: RX Error length = %d", ret); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 9e6c440b0..cb69187c8 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -179,7 +179,7 @@ netlink_socket (struct nlsock *nl, unsigned long groups) /* multiple netlink sockets will have different nl_pid */ namelen = sizeof snl; - ret = getsockname (sock, (struct sockaddr *) &snl, &namelen); + ret = getsockname (sock, (struct sockaddr *) &snl, (socklen_t *) &namelen); if (ret < 0 || namelen != sizeof snl) { zlog (NULL, LOG_ERR, "Can't get %s socket name: %s", nl->name, diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 4bab03bf8..e5a026e64 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1110,7 +1110,7 @@ rtadv_config_write (struct vty *vty, struct interface *ifp) rprefix = getdata (node); vty_out (vty, " ipv6 nd prefix %s/%d", inet_ntop (AF_INET6, &rprefix->prefix.u.prefix6, - buf, INET6_ADDRSTRLEN), + (char *) buf, INET6_ADDRSTRLEN), rprefix->prefix.prefixlen); if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) || (rprefix->AdvPreferredLifetime != RTADV_PREFERRED_LIFETIME)) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 4bcd29f7a..b2f09325a 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -59,7 +59,7 @@ route_type_str (u_char type) }; /* Return route type string for VTY output. */ -const char +char route_type_char (u_char type) { switch (type) -- 2.39.5