summaryrefslogtreecommitdiff
path: root/usr.sbin/ripd/ripe.c
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2008-12-17 14:19:40 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2008-12-17 14:19:40 +0000
commitcf18c8ead2d515cfea800a21b448d24b89d8a8d9 (patch)
treeff1e7808f9d49e6a49717433fef45e2c0b5fde0f /usr.sbin/ripd/ripe.c
parent18d0b66bfb8c173ffb0673e3dc232e6675fac5c4 (diff)
Add support for demotion counter.
When interfaces go up/down the demotion counter of the specified group is decreased/increased. ok henning@
Diffstat (limited to 'usr.sbin/ripd/ripe.c')
-rw-r--r--usr.sbin/ripd/ripe.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.sbin/ripd/ripe.c b/usr.sbin/ripd/ripe.c
index 93c594aced6..7b30822b3b7 100644
--- a/usr.sbin/ripd/ripe.c
+++ b/usr.sbin/ripd/ripe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripe.c,v 1.7 2008/11/23 13:09:31 michele Exp $ */
+/* $OpenBSD: ripe.c,v 1.8 2008/12/17 14:19:39 michele Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -525,3 +525,23 @@ ripe_nbr_ctl(struct ctl_conn *c)
imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, NULL, 0);
}
+
+void
+ripe_demote_iface(struct iface *iface, int active)
+{
+ struct demote_msg dmsg;
+
+ if (ripd_process != PROC_RIP_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;
+
+ ripe_imsg_compose_parent(IMSG_DEMOTE, 0, &dmsg, sizeof(dmsg));
+}