diff --git a/conf/conf.h b/conf/conf.h index 0dea4f94..34c6818d 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -27,7 +27,7 @@ struct config { list symbols; /* Configured symbols in config order */ int mrtdump_file; /* Configured MRTDump file (sysdep, fd in unix) */ - char *syslog_name; /* Name used for syslog (NULL -> no syslog) */ + const char *syslog_name; /* Name used for syslog (NULL -> no syslog) */ struct rtable_config *def_tables[NET_MAX]; /* Default routing tables for each network */ struct iface_patt *router_id_from; /* Configured list of router ID iface patterns */ diff --git a/conf/confbase.Y b/conf/confbase.Y index 75158927..8b22f236 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -60,7 +60,7 @@ CF_DECLS net_addr net; net_addr *net_ptr; struct symbol *s; - char *t; + const char *t; struct rtable_config *r; struct channel_config *cc; struct f_inst *x; diff --git a/filter/data.h b/filter/data.h index dd9830df..4ebce73b 100644 --- a/filter/data.h +++ b/filter/data.h @@ -72,7 +72,7 @@ struct f_val { lcomm lc; ip_addr ip; const net_addr *net; - char *s; + const char *s; const struct f_tree *t; const struct f_trie *ti; const struct adata *ad; diff --git a/lib/socket.h b/lib/socket.h index f2b0c042..96fedeeb 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -76,7 +76,7 @@ typedef struct birdsock { int rcv_ttl; /* TTL of last received datagram */ node n; void *rbuf_alloc, *tbuf_alloc; - char *password; /* Password for MD5 authentication */ + const char *password; /* Password for MD5 authentication */ const char *err; /* Error message */ struct ssh_sock *ssh; /* Used in SK_SSH */ } sock; @@ -106,7 +106,7 @@ int sk_leave_group(sock *s, ip_addr maddr); /* Leave multicast group on sk iface int sk_setup_broadcast(sock *s); int sk_set_ttl(sock *s, int ttl); /* Set transmit TTL for given socket */ int sk_set_min_ttl(sock *s, int ttl); /* Set minimal accepted TTL for given socket */ -int sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, int pxlen, struct iface *ifa, char *passwd, int setkey); +int sk_set_md5_auth(sock *s, ip_addr local, ip_addr remote, int pxlen, struct iface *ifa, const char *passwd, int setkey); int sk_set_ipv6_checksum(sock *s, int offset); int sk_set_icmp6_filter(sock *s, int p1, int p2); void sk_log_error(sock *s, const char *p); diff --git a/lib/timer.c b/lib/timer.c index ddf41340..be695114 100644 --- a/lib/timer.c +++ b/lib/timer.c @@ -253,7 +253,7 @@ timer_init(void) * type &btime. */ btime -tm_parse_time(char *x) +tm_parse_time(const char *x) { struct tm tm; int usec, n1, n2, n3, r; diff --git a/lib/timer.h b/lib/timer.h index 3b99825f..c5ea430c 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -106,7 +106,7 @@ void timer_init(void); struct timeformat { - char *fmt1, *fmt2; + const char *fmt1, *fmt2; btime limit; }; @@ -120,7 +120,7 @@ struct timeformat { #define TM_DATETIME_BUFFER_SIZE 32 /* Buffer size required by tm_format_time() */ -btime tm_parse_time(char *x); +btime tm_parse_time(const char *x); void tm_format_time(char *x, struct timeformat *fmt, btime t); int tm_format_real_time(char *x, size_t max, const char *fmt, btime t); diff --git a/nest/iface.c b/nest/iface.c index 00dfc2ca..46a49f8f 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -444,7 +444,7 @@ if_find_by_index(unsigned idx) * if no such structure exists. */ struct iface * -if_find_by_name(char *name) +if_find_by_name(const char *name) { struct iface *i; @@ -455,7 +455,7 @@ if_find_by_name(char *name) } struct iface * -if_get_by_name(char *name) +if_get_by_name(const char *name) { struct iface *i; @@ -725,7 +725,7 @@ iface_patt_match(struct iface_patt *ifp, struct iface *i, struct ifa *a) WALK_LIST(p, ifp->ipn_list) { - char *t = p->pattern; + const char *t = p->pattern; int pos = p->positive; if (t) diff --git a/nest/iface.h b/nest/iface.h index 0eb277cd..b9796283 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -115,8 +115,8 @@ void if_end_update(void); void if_flush_ifaces(struct proto *p); void if_feed_baby(struct proto *); struct iface *if_find_by_index(unsigned); -struct iface *if_find_by_name(char *); -struct iface *if_get_by_name(char *); +struct iface *if_find_by_name(const char *); +struct iface *if_get_by_name(const char *); void if_recalc_all_preferred_addresses(void); @@ -160,7 +160,7 @@ void neigh_init(struct pool *); struct iface_patt_node { node n; int positive; - byte *pattern; + const byte *pattern; net_addr prefix; }; diff --git a/nest/password.h b/nest/password.h index c4017848..8a0da223 100644 --- a/nest/password.h +++ b/nest/password.h @@ -12,7 +12,7 @@ struct password_item { node n; - char *password; /* Key data, null terminated */ + const char *password; /* Key data, null terminated */ uint length; /* Key length, without null */ uint id; /* Key ID */ uint alg; /* MAC algorithm */ diff --git a/nest/proto.c b/nest/proto.c index 6051ba9d..85090424 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -893,7 +893,7 @@ proto_copy_config(struct proto_config *dest, struct proto_config *src) struct channel_config *cc; node old_node; int old_class; - char *old_name; + const char *old_name; if (dest->protocol != src->protocol) cf_error("Can't copy configuration from a different protocol type"); @@ -2013,7 +2013,7 @@ proto_cmd_mrtdump(struct proto *p, uintptr_t mask, int cnt UNUSED) } static void -proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg) +proto_apply_cmd_symbol(const struct symbol *s, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg) { if (s->class != SYM_PROTO) { @@ -2026,7 +2026,7 @@ proto_apply_cmd_symbol(struct symbol *s, void (* cmd)(struct proto *, uintptr_t, } static void -proto_apply_cmd_patt(char *patt, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg) +proto_apply_cmd_patt(const char *patt, void (* cmd)(struct proto *, uintptr_t, int), uintptr_t arg) { struct proto *p; int cnt = 0; diff --git a/nest/protocol.h b/nest/protocol.h index e4ec7fa2..e97e59dd 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -115,8 +115,8 @@ struct proto_config { struct protocol *protocol; /* Protocol */ struct proto *proto; /* Instance we've created */ struct proto_config *parent; /* Parent proto_config for dynamic protocols */ - char *name; - char *dsc; + const char *name; + const char *dsc; int class; /* SYM_PROTO or SYM_TEMPLATE */ u8 net_type; /* Protocol network type (NET_*), 0 for undefined */ u8 disabled; /* Protocol enabled/disabled by default */ @@ -171,7 +171,7 @@ struct proto { struct rte_src *main_source; /* Primary route source */ struct iface *vrf; /* Related VRF instance, NULL if global */ - char *name; /* Name of this instance (== cf->name) */ + const char *name; /* Name of this instance (== cf->name) */ u32 debug; /* Debugging flags */ u32 mrtdump; /* MRTDump flags */ uint active_channels; /* Number of active channels */ @@ -245,7 +245,7 @@ struct proto { }; struct proto_spec { - void *ptr; + const void *ptr; int patt; }; diff --git a/proto/babel/babel.c b/proto/babel/babel.c index 177ff3a3..a915e8fa 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -1874,7 +1874,7 @@ babel_get_attr(eattr *a, byte *buf, int buflen UNUSED) } void -babel_show_interfaces(struct proto *P, char *iff) +babel_show_interfaces(struct proto *P, const char *iff) { struct babel_proto *p = (void *) P; struct babel_iface *ifa = NULL; @@ -1912,7 +1912,7 @@ babel_show_interfaces(struct proto *P, char *iff) } void -babel_show_neighbors(struct proto *P, char *iff) +babel_show_neighbors(struct proto *P, const char *iff) { struct babel_proto *p = (void *) P; struct babel_iface *ifa = NULL; diff --git a/proto/babel/babel.h b/proto/babel/babel.h index 14765c60..e075024c 100644 --- a/proto/babel/babel.h +++ b/proto/babel/babel.h @@ -368,8 +368,8 @@ void babel_handle_update(union babel_msg *msg, struct babel_iface *ifa); void babel_handle_route_request(union babel_msg *msg, struct babel_iface *ifa); void babel_handle_seqno_request(union babel_msg *msg, struct babel_iface *ifa); -void babel_show_interfaces(struct proto *P, char *iff); -void babel_show_neighbors(struct proto *P, char *iff); +void babel_show_interfaces(struct proto *P, const char *iff); +void babel_show_neighbors(struct proto *P, const char *iff); void babel_show_entries(struct proto *P); void babel_show_routes(struct proto *P); diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h index 03b92bd8..dc63e13e 100644 --- a/proto/bgp/bgp.h +++ b/proto/bgp/bgp.h @@ -125,9 +125,9 @@ struct bgp_config { unsigned disable_after_error; /* Disable the protocol when error is detected */ u32 disable_after_cease; /* Disable it when cease is received, bitfield */ - char *password; /* Password used for MD5 authentication */ + const char *password; /* Password used for MD5 authentication */ net_addr *remote_range; /* Allowed neighbor range for dynamic BGP */ - char *dynamic_name; /* Name pattern for dynamic BGP */ + const char *dynamic_name; /* Name pattern for dynamic BGP */ int dynamic_name_digits; /* Minimum number of digits for dynamic names */ int check_link; /* Use iface link state for liveness detection */ int bfd; /* Use BFD for liveness detection */ diff --git a/proto/mrt/mrt.h b/proto/mrt/mrt.h index 4dfb1b19..4ff94c12 100644 --- a/proto/mrt/mrt.h +++ b/proto/mrt/mrt.h @@ -42,7 +42,7 @@ struct mrt_dump_data { const char *table_expr; struct rtable *table_ptr; const struct filter *filter; - char *filename; + const char *filename; }; struct mrt_peer_entry { diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 63ff9e56..29610f4a 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -791,7 +791,7 @@ ospf_reconfigure(struct proto *P, struct proto_config *CF) void -ospf_sh_neigh(struct proto *P, char *iff) +ospf_sh_neigh(struct proto *P, const char *iff) { struct ospf_proto *p = (struct ospf_proto *) P; struct ospf_iface *ifa = NULL; @@ -900,7 +900,7 @@ ospf_sh(struct proto *P) } void -ospf_sh_iface(struct proto *P, char *iff) +ospf_sh_iface(struct proto *P, const char *iff) { struct ospf_proto *p = (struct ospf_proto *) P; struct ospf_iface *ifa = NULL; diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h index 8318ee95..d0286f72 100644 --- a/proto/ospf/ospf.h +++ b/proto/ospf/ospf.h @@ -990,9 +990,9 @@ static inline int oa_is_nssa(struct ospf_area *oa) void ospf_stop_gr_recovery(struct ospf_proto *p); -void ospf_sh_neigh(struct proto *P, char *iff); +void ospf_sh_neigh(struct proto *P, const char *iff); void ospf_sh(struct proto *P); -void ospf_sh_iface(struct proto *P, char *iff); +void ospf_sh_iface(struct proto *P, const char *iff); void ospf_sh_state(struct proto *P, int verbose, int reachable); void ospf_sh_lsadb(struct lsadb_show_data *ld); diff --git a/proto/radv/packets.c b/proto/radv/packets.c index 3139d321..5cd8b2de 100644 --- a/proto/radv/packets.c +++ b/proto/radv/packets.c @@ -173,8 +173,8 @@ radv_process_domain(struct radv_dnssl_config *cf) { /* Format of domain in search list is