summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ripd/ripe.c
diff options
context:
space:
mode:
authormichele <michele@openbsd.org>2008-12-17 14:19:39 +0000
committermichele <michele@openbsd.org>2008-12-17 14:19:39 +0000
commit4d8b14b6630665f8df30f467781f65de613391cd (patch)
treef106fc7414e73812fba0b143a896671143b90c39 /usr.sbin/ripd/ripe.c
parentchange the name displayed by the c-mode on the mode line to "c", (diff)
downloadwireguard-openbsd-4d8b14b6630665f8df30f467781f65de613391cd.tar.xz
wireguard-openbsd-4d8b14b6630665f8df30f467781f65de613391cd.zip
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));
+}