]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_updgrp_packet.c
Merge pull request #12837 from donaldsharp/unlikely_routemap
[mirror_frr.git] / bgpd / bgp_updgrp_packet.c
index b52d67ed3c4837416fdb58eab9e7aa45677f3740..e04d5ae245ca544fdbb9e0d4112e563d056baa13 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /**
  * bgp_updgrp_packet.c: BGP update group packet handling routines
  *
@@ -6,28 +7,12 @@
  * @author Avneesh Sachdev <avneesh@sproute.net>
  * @author Rajesh Varadarajan <rajesh@sproute.net>
  * @author Pradosh Mohapatra <pradosh@sproute.net>
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
 
 #include "prefix.h"
-#include "thread.h"
+#include "frrevent.h"
 #include "buffer.h"
 #include "stream.h"
 #include "command.h"
@@ -1072,6 +1057,9 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
        safi_t safi;
        struct bpacket_attr_vec_arr vecarr;
        bool addpath_capable = false;
+       uint8_t default_originate_label[4] = {0x80, 0x00, 0x00};
+       mpls_label_t *label = NULL;
+       uint32_t num_labels = 0;
 
        if (DISABLE_BGP_ANNOUNCE)
                return;
@@ -1085,6 +1073,11 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
        bpacket_attr_vec_arr_reset(&vecarr);
        addpath_capable = bgp_addpath_encode_tx(peer, afi, safi);
 
+       if (safi == SAFI_LABELED_UNICAST) {
+               label = (mpls_label_t *)default_originate_label;
+               num_labels = 1;
+       }
+
        memset(&p, 0, sizeof(p));
        p.family = afi2family(afi);
        p.prefixlen = 0;
@@ -1127,9 +1120,9 @@ void subgroup_default_update_packet(struct update_subgroup *subgrp,
        pos = stream_get_endp(s);
        stream_putw(s, 0);
        total_attr_len = bgp_packet_attribute(
-               NULL, peer, s, attr, &vecarr, &p, afi, safi, from, NULL, NULL,
-               0, addpath_capable, BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE,
-               NULL);
+               NULL, peer, s, attr, &vecarr, &p, afi, safi, from, NULL, label,
+               num_labels, addpath_capable,
+               BGP_ADDPATH_TX_ID_FOR_DEFAULT_ORIGINATE, NULL);
 
        /* Set Total Path Attribute Length. */
        stream_putw_at(s, pos, total_attr_len);