diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-17 21:01:56 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-01-17 21:01:56 -0500 |
| commit | b58ed1f8a89ea32c2380bf79057e5333109d72d4 (patch) | |
| tree | a9ead45b8895edce92ab69621a52816b45725e36 /bgpd/rfapi/rfapi.c | |
| parent | 01cb1466423363a2f8b42246464feb3858df1c9f (diff) | |
| parent | 5551c072e187c76c3d6a885cd043d6db811bab23 (diff) | |
Merge remote-tracking branch 'origin/master' into pim_lib_work2
Diffstat (limited to 'bgpd/rfapi/rfapi.c')
| -rw-r--r-- | bgpd/rfapi/rfapi.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index e74b370f43..248ba7a63f 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -2842,13 +2842,39 @@ rfapi_register ( * If mac address is set, add an RT based on the registered LNI */ memset ((char *) &ecom_value, 0, sizeof (ecom_value)); - ecom_value.val[1] = 0x02; + ecom_value.val[1] = ECOMMUNITY_ROUTE_TARGET; ecom_value.val[5] = (l2o->logical_net_id >> 16) & 0xff; ecom_value.val[6] = (l2o->logical_net_id >> 8) & 0xff; ecom_value.val[7] = (l2o->logical_net_id >> 0) & 0xff; rtlist = ecommunity_new(); ecommunity_add_val (rtlist, &ecom_value); } + if (l2o->tag_id) + { + as_t as = bgp->as; + uint16_t val = l2o->tag_id; + memset ((char *) &ecom_value, 0, sizeof (ecom_value)); + ecom_value.val[1] = ECOMMUNITY_ROUTE_TARGET; + if (as > BGP_AS_MAX) + { + ecom_value.val[0] = ECOMMUNITY_ENCODE_AS4; + ecom_value.val[2] = (as >>24) & 0xff; + ecom_value.val[3] = (as >>16) & 0xff; + ecom_value.val[4] = (as >>8) & 0xff; + ecom_value.val[5] = as & 0xff; + } + else + { + ecom_value.val[0] = ECOMMUNITY_ENCODE_AS; + ecom_value.val[2] = (as >>8) & 0xff; + ecom_value.val[3] = as & 0xff; + } + ecom_value.val[6] = (val >> 8) & 0xff; + ecom_value.val[7] = val & 0xff; + if (rtlist == NULL) + rtlist = ecommunity_new(); + ecommunity_add_val (rtlist, &ecom_value); + } } /* |
