summaryrefslogtreecommitdiffstats
path: root/ldpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-02-19 10:25:12 +0100
committerGitHub <noreply@github.com>2023-02-19 10:25:12 +0100
commitfc20f9edb54c16f9ab24314ddeeca10c1bd50493 (patch)
treeb07fc1f114f9fcf2a5fc0a541de9bc6b4cbfebc6 /ldpd
parentMerge pull request #12791 from taspelund/loc_rib_json_fix (diff)
parentldpd: changes for code maintainability (diff)
downloadfrr-fc20f9edb54c16f9ab24314ddeeca10c1bd50493.tar.xz
frr-fc20f9edb54c16f9ab24314ddeeca10c1bd50493.zip
Merge pull request #12845 from sri-mohan1/sri-mohan-ldp
ldpd: changes for code maintainability
Diffstat (limited to 'ldpd')
-rw-r--r--ldpd/address.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ldpd/address.c b/ldpd/address.c
index 45d1bb14b..107eb5d78 100644
--- a/ldpd/address.c
+++ b/ldpd/address.c
@@ -72,12 +72,13 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
if ((buf = ibuf_open(size)) == NULL)
fatal(__func__);
- err |= gen_ldp_hdr(buf, size);
+ SET_FLAG(err, gen_ldp_hdr(buf, size));
size -= LDP_HDR_SIZE;
- err |= gen_msg_hdr(buf, msg_type, size);
+ SET_FLAG(err, gen_msg_hdr(buf, msg_type, size));
size -= LDP_MSG_SIZE;
- err |= gen_address_list_tlv(buf, af, addr_list, tlv_addr_count);
+ SET_FLAG(err, gen_address_list_tlv(buf, af, addr_list, tlv_addr_count));
(void)size;
+
if (err) {
address_list_clr(addr_list);
ibuf_free(buf);
@@ -158,10 +159,12 @@ send_mac_withdrawal(struct nbr *nbr, struct map *fec, uint8_t *mac)
err = gen_ldp_hdr(buf, size);
size -= LDP_HDR_SIZE;
- err |= gen_msg_hdr(buf, MSG_TYPE_ADDRWITHDRAW, size);
- err |= gen_address_list_tlv(buf, AF_INET, NULL, 0);
- err |= gen_fec_tlv(buf, fec);
- err |= gen_mac_list_tlv(buf, mac);
+
+ SET_FLAG(err, gen_msg_hdr(buf, MSG_TYPE_ADDRWITHDRAW, size));
+ SET_FLAG(err, gen_address_list_tlv(buf, AF_INET, NULL, 0));
+ SET_FLAG(err, gen_fec_tlv(buf, fec));
+ SET_FLAG(err, gen_mac_list_tlv(buf, mac));
+
if (err) {
ibuf_free(buf);
return;
@@ -340,12 +343,14 @@ gen_address_list_tlv(struct ibuf *buf, int af, struct if_addr_head *addr_list,
}
alt.length = htons(sizeof(alt.family) + addr_size * tlv_addr_count);
- err |= ibuf_add(buf, &alt, sizeof(alt));
+ SET_FLAG(err, ibuf_add(buf, &alt, sizeof(alt)));
+
if (addr_list == NULL)
return (err);
LIST_FOREACH(if_addr, addr_list, entry) {
- err |= ibuf_add(buf, &if_addr->addr, addr_size);
+ SET_FLAG(err, ibuf_add(buf, &if_addr->addr, addr_size));
+
if (--tlv_addr_count == 0)
break;
}
@@ -365,7 +370,7 @@ gen_mac_list_tlv(struct ibuf *buf, uint8_t *mac)
tlv.length = htons(ETH_ALEN);
err = ibuf_add(buf, &tlv, sizeof(tlv));
if (mac)
- err |= ibuf_add(buf, mac, ETH_ALEN);
+ SET_FLAG(err, ibuf_add(buf, mac, ETH_ALEN));
return (err);
}