Configuration strings are constant.

This is merely a const propagation. There was no problem in there.
This commit is contained in:
Maria Matejka 2020-04-08 22:25:15 +02:00 committed by Maria Matejka
parent a109056145
commit fd9f0c0640
28 changed files with 57 additions and 57 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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)

View file

@ -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;
};

View file

@ -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 */

View file

@ -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;

View file

@ -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;
};

View file

@ -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;

View file

@ -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);

View file

@ -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 */

View file

@ -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 {

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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 */
};
/*

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;