summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_aspath.c6
-rw-r--r--bgpd/bgp_aspath.h2
-rw-r--r--bgpd/bgp_attr.c14
-rw-r--r--bgpd/bgp_attr.h5
-rw-r--r--bgpd/bgp_community.c2
-rw-r--r--bgpd/bgp_damp.c6
-rw-r--r--bgpd/bgp_damp.h5
-rw-r--r--bgpd/bgp_debug.c28
-rw-r--r--bgpd/bgp_debug.h4
-rw-r--r--bgpd/bgp_ecommunity.c4
-rw-r--r--bgpd/bgp_ecommunity.h1
-rw-r--r--bgpd/bgp_fsm.c2
-rw-r--r--bgpd/bgp_main.c18
-rw-r--r--bgpd/bgp_network.c11
-rw-r--r--bgpd/bgp_open.c19
-rw-r--r--bgpd/bgp_packet.c2
-rw-r--r--bgpd/bgp_route.c13
-rw-r--r--bgpd/bgpd.c12
-rw-r--r--bgpd/bgpd.h2
-rw-r--r--lib/log.c2
-rw-r--r--lib/log.h2
-rw-r--r--lib/smux.c16
-rw-r--r--lib/smux.h5
-rw-r--r--ospfd/ospf_dump.c20
-rw-r--r--ospfd/ospfd.c4
-rw-r--r--ospfd/ospfd.h22
-rw-r--r--zebra/kernel_socket.c2
27 files changed, 109 insertions, 120 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index d6fa6af5..e703941d 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -86,7 +86,7 @@ struct assegment_header
};
/* Hash for aspath. This is the top level structure of AS path. */
-struct hash *ashash;
+static struct hash *ashash;
/* Stream for SNMP. See aspath_snmp_pathseg */
static struct stream *snmp_stream;
@@ -482,6 +482,7 @@ aspath_has_as4 (struct aspath *aspath)
return 0;
}
+#ifdef unused
/* Return number of as numbers in in path */
unsigned int
aspath_count_numas (struct aspath *aspath)
@@ -497,6 +498,7 @@ aspath_count_numas (struct aspath *aspath)
}
return num;
}
+#endif
/* Expand aspath string */
static char *
@@ -1769,6 +1771,7 @@ aspath_init (void)
ashash = hash_create_size (32767, aspath_key_make, aspath_cmp);
}
+#ifdef unused
void
aspath_finish (void)
{
@@ -1777,6 +1780,7 @@ aspath_finish (void)
if (snmp_stream)
stream_free (snmp_stream);
}
+#endif
/* return and as path value */
const char *
diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h
index 2b4625c8..8f8db9a6 100644
--- a/bgpd/bgp_aspath.h
+++ b/bgpd/bgp_aspath.h
@@ -64,7 +64,6 @@ struct aspath
/* Prototypes. */
extern void aspath_init (void);
-extern void aspath_finish (void);
extern struct aspath *aspath_parse (struct stream *, size_t, int);
extern struct aspath *aspath_dup (struct aspath *);
extern struct aspath *aspath_aggregate (struct aspath *, struct aspath *);
@@ -97,7 +96,6 @@ extern size_t aspath_put (struct stream *, struct aspath *, int);
extern struct aspath *aspath_reconcile_as4 (struct aspath *, struct aspath *);
extern unsigned int aspath_has_as4 (struct aspath *);
-extern unsigned int aspath_count_numas (struct aspath *);
/* For SNMP BGP4PATHATTRASPATHSEGMENT, might be useful for debug */
extern u_char *aspath_snmp_pathseg (struct aspath *, size_t *);
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index ed1e72b3..41e9c223 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -39,7 +39,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_ecommunity.h"
/* Attribute strings for logging. */
-static struct message attr_str [] =
+static const struct message attr_str [] =
{
{ BGP_ATTR_ORIGIN, "ORIGIN" },
{ BGP_ATTR_AS_PATH, "AS_PATH" },
@@ -61,9 +61,9 @@ static struct message attr_str [] =
{ BGP_ATTR_AS4_AGGREGATOR, "AS4_AGGREGATOR" },
{ BGP_ATTR_AS_PATHLIMIT, "AS_PATHLIMIT" },
};
-int attr_str_max = sizeof(attr_str)/sizeof(attr_str[0]);
+static const int attr_str_max = sizeof(attr_str)/sizeof(attr_str[0]);
-struct hash *cluster_hash;
+static struct hash *cluster_hash;
static void *
cluster_hash_alloc (void *p)
@@ -202,7 +202,7 @@ cluster_init (void)
}
/* Unknown transit attribute. */
-struct hash *transit_hash;
+static struct hash *transit_hash;
static void
transit_free (struct transit *transit)
@@ -282,7 +282,7 @@ transit_init (void)
}
/* Attribute hash routines. */
-struct hash *attrhash;
+static struct hash *attrhash;
static struct attr_extra *
bgp_attr_extra_new (void)
@@ -1256,7 +1256,7 @@ bgp_attr_cluster_list (struct peer *peer, bgp_size_t length,
}
/* Multiprotocol reachability information parse. */
-int
+static int
bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
struct bgp_nlri *mp_update)
{
@@ -1387,7 +1387,7 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr,
}
/* Multiprotocol unreachable parse */
-int
+static int
bgp_mp_unreach_parse (struct peer *peer, bgp_size_t length,
struct bgp_nlri *mp_withdraw)
{
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index 12149a17..c5ce7594 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -176,9 +176,4 @@ extern void cluster_unintern (struct cluster_list *);
/* Transit attribute prototypes. */
void transit_unintern (struct transit *);
-/* Exported for unit-test purposes only */
-extern int bgp_mp_reach_parse (struct peer *, bgp_size_t, struct attr *,
- struct bgp_nlri *);
-extern int bgp_mp_unreach_parse (struct peer *, bgp_size_t, struct bgp_nlri *);
-
#endif /* _QUAGGA_BGP_ATTR_H */
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 45ab3d44..72bb88e6 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -26,7 +26,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_community.h"
/* Hash of community attribute. */
-struct hash *comhash;
+static struct hash *comhash;
/* Allocate a new communities value. */
static struct community *
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index 3283d448..40edb646 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -36,7 +36,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
/* Global variable to access damping configuration */
struct bgp_damp_config bgp_damp_cfg;
-struct bgp_damp_config *damp = &bgp_damp_cfg;
+static struct bgp_damp_config *damp = &bgp_damp_cfg;
/* Utility macro to add and delete BGP dampening information to no
used list. */
@@ -541,7 +541,7 @@ bgp_config_write_damp (struct vty *vty)
VTY_NEWLINE);
}
-char *
+static const char *
bgp_get_reuse_time (unsigned int penalty, char *buf, size_t len)
{
time_t reuse_time = 0;
@@ -613,7 +613,7 @@ bgp_damp_info_vty (struct vty *vty, struct bgp_info *binfo)
vty_out (vty, "%s", VTY_NEWLINE);
}
-char *
+const char *
bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_info *binfo,
char *timebuf, size_t len)
{
diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h
index 8c762960..0b388fbb 100644
--- a/bgpd/bgp_damp.h
+++ b/bgpd/bgp_damp.h
@@ -138,11 +138,10 @@ extern int bgp_damp_update (struct bgp_info *, struct bgp_node *, afi_t, safi_t)
extern int bgp_damp_scan (struct bgp_info *, afi_t, safi_t);
extern void bgp_damp_info_free (struct bgp_damp_info *, int);
extern void bgp_damp_info_clean (void);
-extern char * bgp_get_reuse_time (unsigned int, char*, size_t);
extern int bgp_damp_decay (time_t, int);
extern void bgp_config_write_damp (struct vty *);
extern void bgp_damp_info_vty (struct vty *, struct bgp_info *);
-extern char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *,
- char *, size_t);
+extern const char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *,
+ char *, size_t);
#endif /* _QUAGGA_BGP_DAMP_H */
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index fa316c5e..c2077a59 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -57,7 +57,7 @@ unsigned long term_bgp_debug_normal;
unsigned long term_bgp_debug_zebra;
/* messages for BGP-4 status */
-struct message bgp_status_msg[] =
+const struct message bgp_status_msg[] =
{
{ Idle, "Idle" },
{ Connect, "Connect" },
@@ -68,7 +68,7 @@ struct message bgp_status_msg[] =
{ Clearing, "Clearing" },
{ Deleted, "Deleted" },
};
-int bgp_status_msg_max = BGP_STATUS_MAX;
+const int bgp_status_msg_max = BGP_STATUS_MAX;
/* BGP message type string. */
const char *bgp_type_str[] =
@@ -83,7 +83,7 @@ const char *bgp_type_str[] =
};
/* message for BGP-4 Notify */
-struct message bgp_notify_msg[] =
+static const struct message bgp_notify_msg[] =
{
{ BGP_NOTIFY_HEADER_ERR, "Message Header Error"},
{ BGP_NOTIFY_OPEN_ERR, "OPEN Message Error"},
@@ -93,17 +93,17 @@ struct message bgp_notify_msg[] =
{ BGP_NOTIFY_CEASE, "Cease"},
{ BGP_NOTIFY_CAPABILITY_ERR, "CAPABILITY Message Error"},
};
-int bgp_notify_msg_max = BGP_NOTIFY_MAX;
+static const int bgp_notify_msg_max = BGP_NOTIFY_MAX;
-struct message bgp_notify_head_msg[] =
+static const struct message bgp_notify_head_msg[] =
{
{ BGP_NOTIFY_HEADER_NOT_SYNC, "/Connection Not Synchronized"},
{ BGP_NOTIFY_HEADER_BAD_MESLEN, "/Bad Message Length"},
{ BGP_NOTIFY_HEADER_BAD_MESTYPE, "/Bad Message Type"}
};
-int bgp_notify_head_msg_max = BGP_NOTIFY_HEADER_MAX;
+static const int bgp_notify_head_msg_max = BGP_NOTIFY_HEADER_MAX;
-struct message bgp_notify_open_msg[] =
+static const struct message bgp_notify_open_msg[] =
{
{ BGP_NOTIFY_OPEN_UNSUP_VERSION, "/Unsupported Version Number" },
{ BGP_NOTIFY_OPEN_BAD_PEER_AS, "/Bad Peer AS"},
@@ -113,9 +113,9 @@ struct message bgp_notify_open_msg[] =
{ BGP_NOTIFY_OPEN_UNACEP_HOLDTIME, "/Unacceptable Hold Time"},
{ BGP_NOTIFY_OPEN_UNSUP_CAPBL, "/Unsupported Capability"},
};
-int bgp_notify_open_msg_max = BGP_NOTIFY_OPEN_MAX;
+static const int bgp_notify_open_msg_max = BGP_NOTIFY_OPEN_MAX;
-struct message bgp_notify_update_msg[] =
+static const struct message bgp_notify_update_msg[] =
{
{ BGP_NOTIFY_UPDATE_MAL_ATTR, "/Malformed Attribute List"},
{ BGP_NOTIFY_UPDATE_UNREC_ATTR, "/Unrecognized Well-known Attribute"},
@@ -129,9 +129,9 @@ struct message bgp_notify_update_msg[] =
{ BGP_NOTIFY_UPDATE_INVAL_NETWORK, "/Invalid Network Field"},
{ BGP_NOTIFY_UPDATE_MAL_AS_PATH, "/Malformed AS_PATH"},
};
-int bgp_notify_update_msg_max = BGP_NOTIFY_UPDATE_MAX;
+static const int bgp_notify_update_msg_max = BGP_NOTIFY_UPDATE_MAX;
-struct message bgp_notify_cease_msg[] =
+static const struct message bgp_notify_cease_msg[] =
{
{ BGP_NOTIFY_CEASE_MAX_PREFIX, "/Maximum Number of Prefixes Reached"},
{ BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN, "/Administratively Shutdown"},
@@ -142,15 +142,15 @@ struct message bgp_notify_cease_msg[] =
{ BGP_NOTIFY_CEASE_COLLISION_RESOLUTION, "/Connection collision resolution"},
{ BGP_NOTIFY_CEASE_OUT_OF_RESOURCE, "/Out of Resource"},
};
-int bgp_notify_cease_msg_max = BGP_NOTIFY_CEASE_MAX;
+static const int bgp_notify_cease_msg_max = BGP_NOTIFY_CEASE_MAX;
-struct message bgp_notify_capability_msg[] =
+static const struct message bgp_notify_capability_msg[] =
{
{ BGP_NOTIFY_CAPABILITY_INVALID_ACTION, "/Invalid Action Value" },
{ BGP_NOTIFY_CAPABILITY_INVALID_LENGTH, "/Invalid Capability Length"},
{ BGP_NOTIFY_CAPABILITY_MALFORMED_CODE, "/Malformed Capability Value"},
};
-int bgp_notify_capability_msg_max = BGP_NOTIFY_CAPABILITY_MAX;
+static const int bgp_notify_capability_msg_max = BGP_NOTIFY_CAPABILITY_MAX;
/* Origin strings. */
const char *bgp_origin_str[] = {"i","e","?"};
diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h
index 71e110ce..ce8547b0 100644
--- a/bgpd/bgp_debug.h
+++ b/bgpd/bgp_debug.h
@@ -122,7 +122,7 @@ extern const char *bgp_type_str[];
extern int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
extern void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
-extern struct message bgp_status_msg[];
-extern int bgp_status_msg_max;
+extern const struct message bgp_status_msg[];
+extern const int bgp_status_msg_max;
#endif /* _QUAGGA_BGP_DEBUG_H */
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index f3bba9e3..d1aa0767 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -30,10 +30,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_aspath.h"
/* Hash of community attribute. */
-struct hash *ecomhash;
+static struct hash *ecomhash;
/* Allocate a new ecommunities. */
-struct ecommunity *
+static struct ecommunity *
ecommunity_new (void)
{
return (struct ecommunity *) XCALLOC (MTYPE_ECOMMUNITY,
diff --git a/bgpd/bgp_ecommunity.h b/bgpd/bgp_ecommunity.h
index 278721c8..5c8deb56 100644
--- a/bgpd/bgp_ecommunity.h
+++ b/bgpd/bgp_ecommunity.h
@@ -67,7 +67,6 @@ struct ecommunity_val
extern void ecommunity_init (void);
extern void ecommunity_free (struct ecommunity *);
-extern struct ecommunity *ecommunity_new (void);
extern struct ecommunity *ecommunity_parse (u_int8_t *, u_short);
extern struct ecommunity *ecommunity_dup (struct ecommunity *);
extern struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 92485731..bf4b66b0 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -901,7 +901,7 @@ bgp_ignore (struct peer *peer)
}
/* Finite State Machine structure */
-struct {
+static const struct {
int (*func) (struct peer *);
int next_state;
} FSM [BGP_STATUS_MAX - 1][BGP_EVENTS_MAX - 1] =
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 2089c6b5..620ca128 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -37,7 +37,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_mplsvpn.h"
/* bgpd options, we use GNU getopt library. */
-struct option longopts[] =
+static const struct option longopts[] =
{
{ "daemon", no_argument, NULL, 'd'},
{ "config_file", required_argument, NULL, 'f'},
@@ -61,7 +61,7 @@ void sighup (void);
void sigint (void);
void sigusr1 (void);
-struct quagga_signal_t bgp_signals[] =
+static struct quagga_signal_t bgp_signals[] =
{
{
.signal = SIGHUP,
@@ -85,7 +85,7 @@ struct quagga_signal_t bgp_signals[] =
char config_default[] = SYSCONFDIR BGP_DEFAULT_CONFIG;
/* Route retain mode flag. */
-int retain_mode = 0;
+static int retain_mode = 0;
/* Master of threads. */
struct thread_master *master;
@@ -94,14 +94,14 @@ struct thread_master *master;
char *config_file = NULL;
/* Process ID saved for use by init system */
-const char *pid_file = PATH_BGPD_PID;
+static const char *pid_file = PATH_BGPD_PID;
/* VTY port number and address. */
int vty_port = BGP_VTY_PORT;
char *vty_addr = NULL;
/* privileges */
-zebra_capabilities_t _caps_p [] =
+static zebra_capabilities_t _caps_p [] =
{
ZCAP_BIND,
ZCAP_NET_RAW,
@@ -316,8 +316,12 @@ main (int argc, char **argv)
return(0);
/* Turn into daemon if daemon_mode is set. */
- if (daemon_mode)
- daemon (0, 0);
+ if (daemon_mode && daemon (0, 0) < 0)
+ {
+ zlog_err("BGPd daemon failed: %s", strerror(errno));
+ return (1);
+ }
+
/* Process ID file creation. */
pid_output (pid_file);
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index a7d75478..3cc55f24 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -371,17 +371,16 @@ int
bgp_socket (struct bgp *bgp, unsigned short port, char *address)
{
int ret, en;
- struct addrinfo req;
struct addrinfo *ainfo;
struct addrinfo *ainfo_save;
+ static const struct addrinfo req = {
+ .ai_family = AF_UNSPEC,
+ .ai_flags = AI_PASSIVE,
+ .ai_socktype = SOCK_STREAM,
+ };
int sock = 0;
char port_str[BUFSIZ];
- memset (&req, 0, sizeof (struct addrinfo));
-
- req.ai_flags = AI_PASSIVE;
- req.ai_family = AF_UNSPEC;
- req.ai_socktype = SOCK_STREAM;
snprintf (port_str, sizeof(port_str), "%d", port);
port_str[sizeof (port_str) - 1] = '\0';
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 84d8191e..37595817 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -194,20 +194,22 @@ bgp_capability_orf_not_support (struct peer *peer, afi_t afi, safi_t safi,
peer->host, afi, safi, type, mode);
}
-static struct message orf_type_str[] =
+static const struct message orf_type_str[] =
{
{ ORF_TYPE_PREFIX, "Prefixlist" },
{ ORF_TYPE_PREFIX_OLD, "Prefixlist (old)" },
};
-static int orf_type_str_max = sizeof(orf_type_str)/sizeof(orf_type_str[0]);
+static const int orf_type_str_max
+ = sizeof(orf_type_str)/sizeof(orf_type_str[0]);
-static struct message orf_mode_str[] =
+static const struct message orf_mode_str[] =
{
{ ORF_MODE_RECEIVE, "Receive" },
{ ORF_MODE_SEND, "Send" },
{ ORF_MODE_BOTH, "Both" },
};
-static int orf_mode_str_max = sizeof(orf_mode_str)/sizeof(orf_mode_str[0]);
+static const int orf_mode_str_max
+ = sizeof(orf_mode_str)/sizeof(orf_mode_str[0]);
static int
bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
@@ -441,7 +443,7 @@ bgp_capability_as4 (struct peer *peer, struct capability_header *hdr)
return as4;
}
-static struct message capcode_str[] =
+static const struct message capcode_str[] =
{
{ CAPABILITY_CODE_MP, "MultiProtocol Extensions" },
{ CAPABILITY_CODE_REFRESH, "Route Refresh" },
@@ -452,10 +454,10 @@ static struct message capcode_str[] =
{ CAPABILITY_CODE_REFRESH_OLD, "Route Refresh (Old)" },
{ CAPABILITY_CODE_ORF_OLD, "ORF (Old)" },
};
-int capcode_str_max = sizeof(capcode_str)/sizeof(capcode_str[0]);
+static const int capcode_str_max = sizeof(capcode_str)/sizeof(capcode_str[0]);
/* Minimum sizes for length field of each cap (so not inc. the header) */
-static size_t cap_minsizes[] =
+static const size_t cap_minsizes[] =
{
[CAPABILITY_CODE_MP] = sizeof (struct capability_mp_data),
[CAPABILITY_CODE_REFRESH] = CAPABILITY_CODE_REFRESH_LEN,
@@ -529,7 +531,8 @@ bgp_capability_parse (struct peer *peer, size_t length, u_char **error)
" expected at least %u",
peer->host,
LOOKUP (capcode_str, caphdr.code),
- caphdr.length, cap_minsizes[caphdr.code]);
+ caphdr.length,
+ (unsigned) cap_minsizes[caphdr.code]);
bgp_notify_send (peer, BGP_NOTIFY_CEASE, 0);
return -1;
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index e492c599..00ddae13 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -2211,7 +2211,7 @@ bgp_capability_msg_parse (struct peer *peer, u_char *pnt, bgp_size_t length)
}
/* Dynamic Capability is received. */
-int
+static int
bgp_capability_receive (struct peer *peer, bgp_size_t size)
{
u_char *pnt;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 80ae0793..1e9c8dce 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2812,19 +2812,6 @@ bgp_clear_route (struct peer *peer, afi_t afi, safi_t safi)
*/
if (!peer->clear_node_queue->thread)
bgp_clear_node_complete (peer->clear_node_queue);
- else
- {
- /* clearing queue scheduled. Normal if in Established state
- * (and about to transition out of it), but otherwise...
- */
- if (peer->status != Established)
- {
- plog_err (peer->log, "%s [Error] State %s is not Established,"
- " but routes were cleared - bug!",
- peer->host, LOOKUP (bgp_status_msg, peer->status));
- assert (peer->status == Established);
- }
- }
}
void
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 6f44f1fd..58ceef1b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1047,7 +1047,7 @@ peer_deactivate (struct peer *peer, afi_t afi, safi_t safi)
return 0;
}
-void
+static void
peer_nsf_stop (struct peer *peer)
{
afi_t afi;
@@ -2157,7 +2157,7 @@ struct peer_flag_action
u_char peer_down;
};
-struct peer_flag_action peer_flag_action_list[] =
+static const struct peer_flag_action peer_flag_action_list[] =
{
{ PEER_FLAG_PASSIVE, 0, peer_change_reset },
{ PEER_FLAG_SHUTDOWN, 0, peer_change_reset },
@@ -2169,7 +2169,7 @@ struct peer_flag_action peer_flag_action_list[] =
{ 0, 0, 0 }
};
-struct peer_flag_action peer_af_flag_action_list[] =
+static const struct peer_flag_action peer_af_flag_action_list[] =
{
{ PEER_FLAG_NEXTHOP_SELF, 1, peer_change_reset_out },
{ PEER_FLAG_SEND_COMMUNITY, 1, peer_change_reset_out },
@@ -2190,14 +2190,14 @@ struct peer_flag_action peer_af_flag_action_list[] =
/* Proper action set. */
static int
-peer_flag_action_set (struct peer_flag_action *action_list, int size,
+peer_flag_action_set (const struct peer_flag_action *action_list, int size,
struct peer_flag_action *action, u_int32_t flag)
{
int i;
int found = 0;
int reset_in = 0;
int reset_out = 0;
- struct peer_flag_action *match = NULL;
+ const struct peer_flag_action *match = NULL;
/* Check peer's frag action. */
for (i = 0; i < size; i++)
@@ -2951,12 +2951,14 @@ peer_port_set (struct peer *peer, u_int16_t port)
return 0;
}
+#ifdef unused
int
peer_port_unset (struct peer *peer)
{
peer->port = BGP_PORT_DEFAULT;
return 0;
}
+#endif
/* neighbor weight. */
int
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 84164593..1e72b1c9 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1016,6 +1016,4 @@ extern int peer_maximum_prefix_unset (struct peer *, afi_t, safi_t);
extern int peer_clear (struct peer *);
extern int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
-extern void peer_nsf_stop (struct peer *);
-
#endif /* _QUAGGA_BGPD_H */
diff --git a/lib/log.c b/lib/log.c
index f7a36851..8c3e2ddc 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -771,7 +771,7 @@ lookup (const struct message *mes, int key)
* provided otherwise.
*/
const char *
-mes_lookup (struct message *meslist, int max, int index, const char *none)
+mes_lookup (const struct message *meslist, int max, int index, const char *none)
{
int pos = index - meslist[0].key;
diff --git a/lib/log.h b/lib/log.h
index 86097919..2dd1d313 100644
--- a/lib/log.h
+++ b/lib/log.h
@@ -151,7 +151,7 @@ extern int zlog_rotate (struct zlog *);
#define LOOKUP(x, y) mes_lookup(x, x ## _max, y, "(no item found)")
extern const char *lookup (const struct message *, int);
-extern const char *mes_lookup (struct message *meslist,
+extern const char *mes_lookup (const struct message *meslist,
int max, int index,
const char *no_item);
diff --git a/lib/smux.c b/lib/smux.c
index 54cd3e7f..d5378897 100644
--- a/lib/smux.c
+++ b/lib/smux.c
@@ -83,7 +83,7 @@ static struct cmd_node smux_node =
static struct thread_master *master;
void *
-oid_copy (void *dest, void *src, size_t size)
+oid_copy (void *dest, const void *src, size_t size)
{
return memcpy (dest, src, size * sizeof (oid));
}
@@ -157,7 +157,7 @@ oid_compare_part (oid *o1, int o1_len, oid *o2, int o2_len)
}
static void
-smux_oid_dump (const char *prefix, oid *oid, size_t oid_len)
+smux_oid_dump (const char *prefix, const oid *oid, size_t oid_len)
{
unsigned int i;
int first = 1;
@@ -174,7 +174,7 @@ smux_oid_dump (const char *prefix, oid *oid, size_t oid_len)
}
static int
-smux_socket ()
+smux_socket (void)
{
int ret;
#ifdef HAVE_IPV6
@@ -995,9 +995,9 @@ smux_open (int sock)
}
int
-smux_trap (oid *name, size_t namelen,
- oid *iname, size_t inamelen,
- struct trap_object *trapobj, size_t trapobjlen,
+smux_trap (const oid *name, size_t namelen,
+ const oid *iname, size_t inamelen,
+ const struct trap_object *trapobj, size_t trapobjlen,
unsigned int tick, u_char sptrap)
{
unsigned int i;
@@ -1234,7 +1234,7 @@ smux_connect (struct thread *t)
/* Clear all SMUX related resources. */
static void
-smux_stop ()
+smux_stop (void)
{
if (smux_read_thread)
{
@@ -1395,7 +1395,7 @@ smux_header_generic (struct variable *v, oid *name, size_t *length, int exact,
}
static int
-smux_peer_default ()
+smux_peer_default (void)
{
if (smux_oid)
{
diff --git a/lib/smux.h b/lib/smux.h
index 87a76648..a32a3958 100644
--- a/lib/smux.h
+++ b/lib/smux.h
@@ -150,11 +150,12 @@ extern void smux_register_mib(const char *, struct variable *,
size_t, int, oid [], size_t);
extern int smux_header_generic (struct variable *, oid [], size_t *,
int, size_t *, WriteMethod **);
-extern int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *,
+extern int smux_trap (const oid *, size_t, const oid *, size_t,
+ const struct trap_object *,
size_t, unsigned int, u_char);
extern int oid_compare (oid *, int, oid *, int);
extern void oid2in_addr (oid [], int, struct in_addr *);
-extern void *oid_copy (void *, void *, size_t);
+extern void *oid_copy (void *, const void *, size_t);
extern void oid_copy_addr (oid [], struct in_addr *, int);
#endif /* _ZEBRA_SNMP_H */
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index de9ef055..e65b2e33 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -42,7 +42,7 @@
#include "ospfd/ospf_packet.h"
#include "ospfd/ospf_network.h"
-struct message ospf_ism_state_msg[] =
+const struct message ospf_ism_state_msg[] =
{
{ ISM_DependUpon, "DependUpon" },
{ ISM_Down, "Down" },
@@ -53,9 +53,9 @@ struct message ospf_ism_state_msg[] =
{ ISM_Backup, "Backup" },
{ ISM_DR, "DR" },
};
-int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
+const int ospf_ism_state_msg_max = OSPF_ISM_STATE_MAX;
-struct message ospf_nsm_state_msg[] =
+const struct message ospf_nsm_state_msg[] =
{
{ NSM_DependUpon, "DependUpon" },
{ NSM_Deleted, "Deleted" },
@@ -68,9 +68,9 @@ struct message ospf_nsm_state_msg[] =
{ NSM_Loading, "Loading" },
{ NSM_Full, "Full" },
};
-int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
+const int ospf_nsm_state_msg_max = OSPF_NSM_STATE_MAX;
-struct message ospf_lsa_type_msg[] =
+const struct message ospf_lsa_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "unknown" },
{ OSPF_ROUTER_LSA, "router-LSA" },
@@ -85,9 +85,9 @@ struct message ospf_lsa_type_msg[] =
{ OSPF_OPAQUE_AREA_LSA, "Area-Local Opaque-LSA" },
{ OSPF_OPAQUE_AS_LSA, "AS-external Opaque-LSA" },
};
-int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
+const int ospf_lsa_type_msg_max = OSPF_MAX_LSA;
-struct message ospf_link_state_id_type_msg[] =
+const struct message ospf_link_state_id_type_msg[] =
{
{ OSPF_UNKNOWN_LSA, "(unknown)" },
{ OSPF_ROUTER_LSA, "" },
@@ -102,9 +102,9 @@ struct message ospf_link_state_id_type_msg[] =
{ OSPF_OPAQUE_AREA_LSA, "(Area-Local Opaque-Type/ID)" },
{ OSPF_OPAQUE_AS_LSA, "(AS-external Opaque-Type/ID)" },
};
-int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
+const int ospf_link_state_id_type_msg_max = OSPF_MAX_LSA;
-struct message ospf_network_type_msg[] =
+const struct message ospf_network_type_msg[] =
{
{ OSPF_IFTYPE_NONE, "NONE" },
{ OSPF_IFTYPE_POINTOPOINT, "Point-to-Point" },
@@ -113,7 +113,7 @@ struct message ospf_network_type_msg[] =
{ OSPF_IFTYPE_POINTOMULTIPOINT, "Point-to-MultiPoint" },
{ OSPF_IFTYPE_VIRTUALLINK, "Virtual-Link" },
};
-int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
+const int ospf_network_type_msg_max = OSPF_IFTYPE_MAX;
/* Configuration debug option variables. */
unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index f6a7fd8a..7c2698dc 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -1024,13 +1024,13 @@ ospf_remove_vls_through_area (struct ospf *ospf, struct ospf_area *area)
}
-struct message ospf_area_type_msg[] =
+static const struct message ospf_area_type_msg[] =
{
{ OSPF_AREA_DEFAULT, "Default" },
{ OSPF_AREA_STUB, "Stub" },
{ OSPF_AREA_NSSA, "NSSA" },
};
-int ospf_area_type_msg_max = OSPF_AREA_TYPE_MAX;
+static const int ospf_area_type_msg_max = OSPF_AREA_TYPE_MAX;
static void
ospf_area_type_set (struct ospf_area *area, int type)
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 6a60e86f..6ba19162 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -535,17 +535,17 @@ struct ospf_nbr_nbma
/* Extern variables. */
extern struct ospf_master *om;
-extern struct message ospf_ism_state_msg[];
-extern struct message ospf_nsm_state_msg[];
-extern struct message ospf_lsa_type_msg[];
-extern struct message ospf_link_state_id_type_msg[];
-extern struct message ospf_network_type_msg[];
-extern int ospf_ism_state_msg_max;
-extern int ospf_nsm_state_msg_max;
-extern int ospf_lsa_type_msg_max;
-extern int ospf_link_state_id_type_msg_max;
-extern int ospf_redistributed_proto_max;
-extern int ospf_network_type_msg_max;
+extern const struct message ospf_ism_state_msg[];
+extern const struct message ospf_nsm_state_msg[];
+extern const struct message ospf_lsa_type_msg[];
+extern const struct message ospf_link_state_id_type_msg[];
+extern const struct message ospf_network_type_msg[];
+extern const int ospf_ism_state_msg_max;
+extern const int ospf_nsm_state_msg_max;
+extern const int ospf_lsa_type_msg_max;
+extern const int ospf_link_state_id_type_msg_max;
+extern const int ospf_redistributed_proto_max;
+extern const int ospf_network_type_msg_max;
extern struct zclient *zclient;
extern struct thread_master *master;
extern int ospf_zlog;
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 045e42cb..dc298687 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -161,7 +161,7 @@ const struct message rtm_type_str[] =
{0, NULL}
};
-struct message rtm_flag_str[] =
+static const struct message rtm_flag_str[] =
{
{RTF_UP, "UP"},
{RTF_GATEWAY, "GATEWAY"},