diff options
author | Maria Matejka <mq@jmq.cz> | 2020-04-08 22:25:15 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2020-04-09 15:37:14 +0200 |
commit | fd9f0c0640fd02a26b96b4f9d3cbbffbb6544a84 (patch) | |
tree | 3cfac115f49d41f3d62d41c4ddfffe50f2c381a4 | |
parent | a109056145a6bc8a6b498ecb6e309ebc143c8b3c (diff) |
Configuration strings are constant.
This is merely a const propagation. There was no problem in there.
-rw-r--r-- | conf/conf.h | 2 | ||||
-rw-r--r-- | conf/confbase.Y | 2 | ||||
-rw-r--r-- | filter/data.h | 2 | ||||
-rw-r--r-- | lib/socket.h | 4 | ||||
-rw-r--r-- | lib/timer.c | 2 | ||||
-rw-r--r-- | lib/timer.h | 4 | ||||
-rw-r--r-- | nest/iface.c | 6 | ||||
-rw-r--r-- | nest/iface.h | 6 | ||||
-rw-r--r-- | nest/password.h | 2 | ||||
-rw-r--r-- | nest/proto.c | 6 | ||||
-rw-r--r-- | nest/protocol.h | 8 | ||||
-rw-r--r-- | proto/babel/babel.c | 4 | ||||
-rw-r--r-- | proto/babel/babel.h | 4 | ||||
-rw-r--r-- | proto/bgp/bgp.h | 4 | ||||
-rw-r--r-- | proto/mrt/mrt.h | 2 | ||||
-rw-r--r-- | proto/ospf/ospf.c | 4 | ||||
-rw-r--r-- | proto/ospf/ospf.h | 4 | ||||
-rw-r--r-- | proto/radv/packets.c | 4 | ||||
-rw-r--r-- | proto/radv/radv.h | 2 | ||||
-rw-r--r-- | proto/rip/rip.c | 4 | ||||
-rw-r--r-- | proto/rip/rip.h | 4 | ||||
-rw-r--r-- | sysdep/bsd/setkey.h | 4 | ||||
-rw-r--r-- | sysdep/bsd/sysio.h | 2 | ||||
-rw-r--r-- | sysdep/linux/sysio.h | 2 | ||||
-rw-r--r-- | sysdep/unix/io.c | 2 | ||||
-rw-r--r-- | sysdep/unix/log.c | 4 | ||||
-rw-r--r-- | sysdep/unix/main.c | 8 | ||||
-rw-r--r-- | sysdep/unix/unix.h | 12 |
28 files changed, 57 insertions, 57 deletions
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 <size> <label> <size> <label> ... 0 */ - char *dom = cf->domain; - char *dom_end = dom; /* Just to */ + const char *dom = cf->domain; + const char *dom_end = dom; /* Just to */ u8 *dlen_save = &cf->dlen_first; uint len; diff --git a/proto/radv/radv.h b/proto/radv/radv.h index 2c8ad7d4..14d40f8a 100644 --- a/proto/radv/radv.h +++ b/proto/radv/radv.h @@ -119,7 +119,7 @@ struct radv_dnssl_config u16 lifetime_mult; /* Lifetime specified as multiple of max_ra_int */ u8 dlen_first; /* Length of first label in domain */ u8 dlen_all; /* Both dlen_ filled in radv_process_domain() */ - char *domain; /* Domain for DNS search list, in processed form */ + const char *domain; /* Domain for DNS search list, in processed form */ }; /* diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 25ee16fd..f02d5071 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -1208,7 +1208,7 @@ rip_get_attr(eattr *a, byte *buf, int buflen UNUSED) } void -rip_show_interfaces(struct proto *P, char *iff) +rip_show_interfaces(struct proto *P, const char *iff) { struct rip_proto *p = (void *) P; struct rip_iface *ifa = NULL; @@ -1246,7 +1246,7 @@ rip_show_interfaces(struct proto *P, char *iff) } void -rip_show_neighbors(struct proto *P, char *iff) +rip_show_neighbors(struct proto *P, const char *iff) { struct rip_proto *p = (void *) P; struct rip_iface *ifa = NULL; diff --git a/proto/rip/rip.h b/proto/rip/rip.h index 76294624..8d347000 100644 --- a/proto/rip/rip.h +++ b/proto/rip/rip.h @@ -221,8 +221,8 @@ void rip_withdraw_rte(struct rip_proto *p, net_addr *n, struct rip_neighbor *fro void rip_flush_table(struct rip_proto *p, struct rip_neighbor *n); struct rip_neighbor * rip_get_neighbor(struct rip_proto *p, ip_addr *a, struct rip_iface *ifa); void rip_update_bfd(struct rip_proto *p, struct rip_neighbor *n); -void rip_show_interfaces(struct proto *P, char *iff); -void rip_show_neighbors(struct proto *P, char *iff); +void rip_show_interfaces(struct proto *P, const char *iff); +void rip_show_neighbors(struct proto *P, const char *iff); /* packets.c */ void rip_send_request(struct rip_proto *p, struct rip_iface *ifa); diff --git a/sysdep/bsd/setkey.h b/sysdep/bsd/setkey.h index 40564cf1..b7a11283 100644 --- a/sysdep/bsd/setkey.h +++ b/sysdep/bsd/setkey.h @@ -63,7 +63,7 @@ setkey_send(struct sadb_msg *msg, uint len) * operations to implement replace. */ static int -setkey_md5(sockaddr *src, uint slen, sockaddr *dst, uint dlen, char *passwd, uint type) +setkey_md5(sockaddr *src, uint slen, sockaddr *dst, uint dlen, const char *passwd, uint type) { uint passwd_len = passwd ? strlen(passwd) : 0; @@ -146,7 +146,7 @@ setkey_md5(sockaddr *src, uint slen, sockaddr *dst, uint dlen, char *passwd, uin * Manipulation with the IPsec SA/SP database */ static int -sk_set_md5_in_sasp_db(sock *s, ip_addr local, ip_addr remote, int pxlen, struct iface *ifa, char *passwd) +sk_set_md5_in_sasp_db(sock *s, ip_addr local, ip_addr remote, int pxlen, struct iface *ifa, const char *passwd) { sockaddr src, dst; sockaddr_fill(&src, s->af, local, ifa, 0); diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h index 929bfaf6..c757960a 100644 --- a/sysdep/bsd/sysio.h +++ b/sysdep/bsd/sysio.h @@ -210,7 +210,7 @@ sk_prepare_ip_header(sock *s, void *hdr, int dlen) #endif int -sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, int pxlen UNUSED, struct iface *ifa UNUSED, char *passwd, int setkey UNUSED) +sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote UNUSED, int pxlen UNUSED, struct iface *ifa UNUSED, const char *passwd, int setkey UNUSED) { #ifdef USE_MD5SIG_SETKEY if (setkey) diff --git a/sysdep/linux/sysio.h b/sysdep/linux/sysio.h index 8c3efd6e..e21ff487 100644 --- a/sysdep/linux/sysio.h +++ b/sysdep/linux/sysio.h @@ -162,7 +162,7 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen) */ int -sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote, int pxlen, struct iface *ifa, char *passwd, int setkey UNUSED) +sk_set_md5_auth(sock *s, ip_addr local UNUSED, ip_addr remote, int pxlen, struct iface *ifa, const char *passwd, int setkey UNUSED) { struct tcp_md5sig_ext md5; diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index f4e45a5f..f6cc0e32 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -91,7 +91,7 @@ static struct resclass rf_class = { }; struct rfile * -rf_open(pool *p, char *name, char *mode) +rf_open(pool *p, const char *name, const char *mode) { FILE *f = fopen(name, mode); diff --git a/sysdep/unix/log.c b/sysdep/unix/log.c index 18894f98..e24322c6 100644 --- a/sysdep/unix/log.c +++ b/sysdep/unix/log.c @@ -332,7 +332,7 @@ debug(const char *msg, ...) } static list * -default_log_list(int initial, char **syslog_name) +default_log_list(int initial, const char **syslog_name) { static list log_list; init_list(&log_list); @@ -365,7 +365,7 @@ default_log_list(int initial, char **syslog_name) } void -log_switch(int initial, list *logs, char *new_syslog_name) +log_switch(int initial, list *logs, const char *new_syslog_name) { struct log_config *l; diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 5209b9b3..1d258f4c 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -190,7 +190,7 @@ sysdep_commit(struct config *new, struct config *old UNUSED) } static int -unix_read_config(struct config **cp, char *name) +unix_read_config(struct config **cp, const char *name) { struct config *conf = config_alloc(name); int ret; @@ -240,7 +240,7 @@ async_config(void) } static struct config * -cmd_read_config(char *name) +cmd_read_config(const char *name) { struct config *conf; @@ -262,7 +262,7 @@ cmd_read_config(char *name) } void -cmd_check_config(char *name) +cmd_check_config(const char *name) { struct config *conf = cmd_read_config(name); if (!conf) @@ -303,7 +303,7 @@ cmd_reconfig_undo_notify(void) } void -cmd_reconfig(char *name, int type, uint timeout) +cmd_reconfig(const char *name, int type, uint timeout) { if (cli_access_restricted()) return; diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h index bd817bf2..8244fc86 100644 --- a/sysdep/unix/unix.h +++ b/sysdep/unix/unix.h @@ -23,8 +23,8 @@ extern char *bird_name; void async_config(void); void async_dump(void); void async_shutdown(void); -void cmd_check_config(char *name); -void cmd_reconfig(char *name, int type, uint timeout); +void cmd_check_config(const char *name); +void cmd_reconfig(const char *name, int type, uint timeout); void cmd_reconfig_confirm(void); void cmd_reconfig_undo(void); void cmd_reconfig_status(void); @@ -106,7 +106,7 @@ void io_init(void); void io_loop(void); void io_log_dump(void); int sk_open_unix(struct birdsock *s, char *name); -struct rfile *rf_open(struct pool *, char *name, char *mode); +struct rfile *rf_open(struct pool *, const char *name, const char *mode); void *rf_file(struct rfile *f); int rf_fileno(struct rfile *f); void test_old_bird(char *path); @@ -119,15 +119,15 @@ void krt_io_init(void); void main_thread_init(void); void log_init_debug(char *); /* Initialize debug dump to given file (NULL=stderr, ""=off) */ -void log_switch(int initial, list *l, char *); +void log_switch(int initial, list *l, const char *); struct log_config { node n; uint mask; /* Classes to log */ void *fh; /* FILE to log to, NULL=syslog */ struct rfile *rf; /* Resource for log file */ - char *filename; /* Log filename */ - char *backup; /* Secondary filename (for log rotation) */ + const char *filename; /* Log filename */ + const char *backup; /* Secondary filename (for log rotation) */ off_t pos; /* Position/size of current log */ off_t limit; /* Log size limit */ int terminal_flag; |