diff options
author | Renato Westphal <renato@cvs.openbsd.org> | 2015-03-21 18:32:02 +0000 |
---|---|---|
committer | Renato Westphal <renato@cvs.openbsd.org> | 2015-03-21 18:32:02 +0000 |
commit | 282d7551d49e738c78d84a3db40f079acd49375e (patch) | |
tree | f5ab7f36d071e976a6f1a41560c1c37f780fc2d7 /usr.sbin/ldpd/ldpe.c | |
parent | b4756efb3fa7d3b8000f8114603e84ec3db6942d (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/ldpe.c')
-rw-r--r-- | usr.sbin/ldpd/ldpe.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/usr.sbin/ldpd/ldpe.c b/usr.sbin/ldpd/ldpe.c index e97ee27fa7a..353060b41ec 100644 --- a/usr.sbin/ldpd/ldpe.c +++ b/usr.sbin/ldpd/ldpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.c,v 1.29 2015/03/21 18:29:22 renato Exp $ */ +/* $OpenBSD: ldpe.c,v 1.30 2015/03/21 18:32:01 renato Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -264,10 +264,6 @@ ldpe_shutdown(void) /* stop all interfaces */ while ((iface = LIST_FIRST(&leconf->iface_list)) != NULL) { - if (if_fsm(iface, IF_EVT_DOWN)) { - log_debug("error stopping interface %s", - iface->name); - } LIST_REMOVE(iface, entry); if_del(iface); } @@ -346,8 +342,6 @@ ldpe_dispatch_main(int fd, short event, void *bula) switch (imsg.hdr.type) { case IMSG_IFSTATUS: - case IMSG_IFUP: - case IMSG_IFDOWN: if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct kif)) fatalx("IFINFO imsg with wrong len"); @@ -359,16 +353,7 @@ ldpe_dispatch_main(int fd, short event, void *bula) iface->flags = kif->flags; iface->linkstate = kif->link_state; - switch (imsg.hdr.type) { - case IMSG_IFUP: - if_fsm(iface, IF_EVT_UP); - break; - case IMSG_IFDOWN: - if_fsm(iface, IF_EVT_DOWN); - break; - default: - break; - } + if_update(iface); break; case IMSG_NEWADDR: if (imsg.hdr.len != IMSG_HEADER_SIZE + @@ -395,7 +380,7 @@ ldpe_dispatch_main(int fd, short event, void *bula) if (iface) { LIST_INSERT_HEAD(&iface->addr_list, if_addr, iface_entry); - if_fsm(iface, IF_EVT_NEWADDR); + if_update(iface); } break; case IMSG_DELADDR: @@ -417,7 +402,7 @@ ldpe_dispatch_main(int fd, short event, void *bula) iface = if_lookup(kaddr->ifindex); if (iface) { LIST_REMOVE(if_addr, iface_entry); - if_fsm(iface, IF_EVT_DELADDR); + if_update(iface); } RB_FOREACH(nbr, nbr_id_head, &nbrs_by_id) { |