summaryrefslogtreecommitdiff
path: root/bgpd/rfapi/rfapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/rfapi/rfapi.c')
-rw-r--r--bgpd/rfapi/rfapi.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 2d81a6ce65..f7bbd44512 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -744,7 +744,7 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
encaptlv->length = 4;
lt = htonl(*lifetime);
memcpy(encaptlv->value, &lt, 4);
- attr.vnc_subtlvs = encaptlv;
+ bgp_attr_set_vnc_subtlvs(&attr, encaptlv);
vnc_zlog_debug_verbose(
"%s: set Encap Attr Prefix Lifetime to %d", __func__,
*lifetime);
@@ -754,7 +754,8 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
if (rfp_options) {
if (flags & RFAPI_AHR_RFPOPT_IS_VNCTLV) {
-
+ struct bgp_attr_encap_subtlv *vnc_subtlvs =
+ bgp_attr_get_vnc_subtlvs(&attr);
/*
* this flag means we're passing a pointer to an
* existing encap tlv chain which we should copy.
@@ -763,16 +764,15 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
*/
encaptlv = encap_tlv_dup(
(struct bgp_attr_encap_subtlv *)rfp_options);
- if (attr.vnc_subtlvs) {
- attr.vnc_subtlvs->next = encaptlv;
- } else {
- attr.vnc_subtlvs = encaptlv;
- }
-
+ if (vnc_subtlvs)
+ vnc_subtlvs->next = encaptlv;
+ else
+ bgp_attr_set_vnc_subtlvs(&attr, encaptlv);
} else {
struct bgp_tea_options *hop;
/* XXX max of one tlv present so far from above code */
- struct bgp_attr_encap_subtlv *tail = attr.vnc_subtlvs;
+ struct bgp_attr_encap_subtlv *tail =
+ bgp_attr_get_vnc_subtlvs(&attr);
for (hop = rfp_options; hop; hop = hop->next) {
@@ -798,11 +798,11 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
/*
* add to end of subtlv chain
*/
- if (tail) {
+ if (tail)
tail->next = encaptlv;
- } else {
- attr.vnc_subtlvs = encaptlv;
- }
+ else
+ bgp_attr_set_vnc_subtlvs(&attr,
+ encaptlv);
tail = encaptlv;
}
}
@@ -3688,20 +3688,16 @@ static void rfapi_print_exported(struct bgp *bgp)
if (!table)
continue;
fprintf(stderr, "%s: encap destn=%p\n", __func__, destn);
- for (dest = bgp_table_top(table))
- ;
- dest;
- dest = bgp_route_next(dest))
- {
- bpi = bgp_dest_get_bgp_path_info(dest);
- if (!bpi)
- continue;
- fprintf(stderr, "%s: dest=%p\n", __func__, dest);
- for (; bpi; bpi = bpi->next) {
- rfapiPrintBi((void *)2,
- bpi); /* 2 => stderr */
- }
- }
+ for (dest = bgp_table_top(table); dest;
+ dest = bgp_route_next(dest)) {
+ bpi = bgp_dest_get_bgp_path_info(dest);
+ if (!bpi)
+ continue;
+ fprintf(stderr, "%s: dest=%p\n", __func__, dest);
+ for (; bpi; bpi = bpi->next) {
+ rfapiPrintBi((void *)2, bpi); /* 2 => stderr */
+ }
+ }
}
}
#endif /* defined(DEBUG_RFAPI) */