Download raw body.
bgpd: more const sprinkling
This is the trivial const bits for rde_attr.c, I have a second batch for
attr_optadd() which is more intrusive and will be sent out next.
This adds const to attr_writebuf(), aspath_get() and aspath_deflate().
--
:wq Claudio
Index: rde.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v
diff -u -p -r1.345 rde.h
--- rde.h 27 Apr 2026 15:06:01 -0000 1.345
+++ rde.h 28 Apr 2026 14:08:49 -0000
@@ -448,7 +448,7 @@ peer_is_up(struct rde_peer *peer)
RB_PROTOTYPE(peer_tree, rde_peer, entry, peer_cmp);
/* rde_attr.c */
-int attr_writebuf(struct ibuf *, uint8_t, uint8_t, void *,
+int attr_writebuf(struct ibuf *, uint8_t, uint8_t, const void *,
uint16_t);
void attr_init(void);
int attr_optadd(struct rde_aspath *, uint8_t, uint8_t,
@@ -462,10 +462,10 @@ void attr_free(struct rde_aspath *, st
void attr_stats(struct ch_stats *);
-struct aspath *aspath_get(void *, uint16_t);
+struct aspath *aspath_get(const void *, uint16_t);
struct aspath *aspath_copy(struct aspath *);
void aspath_put(struct aspath *);
-u_char *aspath_deflate(u_char *, uint16_t *, int *);
+u_char *aspath_deflate(const u_char *, uint16_t *, int *);
void aspath_merge(struct rde_aspath *, struct attr *);
uint32_t aspath_neighbor(struct aspath *);
int aspath_loopfree(struct aspath *, uint32_t);
Index: rde_attr.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_attr.c,v
diff -u -p -r1.141 rde_attr.c
--- rde_attr.c 17 Mar 2026 09:29:29 -0000 1.141
+++ rde_attr.c 28 Apr 2026 14:08:49 -0000
@@ -32,7 +32,7 @@
#include "chash.h"
int
-attr_writebuf(struct ibuf *buf, uint8_t flags, uint8_t type, void *data,
+attr_writebuf(struct ibuf *buf, uint8_t flags, uint8_t type, const void *data,
uint16_t data_len)
{
u_char hdr[4];
@@ -351,7 +351,7 @@ aspath_compare(const struct aspath *a1,
}
struct aspath *
-aspath_get(void *data, uint16_t len)
+aspath_get(const void *data, uint16_t len)
{
struct aspath *aspath;
@@ -403,9 +403,10 @@ aspath_put(struct aspath *aspath)
* convert a 4 byte aspath to a 2 byte one.
*/
u_char *
-aspath_deflate(u_char *data, uint16_t *len, int *flagnew)
+aspath_deflate(const u_char *data, uint16_t *len, int *flagnew)
{
- uint8_t *seg, *nseg, *ndata = NULL;
+ const uint8_t *seg;
+ uint8_t *nseg, *ndata = NULL;
uint32_t as;
int i;
uint16_t seg_size, olen, nlen;
bgpd: more const sprinkling