diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-05-29 22:08:26 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-05-29 22:08:26 +0000 |
commit | e9c1bd19fc1d465ccab245e1368e92d44b983bdc (patch) | |
tree | a9302a94e921f736d1fe875b0eeb4cc86954ef70 /usr.sbin/ospfd/ospfe.c | |
parent | 63cae2374b352a5452a0c84095c31908e2173452 (diff) |
Demote support for ospfd. It is possible to specify a demote group on
interfaces and areas. With this carp setups using ospfd are more reliable
because we can fail over if the OSPF connectivity is (partially) lost.
OK norby@
Diffstat (limited to 'usr.sbin/ospfd/ospfe.c')
-rw-r--r-- | usr.sbin/ospfd/ospfe.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c index f97fd09d02b..90c30d427d4 100644 --- a/usr.sbin/ospfd/ospfe.c +++ b/usr.sbin/ospfd/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.54 2007/03/21 10:54:30 claudio Exp $ */ +/* $OpenBSD: ospfe.c,v 1.55 2007/05/29 22:08:25 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -179,6 +179,7 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2], /* start interfaces */ LIST_FOREACH(area, &oeconf->area_list, entry) { + ospfe_demote_area(area, 0); LIST_FOREACH(iface, &area->iface_list, entry) { if_init(xconf, iface); if (if_fsm(iface, IF_EVT_UP)) { @@ -1043,3 +1044,42 @@ ospfe_nbr_ctl(struct ctl_conn *c) imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, NULL, 0); } + +void +ospfe_demote_area(struct area *area, int active) +{ + struct demote_msg dmsg; + + if (ospfd_process != PROC_OSPF_ENGINE || + area->demote_group[0] == '\0') + return; + + bzero(&dmsg, sizeof(dmsg)); + strlcpy(dmsg.demote_group, area->demote_group, + sizeof(dmsg.demote_group)); + dmsg.level = area->demote_level; + if (active) + dmsg.level = -dmsg.level; + + ospfe_imsg_compose_parent(IMSG_DEMOTE, 0, &dmsg, sizeof(dmsg)); +} + +void +ospfe_demote_iface(struct iface *iface, int active) +{ + struct demote_msg dmsg; + + if (ospfd_process != PROC_OSPF_ENGINE || + iface->demote_group[0] == '\0') + return; + + bzero(&dmsg, sizeof(dmsg)); + strlcpy(dmsg.demote_group, iface->demote_group, + sizeof(dmsg.demote_group)); + if (active) + dmsg.level = -1; + else + dmsg.level = 1; + + ospfe_imsg_compose_parent(IMSG_DEMOTE, 0, &dmsg, sizeof(dmsg)); +} |