summaryrefslogtreecommitdiff
path: root/usr.sbin/eigrpd/rde.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2015-10-21 03:52:13 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2015-10-21 03:52:13 +0000
commita276edca3fd2a5e935de4b937501bf27e8d4da8f (patch)
tree50d5f5628ebdc7bfa4b8225f54ee96474d6b15c4 /usr.sbin/eigrpd/rde.c
parent7782225b2926834dc635e6f72ac2a42468bc922d (diff)
Add support for route summarization.
Working great but need more testing, especially with ipv6. For now we don't validate if one configured summary is inside another or the presence of duplicates. Will address these issues in a future commit.
Diffstat (limited to 'usr.sbin/eigrpd/rde.c')
-rw-r--r--usr.sbin/eigrpd/rde.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/eigrpd/rde.c b/usr.sbin/eigrpd/rde.c
index d20d29821d2..c9dbdd97822 100644
--- a/usr.sbin/eigrpd/rde.c
+++ b/usr.sbin/eigrpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.5 2015/10/21 03:48:09 renato Exp $ */
+/* $OpenBSD: rde.c,v 1.6 2015/10/21 03:52:12 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -422,6 +422,7 @@ rde_dispatch_parent(int fd, short event, void *bula)
TAILQ_INIT(&nei->nbr_list);
TAILQ_INIT(&nei->update_list);
TAILQ_INIT(&nei->query_list);
+ TAILQ_INIT(&nei->summary_list);
TAILQ_INSERT_TAIL(&niface->ei_list, nei, i_entry);
TAILQ_INSERT_TAIL(&neigrp->ei_list, nei, e_entry);
if (RB_INSERT(iface_id_head, &ifaces_by_id, nei) !=
@@ -665,6 +666,22 @@ rt_redist_set(struct kroute *kr, int withdraw)
}
}
+void
+rt_summary_set(struct eigrp *eigrp, struct summary_addr *summary,
+ struct classic_metric *metric)
+{
+ struct rinfo ri;
+
+ memset(&ri, 0, sizeof(ri));
+ ri.af = eigrp->af;
+ ri.type = EIGRP_ROUTE_INTERNAL;
+ memcpy(&ri.prefix, &summary->prefix, sizeof(ri.prefix));
+ ri.prefixlen = summary->prefixlen;
+ memcpy(&ri.metric, metric, sizeof(ri.metric));
+
+ rde_check_update(eigrp->rnbr_summary, &ri);
+}
+
/* send all known routing information to new neighbor */
void
rt_snap(struct rde_nbr *nbr)
@@ -674,7 +691,8 @@ rt_snap(struct rde_nbr *nbr)
struct rinfo ri;
RB_FOREACH(rn, rt_tree, &eigrp->topology)
- if (rn->state == DUAL_STA_PASSIVE) {
+ if (rn->state == DUAL_STA_PASSIVE &&
+ !rde_summary_check(nbr->ei, &rn->prefix, rn->prefixlen)) {
rinfo_fill_successor(rn, &ri);
rde_imsg_compose_eigrpe(IMSG_SEND_UPDATE,
nbr->peerid, 0, &ri, sizeof(ri));