diff options
-rw-r--r-- | bgpd/bgp_attr_evpn.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_clist.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_ecommunity.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_evpn_vty.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_lcommunity.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_rd.c | 6 | ||||
-rw-r--r-- | bgpd/bgp_rd.h | 6 | ||||
-rw-r--r-- | bgpd/rfapi/rfapi_import.c | 2 | ||||
-rw-r--r-- | lib/stream.h | 3 |
9 files changed, 15 insertions, 14 deletions
diff --git a/bgpd/bgp_attr_evpn.c b/bgpd/bgp_attr_evpn.c index 6941e1f9b..7239ddef9 100644 --- a/bgpd/bgp_attr_evpn.c +++ b/bgpd/bgp_attr_evpn.c @@ -186,7 +186,7 @@ uint32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, uint8_t *sticky) * one. */ for (i = 0; i < ecom->size; i++) { - uint8_t *pnt; + const uint8_t *pnt; uint8_t type, sub_type; uint32_t seq_num; diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index 5c461dbe7..fc0c987ba 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -549,7 +549,7 @@ static char *lcommunity_str_get(struct lcommunity *lcom, int i) uint32_t localdata1; uint32_t localdata2; char *str; - uint8_t *ptr; + const uint8_t *ptr; char *pnt; ptr = lcom->val + (i * LCOMMUNITY_SIZE); diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 21bfe3f12..fc6649474 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -555,7 +555,7 @@ struct ecommunity *ecommunity_str2com(const char *str, int type, return ecom; } -static int ecommunity_rt_soo_str(char *buf, size_t bufsz, uint8_t *pnt, +static int ecommunity_rt_soo_str(char *buf, size_t bufsz, const uint8_t *pnt, int type, int sub_type, int format) { int len = 0; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 4f9d2a7b5..70bd7b219 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -59,7 +59,7 @@ struct vni_walk_ctx { static void display_vrf_import_rt(struct vty *vty, struct vrf_irt_node *irt, json_object *json) { - uint8_t *pnt; + const uint8_t *pnt; uint8_t type, sub_type; struct ecommunity_as eas; struct ecommunity_ip eip; @@ -167,7 +167,7 @@ static void show_vrf_import_rt_entry(struct hash_bucket *bucket, void *args[]) static void display_import_rt(struct vty *vty, struct irt_node *irt, json_object *json) { - uint8_t *pnt; + const uint8_t *pnt; uint8_t type, sub_type; struct ecommunity_as eas; struct ecommunity_ip eip; diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c index 324505418..c21056f30 100644 --- a/bgpd/bgp_lcommunity.c +++ b/bgpd/bgp_lcommunity.c @@ -178,7 +178,7 @@ static void set_lcommunity_string(struct lcommunity *lcom, bool make_json) int i; int len; char *str_buf; - uint8_t *pnt; + const uint8_t *pnt; uint32_t global, local1, local2; json_object *json_lcommunity_list = NULL; json_object *json_string = NULL; diff --git a/bgpd/bgp_rd.c b/bgpd/bgp_rd.c index be950dfa5..ea9758349 100644 --- a/bgpd/bgp_rd.c +++ b/bgpd/bgp_rd.c @@ -37,7 +37,7 @@ #include "bgpd/rfapi/rfapi_backend.h" #endif -uint16_t decode_rd_type(uint8_t *pnt) +uint16_t decode_rd_type(const uint8_t *pnt) { uint16_t v; @@ -60,7 +60,7 @@ void encode_rd_type(uint16_t v, uint8_t *pnt) } /* type == RD_TYPE_AS */ -void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as) +void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as) { rd_as->as = (uint16_t)*pnt++ << 8; rd_as->as |= (uint16_t)*pnt++; @@ -68,7 +68,7 @@ void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as) } /* type == RD_TYPE_AS4 */ -void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as) +void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as) { pnt = ptr_get_be32(pnt, &rd_as->as); rd_as->val = ((uint16_t)*pnt++ << 8); diff --git a/bgpd/bgp_rd.h b/bgpd/bgp_rd.h index c5ea34103..da8c553b4 100644 --- a/bgpd/bgp_rd.h +++ b/bgpd/bgp_rd.h @@ -54,11 +54,11 @@ struct rd_vnc_eth { }; #endif -extern uint16_t decode_rd_type(uint8_t *pnt); +extern uint16_t decode_rd_type(const uint8_t *pnt); extern void encode_rd_type(uint16_t, uint8_t *); -extern void decode_rd_as(uint8_t *pnt, struct rd_as *rd_as); -extern void decode_rd_as4(uint8_t *pnt, struct rd_as *rd_as); +extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as); +extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as); extern void decode_rd_ip(uint8_t *pnt, struct rd_ip *rd_ip); #if ENABLE_BGP_VNC extern void decode_rd_vnc_eth(uint8_t *pnt, struct rd_vnc_eth *rd_vnc_eth); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 2f274015f..5cb4fd5a1 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -1040,7 +1040,7 @@ int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, uint16_t *tag_id) for (i = 0; i < ecom->size; ++i) { as_t as = 0; int encode = 0; - uint8_t *p = ecom->val + (i * ECOMMUNITY_SIZE); + const uint8_t *p = ecom->val + (i * ECOMMUNITY_SIZE); /* High-order octet of type. */ encode = *p++; diff --git a/lib/stream.h b/lib/stream.h index 36c65afa3..425f0c5ed 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -354,9 +354,10 @@ extern void stream_fifo_free(struct stream_fifo *fifo); * bit), for 64-bit values (you need to cast them anyway), and neither for * encoding (because it's downcasted.) */ -static inline uint8_t *ptr_get_be32(uint8_t *ptr, uint32_t *out) +static inline const uint8_t *ptr_get_be32(const uint8_t *ptr, uint32_t *out) { uint32_t tmp; + memcpy(&tmp, ptr, sizeof(tmp)); *out = ntohl(tmp); return ptr + 4; |