summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.h6
-rw-r--r--usr.sbin/bgpd/control.c30
-rw-r--r--usr.sbin/bgpd/session.c3
-rw-r--r--usr.sbin/bgpd/session.h3
4 files changed, 36 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 488bc9f6683..838caf8d929 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.56 2004/01/06 20:41:55 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.57 2004/01/06 23:14:58 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -149,7 +149,9 @@ enum imsg_type {
IMSG_CTL_END,
IMSG_CTL_RELOAD,
IMSG_CTL_FIB_COUPLE,
- IMSG_CTL_FIB_DECOUPLE
+ IMSG_CTL_FIB_DECOUPLE,
+ IMSG_CTL_NEIGHBOR_UP,
+ IMSG_CTL_NEIGHBOR_DOWN
};
struct imsg_hdr {
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;
}
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 37d1d47ce2f..16521ae93f4 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.71 2004/01/06 21:48:19 henning Exp $ */
+/* $OpenBSD: session.c,v 1.72 2004/01/06 23:14:58 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -54,7 +54,6 @@ void session_sighdlr(int);
int setup_listener(void);
void init_conf(struct bgpd_config *);
void init_peer(struct peer *);
-void bgp_fsm(struct peer *, enum session_events);
int timer_due(time_t);
void start_timer_holdtime(struct peer *);
void start_timer_keepalive(struct peer *);
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 7d283eb9aef..668e46d6d7a 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.15 2004/01/06 19:21:22 henning Exp $ */
+/* $OpenBSD: session.h,v 1.16 2004/01/06 23:14:58 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -155,6 +155,7 @@ struct peer *peers;
void session_socket_blockmode(int, enum blockmodes);
int session_main(struct bgpd_config *, struct peer *, int[2],
int[2]);
+void bgp_fsm(struct peer *, enum session_events);
struct peer *getpeerbyip(in_addr_t);
int imsg_compose_parent(int, u_int32_t, void *, u_int16_t);