summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_fsm.c6
-rw-r--r--bgpd/bgp_network.c11
-rw-r--r--bgpd/bgp_vty.c19
-rw-r--r--doc/developer/topotests.rst26
-rw-r--r--ospfd/ospf_lsa.c26
-rw-r--r--ospfd/ospf_lsa.h4
-rw-r--r--ospfd/ospf_packet.c30
-rw-r--r--ospfd/ospfd.c3
-rw-r--r--tests/topotests/lib/topogen.py4
9 files changed, 104 insertions, 25 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index deee52cde0..5b997867e0 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -358,8 +358,7 @@ void bgp_timer_set(struct peer *peer)
status start timer is on unless peer is shutdown or peer is
inactive. All other timer must be turned off */
if (BGP_PEER_START_SUPPRESSED(peer) || !peer_active(peer)
- || (peer->bgp->inst_type != BGP_INSTANCE_TYPE_VIEW &&
- peer->bgp->vrf_id == VRF_UNKNOWN)) {
+ || peer->bgp->vrf_id == VRF_UNKNOWN) {
BGP_TIMER_OFF(peer->t_start);
} else {
BGP_TIMER_ON(peer->t_start, bgp_start_timer,
@@ -1695,8 +1694,7 @@ int bgp_start(struct peer *peer)
return 0;
}
- if (peer->bgp->inst_type != BGP_INSTANCE_TYPE_VIEW &&
- peer->bgp->vrf_id == VRF_UNKNOWN) {
+ if (peer->bgp->vrf_id == VRF_UNKNOWN) {
if (bgp_debug_neighbor_events(peer))
flog_err(
EC_BGP_FSM,
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 6bd7acfede..f72f44f8a2 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -173,9 +173,7 @@ static int bgp_md5_set_password(struct peer *peer, const char *password)
* must be the default vrf or a view instance
*/
if (!listener->bgp) {
- if (peer->bgp->vrf_id != VRF_DEFAULT
- && peer->bgp->inst_type
- != BGP_INSTANCE_TYPE_VIEW)
+ if (peer->bgp->vrf_id != VRF_DEFAULT)
continue;
} else if (listener->bgp != peer->bgp)
continue;
@@ -856,8 +854,7 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
listener->name = XSTRDUP(MTYPE_BGP_LISTENER, bgp->name);
/* this socket is in a vrf record bgp back pointer */
- if (bgp->vrf_id != VRF_DEFAULT
- && bgp->inst_type != BGP_INSTANCE_TYPE_VIEW)
+ if (bgp->vrf_id != VRF_DEFAULT)
listener->bgp = bgp;
memcpy(&listener->su, sa, salen);
@@ -909,9 +906,7 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
sock = vrf_socket(ainfo->ai_family,
ainfo->ai_socktype,
ainfo->ai_protocol,
- (bgp->inst_type
- != BGP_INSTANCE_TYPE_VIEW
- ? bgp->vrf_id : VRF_DEFAULT),
+ bgp->vrf_id,
(bgp->inst_type
== BGP_INSTANCE_TYPE_VRF
? bgp->name : NULL));
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 4a1153651e..6e427c0b7c 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6196,11 +6196,12 @@ DEFUN (no_neighbor_disable_connected_check,
PEER_FLAG_DISABLE_CONNECTED_CHECK);
}
-/* link-bw-encoding-ieee */
-DEFUN(neighbor_link_bw_encoding_ieee, neighbor_link_bw_encoding_ieee_cmd,
+/* disable-link-bw-encoding-ieee */
+DEFUN(neighbor_disable_link_bw_encoding_ieee,
+ neighbor_disable_link_bw_encoding_ieee_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> disable-link-bw-encoding-ieee",
NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Enable IEEE floating-point encoding for extended community bandwidth\n")
+ "Disable IEEE floating-point encoding for extended community bandwidth\n")
{
int idx_peer = 1;
@@ -6208,10 +6209,11 @@ DEFUN(neighbor_link_bw_encoding_ieee, neighbor_link_bw_encoding_ieee_cmd,
PEER_FLAG_DISABLE_LINK_BW_ENCODING_IEEE);
}
-DEFUN(no_neighbor_link_bw_encoding_ieee, no_neighbor_link_bw_encoding_ieee_cmd,
+DEFUN(no_neighbor_disable_link_bw_encoding_ieee,
+ no_neighbor_disable_link_bw_encoding_ieee_cmd,
"no neighbor <A.B.C.D|X:X::X:X|WORD> disable-link-bw-encoding-ieee",
NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
- "Enable IEEE floating-point encoding for extended community bandwidth\n")
+ "Disable IEEE floating-point encoding for extended community bandwidth\n")
{
int idx_peer = 2;
@@ -18400,9 +18402,10 @@ void bgp_vty_init(void)
install_element(BGP_NODE, &neighbor_disable_connected_check_cmd);
install_element(BGP_NODE, &no_neighbor_disable_connected_check_cmd);
- /* "neighbor link-bw-encoding-ieee" commands. */
- install_element(BGP_NODE, &neighbor_link_bw_encoding_ieee_cmd);
- install_element(BGP_NODE, &no_neighbor_link_bw_encoding_ieee_cmd);
+ /* "neighbor disable-link-bw-encoding-ieee" commands. */
+ install_element(BGP_NODE, &neighbor_disable_link_bw_encoding_ieee_cmd);
+ install_element(BGP_NODE,
+ &no_neighbor_disable_link_bw_encoding_ieee_cmd);
/* "neighbor enforce-first-as" commands. */
install_element(BGP_NODE, &neighbor_enforce_first_as_cmd);
diff --git a/doc/developer/topotests.rst b/doc/developer/topotests.rst
index 4a8f7bd27d..fa6a1ba660 100644
--- a/doc/developer/topotests.rst
+++ b/doc/developer/topotests.rst
@@ -953,6 +953,32 @@ configuration files (per-daemon) using the following commands:
end
r1#
+You can also login to the node specified by nsenter using bash, etc.
+A pid file for each node will be created in the relevant test dir.
+You can run scripts inside the node, or use vtysh's <tab> or <?> feature.
+
+.. code:: shell
+
+ [unet shell]
+ # cd tests/topotests/srv6_locator
+ # ./test_srv6_locator.py --topology-only
+ unet> r1 show segment-routing srv6 locator
+ Locator:
+ Name ID Prefix Status
+ -------------------- ------- ------------------------ -------
+ loc1 1 2001:db8:1:1::/64 Up
+ loc2 2 2001:db8:2:2::/64 Up
+
+ [Another shell]
+ # nsenter -a -t $(cat /tmp/topotests/srv6_locator.test_srv6_locator/r1.pid) bash --norc
+ # vtysh
+ r1# r1 show segment-routing srv6 locator
+ Locator:
+ Name ID Prefix Status
+ -------------------- ------- ------------------------ -------
+ loc1 1 2001:db8:1:1::/64 Up
+ loc2 2 2001:db8:2:2::/64 Up
+
Writing Tests
"""""""""""""
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index d209ae053c..cc1b2919c0 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -2954,6 +2954,32 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
return 0;
}
+/* This function checks whether an LSA with initial sequence number should be
+ * originated after a wrap in sequence number
+ */
+void ospf_check_and_gen_init_seq_lsa(struct ospf_interface *oi,
+ struct ospf_lsa *recv_lsa)
+{
+ struct ospf_lsa *lsa = NULL;
+ struct ospf *ospf = oi->ospf;
+
+ lsa = ospf_lsa_lookup_by_header(oi->area, recv_lsa->data);
+
+ if ((lsa == NULL) || (!CHECK_FLAG(lsa->flags, OSPF_LSA_PREMATURE_AGE))
+ || (lsa->retransmit_counter != 0)) {
+ if (IS_DEBUG_OSPF(lsa, LSA))
+ zlog_debug(
+ "Do not generate LSA with initial seqence number.");
+ return;
+ }
+
+ ospf_lsa_maxage_delete(ospf, lsa);
+
+ lsa->data->ls_seqnum = lsa_seqnum_increment(lsa);
+
+ ospf_lsa_refresh(ospf, lsa);
+}
+
void ospf_lsa_maxage_delete(struct ospf *ospf, struct ospf_lsa *lsa)
{
struct route_node *rn;
diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h
index d01dc720ba..5dcd072774 100644
--- a/ospfd/ospf_lsa.h
+++ b/ospfd/ospf_lsa.h
@@ -218,6 +218,8 @@ struct as_external_lsa {
#define LS_AGE(x) (OSPF_LSA_MAXAGE < get_age(x) ? OSPF_LSA_MAXAGE : get_age(x))
#define IS_LSA_SELF(L) (CHECK_FLAG ((L)->flags, OSPF_LSA_SELF))
#define IS_LSA_MAXAGE(L) (LS_AGE ((L)) == OSPF_LSA_MAXAGE)
+#define IS_LSA_MAX_SEQ(L) \
+ ((L)->data->ls_seqnum == htonl(OSPF_MAX_SEQUENCE_NUMBER))
#define OSPF_LSA_UPDATE_DELAY 2
@@ -347,6 +349,8 @@ extern struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
extern struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
struct ospf_lsa *type7,
struct ospf_lsa *type5);
+extern void ospf_check_and_gen_init_seq_lsa(struct ospf_interface *oi,
+ struct ospf_lsa *lsa);
extern void ospf_flush_lsa_from_area(struct ospf *ospf, struct in_addr area_id,
int type);
#endif /* _ZEBRA_OSPF_LSA_H */
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 9930b0bd49..1efdfee3b4 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -1081,6 +1081,25 @@ static void ospf_hello(struct ip *iph, struct ospf_header *ospfh,
return;
}
+ if (OSPF_GR_IS_ACTIVE_HELPER(nbr)) {
+ /* As per the GR Conformance Test Case 7.2. Section 3
+ * "Also, if X was the Designated Router on network segment S
+ * when the helping relationship began, Y maintains X as the
+ * Designated Router until the helping relationship is
+ * terminated."
+ * When I am helper for this neighbor, I should not trigger the
+ * ISM Events. Also Intentionally not setting the priority and
+ * other fields so that when the neighbor exits the Grace
+ * period, it can handle if there is any change before GR and
+ * after GR. */
+ if (IS_DEBUG_OSPF_GR)
+ zlog_debug(
+ "%s, Neighbor is under GR Restart, hence ignoring the ISM Events",
+ __PRETTY_FUNCTION__);
+
+ return;
+ }
+
/* If neighbor itself declares DR and no BDR exists,
cause event BackupSeen */
if (IPV4_ADDR_SAME(&nbr->address.u.prefix4, &hello->d_router))
@@ -2089,11 +2108,10 @@ static void ospf_ls_upd(struct ospf *ospf, struct ip *iph,
if (current == NULL
|| (ret = ospf_lsa_more_recent(current, lsa)) < 0) {
/* CVE-2017-3224 */
- if (current && (lsa->data->ls_seqnum ==
- htonl(OSPF_MAX_SEQUENCE_NUMBER)
- && !IS_LSA_MAXAGE(lsa))) {
+ if (current && (IS_LSA_MAX_SEQ(current))
+ && (IS_LSA_MAX_SEQ(lsa)) && !IS_LSA_MAXAGE(lsa)) {
zlog_debug(
- "Link State Update[%s]: has Max Seq but not MaxAge. Dropping it",
+ "Link State Update[%s]: has Max Seq and higher checksum but not MaxAge. Dropping it",
dump_lsa_key(lsa));
DISCARD_LSA(lsa, 4);
@@ -2271,8 +2289,10 @@ static void ospf_ls_ack(struct ip *iph, struct ospf_header *ospfh,
lsr = ospf_ls_retransmit_lookup(nbr, lsa);
- if (lsr != NULL && ospf_lsa_more_recent(lsr, lsa) == 0)
+ if (lsr != NULL && ospf_lsa_more_recent(lsr, lsa) == 0) {
ospf_ls_retransmit_delete(nbr, lsr);
+ ospf_check_and_gen_init_seq_lsa(oi, lsa);
+ }
lsa->data = NULL;
ospf_lsa_discard(lsa);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 9a421de017..766be60778 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -222,6 +222,9 @@ void ospf_process_refresh_data(struct ospf *ospf, bool reset)
ospf_lsdb_delete_all(ospf->lsdb);
}
+ /* Since the LSAs are deleted, need reset the aggr flag */
+ ospf_unset_all_aggr_flag(ospf);
+
/* Delete the LSDB */
for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area))
ospf_area_lsdb_discard_delete(area);
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py
index 325f65dd6f..33e1388639 100644
--- a/tests/topotests/lib/topogen.py
+++ b/tests/topotests/lib/topogen.py
@@ -771,6 +771,10 @@ class TopoRouter(TopoGear):
# Mount gear log directory on a common path
self.net.bind_mount(self.gearlogdir, "/tmp/gearlogdir")
+ # Ensure pid file
+ with open(os.path.join(self.logdir, self.name + ".pid"), "w") as f:
+ f.write(str(self.net.pid) + "\n")
+
def __str__(self):
gear = super(TopoRouter, self).__str__()
gear += " TopoRouter<>"