summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/control.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-06 23:14:59 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-06 23:14:59 +0000
commit46b167ceff7922791726347f290e24c26eb7734d (patch)
treefe9ab14831851b3efbd290b6f79fe91a74b93f71 /usr.sbin/bgpd/control.c
parent0d8de2e0bc196a346ee4795c990c8868daa8df5b (diff)
two new imsg types, IMSG_CTL_NEIGHBOR_UP and _DOWN, on their receival on the
control socket the given neighbor session is sent a START / STOP signal. ok claudio@
Diffstat (limited to 'usr.sbin/bgpd/control.c')
-rw-r--r--usr.sbin/bgpd/control.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index 93b7cd42a4a..ff2571928dc 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.11 2004/01/06 03:43:50 henning Exp $ */
+/* $OpenBSD: control.c,v 1.12 2004/01/06 23:14:58 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -216,6 +216,34 @@ control_dispatch_msg(struct pollfd *pfd, int i)
case IMSG_CTL_FIB_DECOUPLE:
imsg_compose_parent(imsg.hdr.type, 0, NULL, 0);
break;
+ case IMSG_CTL_NEIGHBOR_UP:
+ if (imsg.hdr.len == IMSG_HEADER_SIZE +
+ sizeof(struct bgpd_addr)) {
+ addr = imsg.data;
+ p = getpeerbyip(addr->v4.s_addr);
+ if (p != NULL)
+ bgp_fsm(p, EVNT_START);
+ else
+ logit(LOG_CRIT, "IMSG_CTL_NEIGHBOR_UP "
+ "with unknown neighbor");
+ } else
+ logit(LOG_CRIT, "got IMSG_CTL_NEIGHBOR_UP with "
+ "wrong length");
+ break;
+ case IMSG_CTL_NEIGHBOR_DOWN:
+ if (imsg.hdr.len == IMSG_HEADER_SIZE +
+ sizeof(struct bgpd_addr)) {
+ addr = imsg.data;
+ p = getpeerbyip(addr->v4.s_addr);
+ if (p != NULL)
+ bgp_fsm(p, EVNT_STOP);
+ else
+ logit(LOG_CRIT, "IMSG_CTL_NEIGHBOR_DOWN"
+ " with unknown neighbor");
+ } else
+ logit(LOG_CRIT, "got IMSG_CTL_NEIGHBOR_DOWN "
+ "with wrong length");
+ break;
default:
break;
}