summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_attr.c14
-rw-r--r--bgpd/bgp_evpn.c2
-rw-r--r--bgpd/bgp_io.c22
-rw-r--r--bgpd/bgp_io.h10
-rw-r--r--bgpd/bgp_route.c12
-rw-r--r--bgpd/bgpd.c8
-rw-r--r--bgpd/bgpd.h1
-rw-r--r--lib/frr_pthread.c6
-rw-r--r--lib/frr_pthread.h3
-rw-r--r--lib/if.c3
-rw-r--r--ospfd/ospf_vty.c5
-rw-r--r--ospfd/ospf_vty.h1
-rw-r--r--zebra/label_manager.c3
13 files changed, 66 insertions, 24 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 00bad08fbe..5b917fc814 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -74,6 +74,7 @@ static const struct message attr_str[] = {
{BGP_ATTR_AS4_PATH, "AS4_PATH"},
{BGP_ATTR_AS4_AGGREGATOR, "AS4_AGGREGATOR"},
{BGP_ATTR_AS_PATHLIMIT, "AS_PATHLIMIT"},
+ {BGP_ATTR_PMSI_TUNNEL, "PMSI_TUNNEL_ATTRIBUTE"},
{BGP_ATTR_ENCAP, "ENCAP"},
#if ENABLE_BGP_VNC
{BGP_ATTR_VNC, "VNC"},
@@ -1034,6 +1035,8 @@ const u_int8_t attr_flags_values[] = {
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_AS4_AGGREGATOR] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
+ [BGP_ATTR_PMSI_TUNNEL] =
+ BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_LARGE_COMMUNITIES] =
BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS,
[BGP_ATTR_PREFIX_SID] =
@@ -3246,6 +3249,17 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
#endif
}
+ /* PMSI Tunnel */
+ if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
+ stream_putc(s, BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS);
+ stream_putc(s, BGP_ATTR_PMSI_TUNNEL);
+ stream_putc(s, 9); // Length
+ stream_putc(s, 0); // Flags
+ stream_putc(s, 6); // Tunnel type: Ingress Replication (6)
+ stream_put(s, &(attr->label), BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI
+ stream_put_ipv4(s, attr->nexthop.s_addr); // Unicast tunnel endpoint IP address
+ }
+
/* Unknown transit attribute. */
if (attr->transit)
stream_put(s, attr->transit->val, attr->transit->length);
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 182a6c64f2..ca2e1a54d4 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -834,6 +834,8 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn,
attr.mp_nexthop_global_in = vpn->originator_ip;
attr.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4;
attr.sticky = CHECK_FLAG(flags, ZEBRA_MAC_TYPE_STICKY) ? 1 : 0;
+ attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL);
+ vni2label(vpn->vni, &(attr.label));
/* Set up RT and ENCAP extended community. */
build_evpn_route_extcomm(vpn, &attr);
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index 548167b3a3..cc9c1bda56 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -109,13 +109,15 @@ int bgp_io_stop(void **result, struct frr_pthread *fpt)
}
/* Extern API -------------------------------------------------------------- */
+void bgp_io_running(void)
+{
+ while (!atomic_load_explicit(&bgp_io_thread_started,
+ memory_order_seq_cst))
+ frr_pthread_yield();
+}
void bgp_writes_on(struct peer *peer)
{
- while (
- !atomic_load_explicit(&bgp_io_thread_started, memory_order_seq_cst))
- ;
-
assert(peer->status != Deleted);
assert(peer->obuf);
assert(peer->ibuf);
@@ -133,10 +135,6 @@ void bgp_writes_on(struct peer *peer)
void bgp_writes_off(struct peer *peer)
{
- while (
- !atomic_load_explicit(&bgp_io_thread_started, memory_order_seq_cst))
- ;
-
struct frr_pthread *fpt = frr_pthread_get(PTHREAD_IO);
thread_cancel_async(fpt->master, &peer->t_write, NULL);
@@ -147,10 +145,6 @@ void bgp_writes_off(struct peer *peer)
void bgp_reads_on(struct peer *peer)
{
- while (
- !atomic_load_explicit(&bgp_io_thread_started, memory_order_seq_cst))
- ;
-
assert(peer->status != Deleted);
assert(peer->ibuf);
assert(peer->fd);
@@ -170,10 +164,6 @@ void bgp_reads_on(struct peer *peer)
void bgp_reads_off(struct peer *peer)
{
- while (
- !atomic_load_explicit(&bgp_io_thread_started, memory_order_seq_cst))
- ;
-
struct frr_pthread *fpt = frr_pthread_get(PTHREAD_IO);
thread_cancel_async(fpt->master, &peer->t_read, NULL);
diff --git a/bgpd/bgp_io.h b/bgpd/bgp_io.h
index c4bd3c2dd9..73587366d7 100644
--- a/bgpd/bgp_io.h
+++ b/bgpd/bgp_io.h
@@ -37,6 +37,16 @@
extern void bgp_io_init(void);
/**
+ * Ensure that the BGP IO thread is actually up and running
+ *
+ * This function must be called immediately after the thread
+ * has been created for running. This is because we want
+ * to make sure that the io thread is ready before other
+ * threads start attempting to use it.
+ */
+extern void bgp_io_running(void);
+
+/**
* Start function for write thread.
*
* @param arg - unused
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 64391e9d45..81b605ad79 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5068,9 +5068,10 @@ DEFPY(bgp_network,
}
return bgp_static_set(vty, no, address_str ? addr_prefix_str:prefix_str,
- AFI_IP, bgp_node_safi(vty),
- map_name, backdoor?1:0,
- label_index ? label_index:BGP_INVALID_LABEL_INDEX);
+ AFI_IP, bgp_node_safi(vty),
+ map_name, backdoor?1:0,
+ label_index ?
+ (uint32_t)label_index : BGP_INVALID_LABEL_INDEX);
}
DEFPY(ipv6_bgp_network,
@@ -5086,8 +5087,9 @@ DEFPY(ipv6_bgp_network,
"Label index value\n")
{
return bgp_static_set(vty, no, prefix_str, AFI_IP6,
- bgp_node_safi(vty), map_name, 0,
- label_index ? label_index:BGP_INVALID_LABEL_INDEX);
+ bgp_node_safi(vty), map_name, 0,
+ label_index ?
+ (uint32_t)label_index : BGP_INVALID_LABEL_INDEX);
}
/* Aggreagete address:
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 6dcb603cb6..4d8e4ffe37 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7437,7 +7437,15 @@ void bgp_pthreads_run()
pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
+ /*
+ * Please ensure that the io thread is running
+ * by calling bgp_io_running. The BGP threads
+ * depend on it being running when we start
+ * looking for it.
+ */
frr_pthread_run(PTHREAD_IO, &attr, NULL);
+ bgp_io_running();
+
frr_pthread_run(PTHREAD_KEEPALIVES, &attr, NULL);
}
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 6bb49e0c53..ce56587727 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1020,6 +1020,7 @@ struct bgp_nlri {
#define BGP_ATTR_AS4_PATH 17
#define BGP_ATTR_AS4_AGGREGATOR 18
#define BGP_ATTR_AS_PATHLIMIT 21
+#define BGP_ATTR_PMSI_TUNNEL 22
#define BGP_ATTR_ENCAP 23
#define BGP_ATTR_LARGE_COMMUNITIES 32
#define BGP_ATTR_PREFIX_SID 40
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c
index 8b23640fa4..19dfbaf54b 100644
--- a/lib/frr_pthread.c
+++ b/lib/frr_pthread.c
@@ -19,6 +19,7 @@
#include <zebra.h>
#include <pthread.h>
+#include <sched.h>
#include "frr_pthread.h"
#include "memory.h"
@@ -182,3 +183,8 @@ unsigned int frr_pthread_get_id()
{
return next_id++;
}
+
+void frr_pthread_yield(void)
+{
+ (void)sched_yield();
+}
diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h
index 9dee5fcca4..f6000340a7 100644
--- a/lib/frr_pthread.h
+++ b/lib/frr_pthread.h
@@ -130,6 +130,9 @@ int frr_pthread_stop(unsigned int id, void **result);
/* Stops all frr_pthread's. */
void frr_pthread_stop_all(void);
+/* Yields the current thread of execution */
+void frr_pthread_yield(void);
+
/* Returns a unique identifier for use with frr_pthread_new().
*
* Internally, this is an integer that increments after each call to this
diff --git a/lib/if.c b/lib/if.c
index 0fe7da1c0d..8e6a9a6968 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -663,8 +663,9 @@ DEFUN_NOSH (no_interface,
"Interface's name\n"
VRF_CMD_HELP_STR)
{
+ int idx_vrf = 4;
const char *ifname = argv[2]->arg;
- const char *vrfname = (argc > 3) ? argv[3]->arg : NULL;
+ const char *vrfname = (argc > 3) ? argv[idx_vrf]->arg : NULL;
// deleting interface
struct interface *ifp;
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a5ea14793a..b1a0acf83c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -1974,12 +1974,13 @@ DEFUN (ospf_area_authentication_message_digest,
"Use message-digest authentication\n")
{
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
- int idx_ipv4_number = 1;
+ int idx = 0;
struct ospf_area *area;
struct in_addr area_id;
int format;
- VTY_GET_OSPF_AREA_ID(area_id, format, argv[idx_ipv4_number]->arg);
+ argv_find(argv, argc, "area", &idx);
+ VTY_GET_OSPF_AREA_ID(area_id, format, argv[idx + 1]->arg);
area = ospf_area_get(ospf, area_id);
ospf_area_display_format_set(ospf, area, format);
diff --git a/ospfd/ospf_vty.h b/ospfd/ospf_vty.h
index 9fd0c3ed4c..5eb6842be3 100644
--- a/ospfd/ospf_vty.h
+++ b/ospfd/ospf_vty.h
@@ -44,6 +44,7 @@
vty_out(vty, \
"%% You can't configure %s to backbone\n", \
NAME); \
+ return CMD_WARNING; \
} \
}
diff --git a/zebra/label_manager.c b/zebra/label_manager.c
index bf4522b70f..f38206d8e1 100644
--- a/zebra/label_manager.c
+++ b/zebra/label_manager.c
@@ -41,6 +41,8 @@
struct label_manager lbl_mgr;
+extern struct zebra_privs_t zserv_privs;
+
DEFINE_MGROUP(LBL_MGR, "Label Manager");
DEFINE_MTYPE_STATIC(LBL_MGR, LM_CHUNK, "Label Manager Chunk");
@@ -222,6 +224,7 @@ static void lm_zclient_init(char *lm_zserv_path)
/* Set default values. */
zclient = zclient_new_notify(zebrad.master, &zclient_options_default);
+ zclient->privs = &zserv_privs;
zclient->sock = -1;
zclient->t_connect = NULL;
lm_zclient_connect(NULL);