]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Configuration strings are constant.
authorMaria Matejka <mq@jmq.cz>
Wed, 8 Apr 2020 20:25:15 +0000 (22:25 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 9 Apr 2020 13:37:14 +0000 (15:37 +0200)
This is merely a const propagation. There was no problem in there.

28 files changed:
conf/conf.h
conf/confbase.Y
filter/data.h
lib/socket.h
lib/timer.c
lib/timer.h
nest/iface.c
nest/iface.h
nest/password.h
nest/proto.c
nest/protocol.h
proto/babel/babel.c
proto/babel/babel.h
proto/bgp/bgp.h
proto/mrt/mrt.h
proto/ospf/ospf.c
proto/ospf/ospf.h
proto/radv/packets.c
proto/radv/radv.h
proto/rip/rip.c
proto/rip/rip.h
sysdep/bsd/setkey.h
sysdep/bsd/sysio.h
sysdep/linux/sysio.h
sysdep/unix/io.c
sysdep/unix/log.c
sysdep/unix/main.c
sysdep/unix/unix.h

index 0dea4f9420552b85398f3d1d1f9c660d753611d5..34c6818dcf1bc153521c27d105184ff95d9f8afd 100644 (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 */
 
index 75158927673af1e7e66ad6f67f95ddafc4d8e600..8b22f23673dc8a9d44ecce117d51575dafe92622 100644 (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;
index dd9830df67472da4c36bb0eef9d2358071aac918..4ebce73b6556280473c795ff5acc3c9932a6ceb1 100644 (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;
index f2b0c0425c680cc29ddf2e208724652d3254df64..96fedeebbb26bdca11f6b44caac70cd38d32ad95 100644 (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);
index ddf41340c08778eed55a6b4cf421fc21a96fcdee..be69511496fdf0d9db4d90f5af2d8a1bedb45695 100644 (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;
index 3b99825f0188351e0c3beebbce8074342f320150..c5ea430cdb81fe858c819eab697ff753a3674d78 100644 (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);
 
index 00dfc2ca305faaeebf58e9d3c08f0f3e899fa258..46a49f8fae5f5f0811001d8d8998f7097f410763 100644 (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)
index 0eb277cd5169dbb0eea83d2095a8dd9e16d8649a..b9796283d4c066d84d33dc4fc72ba069aa9f8cea 100644 (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;
 };
 
index c40178482461460758b7caa28b5e88160abc23b2..8a0da22375fc4f20ec1e28607c060d412a65843f 100644 (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 */
index 6051ba9db0e11655887c41273cc7b69895ed8174..850904245dcb78baa91f0f7e370b436ad374c31d 100644 (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;
index e4ec7fa2f17bb1468217d9700d8d5abb4bc6a40b..e97e59ddcd10ffcac01bac06bb74049b0b64f050 100644 (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;
 };
 
index 177ff3a3ed9b924a8b0346a8a8c3ff20865b1602..a915e8fae2eb3505afaa207eca48282209beee5c 100644 (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;
index 14765c60f41a43147a1f4b566ec674f028b33cd2..e075024cb4dd154c982d11f7873321ab71cbb760 100644 (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);
 
index 03b92bd87306d59077670c557a46d621c04f0451..dc63e13eac7fdb927042f594467127e149768287 100644 (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 */
index 4dfb1b1933296eb4a93188e18e0a6acc926482b4..4ff94c120dbf8768d5b8147a743f322bfa93588a 100644 (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 {
index 63ff9e5643871596d19e69a092bd199528c2e634..29610f4ac042397ab8b93a9293bf1eaceb7572d9 100644 (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;
index 8318ee95c4653544bf08351bf4a78f6d1c8eae7b..d0286f72af029745424d86ed2e6603cca70aa465 100644 (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);
index 3139d32127c795ea2fea15d14f1fbbffd9d6cee9..5cd8b2deb9c0a90f51a0d5e5d5e10326d93fe18b 100644 (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;
 
index 2c8ad7d438b1dd01220b1a14bf211f252e0b2122..14d40f8abca285c0a86232103e1059f8daba0e08 100644 (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 */
 };
 
 /*
index 25ee16fd02846fd3cfbe9cecdd78ff2ce767a7f0..f02d507121c8d6293603a12493bb36f4f23215c3 100644 (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;
index 762946245c5eca5edfa30ddd48b551feda8771d5..8d3470007882c3af963f0fe538722fc5a6202e41 100644 (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);
index 40564cf1337a23208b0e2d3e1f4b93aa5c8e347d..b7a112837080707c0ba38e6ce24dff8a71a5b1dd 100644 (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);
index 929bfaf64aa6a76b1e9d2a4caa8725de34c0c8e0..c757960a141149c6615a00c0cca97aea0c6f2607 100644 (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)
index 8c3efd6ea28ee25cc70589bc6b2768842bd56f16..e21ff48743833308d3046fe48c470cff45499b25 100644 (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;
 
index f4e45a5f59aedaaa10e0ac748d1484b5e45dfaab..f6cc0e3283423f02b7543bce298cacb2b1f630cd 100644 (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);
 
index 18894f98834416e32b3eb5b1a617f10964d9b066..e24322c601add273c1fd3d62e71f6fbf7807a663 100644 (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;
 
index 5209b9b33fb6296dde41521390afab88b9e7fa4f..1d258f4c7a81e6d549b9bd752e21997d8b0f490e 100644 (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;
index bd817bf2e0849999b100ce4c1a6e9cd6e52dd4bd..8244fc86a8e712ebff666fd17174d6fd3ae5f9e1 100644 (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;