]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_rd.c
*: fix be32 reading / 24-bit left shift
[mirror_frr.git] / bgpd / bgp_rd.c
index a15828bd36a9402194ff82d72ba24b7a0dc97c97..2b676e052b3480b31ac72c2938ff0e69df317918 100644 (file)
@@ -63,21 +63,13 @@ void decode_rd_as(u_char *pnt, struct rd_as *rd_as)
 {
        rd_as->as = (u_int16_t)*pnt++ << 8;
        rd_as->as |= (u_int16_t)*pnt++;
-
-       rd_as->val = ((u_int32_t)*pnt++ << 24);
-       rd_as->val |= ((u_int32_t)*pnt++ << 16);
-       rd_as->val |= ((u_int32_t)*pnt++ << 8);
-       rd_as->val |= (u_int32_t)*pnt;
+       ptr_get_be32(pnt, &rd_as->val);
 }
 
 /* type == RD_TYPE_AS4 */
 void decode_rd_as4(u_char *pnt, struct rd_as *rd_as)
 {
-       rd_as->as = (u_int32_t)*pnt++ << 24;
-       rd_as->as |= (u_int32_t)*pnt++ << 16;
-       rd_as->as |= (u_int32_t)*pnt++ << 8;
-       rd_as->as |= (u_int32_t)*pnt++;
-
+       pnt = ptr_get_be32(pnt, &rd_as->as);
        rd_as->val = ((u_int16_t)*pnt++ << 8);
        rd_as->val |= (u_int16_t)*pnt;
 }