diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-16 22:28:41 +0100 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-04-16 22:28:41 +0100 |
commit | 075b751cfe1ae87c416eceb68e01b5f8b9a9e92b (patch) | |
tree | 1d6089008cab2d37422e5859c5e8c04faf1ba23e | |
parent | 62ecf51e3c652c65c84bb94d794f2533cee1fb9c (diff) | |
download | quagga-075b751cfe1ae87c416eceb68e01b5f8b9a9e92b.tar.bz2 quagga-075b751cfe1ae87c416eceb68e01b5f8b9a9e92b.tar.xz |
Further reduction of warnings under gcc 4.2.1
-rw-r--r-- | bgpd/bgp_msg_read.c | 12 | ||||
-rw-r--r-- | bgpd/bgp_network.c | 45 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 4 | ||||
-rw-r--r-- | lib/list_util.h | 5 | ||||
-rw-r--r-- | lib/qpselect.c | 24 | ||||
-rw-r--r-- | zebra/ioctl.c | 2 | ||||
-rw-r--r-- | zebra/ioctl.h | 1 |
7 files changed, 59 insertions, 34 deletions
diff --git a/bgpd/bgp_msg_read.c b/bgpd/bgp_msg_read.c index e8a2897e..7e55bf70 100644 --- a/bgpd/bgp_msg_read.c +++ b/bgpd/bgp_msg_read.c @@ -617,7 +617,12 @@ bgp_msg_open_option_parse (bgp_connection connection, bgp_notify notification, opt_type = suck_b(sr); opt_length = suck_b(sr); left -= opt_length ; - } ; + } + else + { + opt_type = 0 ; /* ensure initialised */ + opt_length = 0 ; + } /* Must not have exceeded available bytes */ if (left < 0) @@ -1569,6 +1574,11 @@ bgp_msg_orf_recv(bgp_connection connection, bgp_route_refresh rr, { orf_type = suck_b(sr) ; orf_len = suck_w(sr) ; + } + else + { + orf_type = 0 ; /* ensure initialised */ + orf_len = 0 ; } ; /* The length may not be zero and may not exceed what there is left */ diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 710dc51e..77c89ff3 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -83,17 +83,9 @@ bgp_md5_set_listeners(union sockunion* su, const char* password) ; typedef struct bgp_listener* bgp_listener ; -static bgp_listener bgp_listeners[] = - { - [AF_INET] = NULL, -#if HAVE_IPV6 - [AF_INET6] = NULL -#endif - } ; - -CONFIRM(AF_INET < 20) ; /* The bgp_listeners array is not a silly size */ -#if HAVE_IPV6 -CONFIRM(AF_INET6 < 20) ; /* The bgp_listeners array is not a silly size */ +static bgp_listener bgp_listeners_inet = NULL ; +#ifdef HAVE_IPV6 +static bgp_listener bgp_listeners_inet6 = NULL ; #endif #if defined(HAVE_IPV6) && !defined(NRL) @@ -110,6 +102,25 @@ struct bgp_listener union sockunion su ; } ; +/* Get pointer to list base for listeners in the given address family. */ +static inline +bgp_listener* bgp_listeners(sa_family_t family) +{ + switch (family) + { + case AF_INET: + return &bgp_listeners_inet ; + +#ifdef HAVE_IPV6 + case AF_INET6: + return &bgp_listeners_inet6 ; + +#endif + default: + zabort("invalid address family") ; + } ; +} + /* Forward reference */ static int bgp_open_listeners_addrinfo(const char* address, unsigned short port) ; @@ -412,8 +423,8 @@ bgp_open_listener(sockunion su, unsigned short port, sockunion_copy(&listener->su, su) ; - listener->next = bgp_listeners[sockunion_family(su)] ; - bgp_listeners[sockunion_family(su)] = listener ; + listener->next = *bgp_listeners(sockunion_family(su)) ; + *bgp_listeners(sockunion_family(su)) = listener ; return 0 ; } ; @@ -429,8 +440,10 @@ static void bgp_reset_listeners(bgp_listener* p_listener) ; extern void bgp_close_listeners(void) { - bgp_reset_listeners(&bgp_listeners[AF_INET]) ; - bgp_reset_listeners(&bgp_listeners[AF_INET6]) ; + bgp_reset_listeners(bgp_listeners(AF_INET)) ; +#ifdef HAVE_IPV6 + bgp_reset_listeners(bgp_listeners(AF_INET6)) ; +#endif } ; static void @@ -1089,7 +1102,7 @@ bgp_md5_set_listeners(union sockunion* su, const char* password) assert(su->sa.sa_family == AF_INET) ; #endif - listener = bgp_listeners[su->sa.sa_family] ; + listener = *bgp_listeners(su->sa.sa_family) ; while (listener != NULL) { diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 875ff648..6553b3ff 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1570,7 +1570,7 @@ bgp_process_main (struct work_queue *wq, work_queue_item item) struct bgp_node *rn ; afi_t afi ; safi_t safi ; - struct prefix *p = &rn->p; + struct prefix *p ; struct bgp_info *new_select; struct bgp_info *old_select; struct bgp_info_pair old_and_new; @@ -1591,6 +1591,8 @@ bgp_process_main (struct work_queue *wq, work_queue_item item) afi = rn->table->afi; safi = rn->table->safi; + p = &rn->p ; + /* Best path selection. */ bgp_best_selection (bgp, rn, &old_and_new); old_select = old_and_new.old; diff --git a/lib/list_util.h b/lib/list_util.h index 10ba8b0c..e5a8b4c0 100644 --- a/lib/list_util.h +++ b/lib/list_util.h @@ -238,15 +238,14 @@ struct dl_void_base_pair base_pair(void*) ; ((base) = NULL) #define ssl_push(base, item, next) \ - do { confirm(_lu_off(base, next) == _lu_off(item, next)) ; \ - (item)->next = (base) ; \ + do { (item)->next = (base) ; \ (base) = item ; \ } while (0) extern int ssl_del_func(void** p_this, void* obj, size_t link_offset) ; #define ssl_del(base, item, next) \ - ssl_del_func((void**)&(base), item, _lu_off(base, next)) + ssl_del_func((void**)&(base), item, _lu_off(item, next)) #define ssl_del_head(base, next) \ do { if ((base) != NULL) \ diff --git a/lib/qpselect.c b/lib/qpselect.c index 3cca3805..fd20d421 100644 --- a/lib/qpselect.c +++ b/lib/qpselect.c @@ -686,7 +686,7 @@ qps_file_lookup_fd(qps_selection qps, int fd, qps_file insert) vector_index i ; int ret ; - dassert((fd >= 0) && (fd < FD_SETSIZE)) ; + dassert((fd >= 0) && (fd < (int)FD_SETSIZE)) ; /* Look-up */ /* */ @@ -991,26 +991,26 @@ qps_make_super_set_map(void) /* (1) check that a zeroised fd_super_set is an empty one. */ qps_super_set_zero(&test, 1) ; - for (fd = 0 ; fd < FD_SETSIZE ; ++fd) + for (fd = 0 ; fd < (int)FD_SETSIZE ; ++fd) if (FD_ISSET(fd, &test.fdset)) zabort("Zeroised fd_super_set is not empty") ; /* (2) check that zeroising the fd_set doesn't change things */ FD_ZERO(&test.fdset) ; - for (iw = 0 ; iw < FD_SUPER_SET_WORD_SIZE ; ++iw) + for (iw = 0 ; iw < (int)FD_SUPER_SET_WORD_SIZE ; ++iw) if (test.words[iw] != 0) zabort("Zeroised fd_super_set is not all zero words") ; /* (3) check that setting one fd sets one bit, and construct the */ /* fd_word_map[], fd_byte_map[] and fd_bit_map[]. */ - for (fd = 0 ; fd < FD_SETSIZE ; ++fd) + for (fd = 0 ; fd < (int)FD_SETSIZE ; ++fd) { fd_word_t w ; FD_SET(fd, &test.fdset) ; w = 0 ; - for (iw = 0 ; iw < FD_SUPER_SET_WORD_SIZE ; ++iw) + for (iw = 0 ; iw < (int)FD_SUPER_SET_WORD_SIZE ; ++iw) { if (test.words[iw] != 0) { @@ -1040,7 +1040,7 @@ qps_make_super_set_map(void) FD_CLR(fd, &test.fdset) ; - for (iw = 0 ; iw < FD_SUPER_SET_WORD_SIZE ; ++iw) + for (iw = 0 ; iw < (int)FD_SUPER_SET_WORD_SIZE ; ++iw) if (test.words[iw] != 0) zabort("FD_CLR did not leave the fd_super_set empty") ; } ; @@ -1049,7 +1049,7 @@ qps_make_super_set_map(void) /* make sure that have 8 contiguous fd to a byte. */ /* make sure that have 32 contiguous fd to a word. */ - for (fd = 0 ; fd < FD_SETSIZE ; fd += 8) + for (fd = 0 ; fd < (int)FD_SETSIZE ; fd += 8) { int fds ; ib = fd_byte_map[fd] ; @@ -1061,7 +1061,7 @@ qps_make_super_set_map(void) zabort("Broken fd_byte_map -- not 8 contiguous fd's in a byte") ; /* Must not share the same byte as any other set of 8 fd's */ - for (fds = 0 ; fds < FD_SETSIZE ; fds += 8) + for (fds = 0 ; fds < (int)FD_SETSIZE ; fds += 8) if ((fd_byte_map[fds] == ib) && (fds != fd)) zabort("Broken fd_byte_map -- fd's not in expected bytes") ; @@ -1076,7 +1076,7 @@ qps_make_super_set_map(void) for (i = 0 ; i < 8 ; ++i) { uint8_t b = fd_bit_map[i] ; - for (fd = 8 + i ; fd < FD_SETSIZE ; fd += 8) + for (fd = 8 + i ; fd < (int)FD_SETSIZE ; fd += 8) if (fd_bit_map[fd] != b) zabort("Broken fd_bit_map -- inconsistent bit mapping") ; } ; @@ -1106,7 +1106,7 @@ qps_make_super_set_map(void) /* include fds 0..fd. */ i = 0 ; - for (fd = 0 ; fd < FD_SETSIZE ; ++fd) + for (fd = 0 ; fd < (int)FD_SETSIZE ; ++fd) { int c = fd_byte_map[fd] + 1 ; @@ -1125,7 +1125,7 @@ qps_make_super_set_map(void) * Checking that the maps have been correctly deduced -- where know what * the mapping really is ! */ - for (fd = 0 ; fd < FD_SETSIZE ; ++fd) + for (fd = 0 ; fd < (int)FD_SETSIZE ; ++fd) { uint8_t b ; short c ; @@ -1396,7 +1396,7 @@ qps_selection_validate(qps_selection qps) for (mnum = 0 ; mnum < qps_mnum_count ; ++mnum) if (qps->tried_count[mnum] != 0) { - for (fd = 0 ; fd < FD_SETSIZE ; ++fd) + for (fd = 0 ; fd < (int)FD_SETSIZE ; ++fd) if (FD_ISSET(fd, &qps->results[mnum].fdset)) { ++n ; diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 7c51e91b..97a26b86 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -80,7 +80,7 @@ if_ioctl (u_long request, caddr_t buffer) } #ifdef HAVE_IPV6 -static int +int if_ioctl_ipv6 (u_long request, caddr_t buffer) { int sock; diff --git a/zebra/ioctl.h b/zebra/ioctl.h index fee9b725..5481451c 100644 --- a/zebra/ioctl.h +++ b/zebra/ioctl.h @@ -40,6 +40,7 @@ extern void if_get_mtu (struct interface *); #ifdef HAVE_IPV6 extern int if_prefix_add_ipv6 (struct interface *, struct connected *); extern int if_prefix_delete_ipv6 (struct interface *, struct connected *); +extern int if_ioctl_ipv6(u_long, caddr_t); #endif /* HAVE_IPV6 */ #ifdef SOLARIS_IPV6 |