From 17ab36c6c4a48588b86b53a0d3670dd340517814 Mon Sep 17 00:00:00 2001 From: Yash Ranjan Date: Fri, 9 Apr 2021 00:51:00 -0700 Subject: [PATCH] ospf6d: Send Link LSAs when interface priority is changed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As per the ospfv3 conformance test 24.3 SETUP: Configure DIface-0 with priority set to . ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0. DUT: Exchange all the packets, during adjacency establish- ment. ANVL: Verify that the received packets contain: • one header of Link-LSA, originated by DUT. ANVL: Send packet from neighbor Rtr-0-A to DIface-0 con- taining: • One Request Tuple for Link-LSA originated by DUT. ANVL: Listen (for upto 2 * seconds) on DIface-0. DUT: Send packet. ANVL: Verify that the received packet contains: • • one Link-LSA, originated by DUT, contains: Rtr Pri field set to . ---------- When interface priority is changed Link LSAs should be tranmitted with the priority set. When the link priorty chanages, the drbdr algorithm is called, which can change the state of the interface. But if the state does not changes then LINK LSAs are not transmitted. This PR fixes this issue. If the state is changed, then LINK LSAs will anyways be tranmitted. But in case the state is not changed, even in that case Link LSAs are tranmitted. Signed-off-by: Yash Ranjan --- ospf6d/ospf6_interface.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index f3af8b308f..a2ddba65e9 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -474,8 +474,8 @@ void ospf6_interface_connected_route_update(struct interface *ifp) OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(oi->area); } -static void ospf6_interface_state_change(uint8_t next_state, - struct ospf6_interface *oi) +static int ospf6_interface_state_change(uint8_t next_state, + struct ospf6_interface *oi) { uint8_t prev_state; struct ospf6 *ospf6; @@ -484,7 +484,7 @@ static void ospf6_interface_state_change(uint8_t next_state, oi->state = next_state; if (prev_state == next_state) - return; + return -1; /* log */ if (IS_OSPF6_DEBUG_INTERFACE) { @@ -525,6 +525,8 @@ static void ospf6_interface_state_change(uint8_t next_state, } hook_call(ospf6_interface_change, oi, next_state, prev_state); + + return 0; } @@ -1902,10 +1904,13 @@ DEFUN (ipv6_ospf6_priority, ? OSPF6_INTERFACE_PRIORITY : strtoul(argv[idx_number]->arg, NULL, 10); - if (oi->area && (oi->state == OSPF6_INTERFACE_DROTHER - || oi->state == OSPF6_INTERFACE_BDR - || oi->state == OSPF6_INTERFACE_DR)) - ospf6_interface_state_change(dr_election(oi), oi); + if (oi->area + && (oi->state == OSPF6_INTERFACE_DROTHER + || oi->state == OSPF6_INTERFACE_BDR + || oi->state == OSPF6_INTERFACE_DR)) { + if (ospf6_interface_state_change(dr_election(oi), oi) == -1) + OSPF6_LINK_LSA_SCHEDULE(oi); + } return CMD_SUCCESS; } -- 2.39.5