summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-02-06 17:45:22 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-02-06 18:07:19 +0100
commit77677f4a2939c7ffa64731521c8e10c18d5b62d3 (patch)
tree8b3848fd0f39085e9c9ff2581aaffe7b043d4246 /src/ipcpd/normal
parentd2028e4cea956791152a41b12b2907178f40caa9 (diff)
downloadouroboros-77677f4a2939c7ffa64731521c8e10c18d5b62d3.tar.gz
ouroboros-77677f4a2939c7ffa64731521c8e10c18d5b62d3.zip
ipcpd: Replicate database on new MGMT flow
This will trigger the existing member to send all entries in its database as LSAs to the new member. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/pol/link_state.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c
index c5870821..a8a69259 100644
--- a/src/ipcpd/normal/pol/link_state.c
+++ b/src/ipcpd/normal/pol/link_state.c
@@ -477,6 +477,21 @@ static void send_lsm(uint64_t src,
}
}
+/* replicate the lsdb to a mgmt neighbor */
+static void lsdb_replicate(int fd)
+{
+ struct list_head * p;
+
+ list_for_each(p, &ls.db) {
+ struct lsa lsm;
+ struct adjacency * adj;
+ adj = list_entry(p, struct adjacency, next);
+ lsm.d_addr = hton64(adj->dst);
+ lsm.s_addr = hton64(adj->src);
+ flow_write(fd, &lsm, sizeof(lsm));
+ }
+}
+
static void * lsupdate(void * o)
{
struct list_head * p;
@@ -673,6 +688,8 @@ static void handle_event(void * self,
fset_add(ls.mgmt_set, c->flow_info.fd);
if (lsdb_add_nb(c->conn_info.addr, c->flow_info.fd, NB_MGMT))
log_warn("Failed to add mgmt neighbor to LSDB.");
+ /* replicate the entire lsdb */
+ lsdb_replicate(c->flow_info.fd);
break;
case NOTIFY_MGMT_CONN_DEL:
fset_del(ls.mgmt_set, c->flow_info.fd);