summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/kroute.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2015-03-21 18:32:02 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2015-03-21 18:32:02 +0000
commit282d7551d49e738c78d84a3db40f079acd49375e (patch)
treef5ab7f36d071e976a6f1a41560c1c37f780fc2d7 /usr.sbin/ldpd/kroute.c
parentb4756efb3fa7d3b8000f8114603e84ec3db6942d (diff)
Remove interface finite state machine.
In the name of simplicity, remove the interface FSM that was inherited from ospfd. In ldpd interfaces are just up or down, so keeping a FSM for that is an overkill. Now instead of calling if_fsm(), just call if_update() whenever a relevant event occurs (status change, address addition/removal). Additional notes: 1 - s/if_act_/if_/ 2 - Remove the IMSG_IFUP and IMSG_IFDOWN events. Now whenever an interface changes its state a IMSG_IFSTATUS event will be generated with the new status. kroute.c ldpd.h ldpe.c ldpe.h CVS: ----------------------------------------------------------------------
Diffstat (limited to 'usr.sbin/ldpd/kroute.c')
-rw-r--r--usr.sbin/ldpd/kroute.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index c707b9e8643..3243787e1fe 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.38 2015/03/21 18:20:19 renato Exp $ */
+/* $OpenBSD: kroute.c,v 1.39 2015/03/21 18:32:01 renato Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -136,7 +136,7 @@ kif_redistribute(void)
struct kif_addr *ka;
RB_FOREACH(kif, kif_tree, &kit) {
- main_imsg_compose_ldpe(IMSG_IFUP, 0, &kif->k,
+ main_imsg_compose_ldpe(IMSG_IFSTATUS, 0, &kif->k,
sizeof(struct kif));
TAILQ_FOREACH(ka, &kif->addrs, entry)
@@ -855,18 +855,17 @@ if_change(u_short ifindex, int flags, struct if_data *ifd,
link_new = (kif->k.flags & IFF_UP) &&
LINK_STATE_IS_UP(kif->k.link_state);
- if (link_new == link_old) {
- main_imsg_compose_ldpe(IMSG_IFSTATUS, 0, &kif->k,
- sizeof(struct kif));
+ if (link_new == link_old)
return;
- } else if (link_new) {
- main_imsg_compose_ldpe(IMSG_IFUP, 0, &kif->k,
+
+ if (link_new) {
+ main_imsg_compose_ldpe(IMSG_IFSTATUS, 0, &kif->k,
sizeof(struct kif));
TAILQ_FOREACH(ka, &kif->addrs, entry)
main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka->addr,
sizeof(struct kaddr));
} else {
- main_imsg_compose_ldpe(IMSG_IFDOWN, 0, &kif->k,
+ main_imsg_compose_ldpe(IMSG_IFSTATUS, 0, &kif->k,
sizeof(struct kif));
TAILQ_FOREACH(ka, &kif->addrs, entry)
main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka->addr,