summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-11-18 17:17:57 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-11-18 17:17:57 +0000
commit7b56d6939a3b7f3fb5e900efaf365f2092e715a9 (patch)
tree5441993f48402f2f7b2eda6c23657429c604d96c
parent2af21da64dff5c7b4eb730e295f3e81ae97667d4 (diff)
embed two struct capabilities, one for the capas announced by the peer and
one for the capas we announced him, into the session_up imsg to the RDE after brainstorming with claudio
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/session.c24
2 files changed, 16 insertions, 12 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index bb55a21e5fb..738706573a8 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.148 2004/11/18 17:07:38 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.149 2004/11/18 17:17:56 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -404,6 +404,8 @@ struct session_up {
struct bgpd_addr local_addr;
struct bgpd_addr remote_addr;
struct peer_config conf;
+ struct capabilities capa_announced;
+ struct capabilities capa_received;
};
struct pftable_msg {
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index 0ef51c3742a..0035524c91d 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.206 2004/11/18 17:07:38 henning Exp $ */
+/* $OpenBSD: session.c,v 1.207 2004/11/18 17:17:56 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2497,40 +2497,42 @@ session_down(struct peer *peer)
}
void
-session_up(struct peer *peer)
+session_up(struct peer *p)
{
struct session_up sup;
- sup.remote_bgpid = peer->remote_bgpid;
+ sup.remote_bgpid = p->remote_bgpid;
- switch (peer->sa_local.ss_family) {
+ switch (p->sa_local.ss_family) {
case AF_INET:
sup.local_addr.af = AF_INET;
memcpy(&sup.local_addr.v4,
- &((struct sockaddr_in *)&peer->sa_local)->sin_addr,
+ &((struct sockaddr_in *)&p->sa_local)->sin_addr,
sizeof(sup.local_addr.v4));
sup.remote_addr.af = AF_INET;
memcpy(&sup.remote_addr.v4,
- &((struct sockaddr_in *)&peer->sa_remote)->sin_addr,
+ &((struct sockaddr_in *)&p->sa_remote)->sin_addr,
sizeof(sup.remote_addr.v4));
break;
case AF_INET6:
sup.local_addr.af = AF_INET6;
memcpy(&sup.local_addr.v6,
- &((struct sockaddr_in6 *)&peer->sa_local)->sin6_addr,
+ &((struct sockaddr_in6 *)&p->sa_local)->sin6_addr,
sizeof(sup.local_addr.v6));
sup.remote_addr.af = AF_INET6;
memcpy(&sup.remote_addr.v6,
- &((struct sockaddr_in6 *)&peer->sa_remote)->sin6_addr,
+ &((struct sockaddr_in6 *)&p->sa_remote)->sin6_addr,
sizeof(sup.remote_addr.v6));
break;
default:
fatalx("session_up: unsupported address family");
}
- memcpy(&sup.conf, &peer->conf, sizeof(sup.conf));
- peer->stats.last_updown = time(NULL);
- if (imsg_compose(ibuf_rde, IMSG_SESSION_UP, peer->conf.id, 0, -1,
+ memcpy(&sup.conf, &p->conf, sizeof(sup.conf));
+ memcpy(&sup.capa_announced, &p->capa.ann, sizeof(sup.capa_announced));
+ memcpy(&sup.capa_received, &p->capa.peer, sizeof(sup.capa_received));
+ p->stats.last_updown = time(NULL);
+ if (imsg_compose(ibuf_rde, IMSG_SESSION_UP, p->conf.id, 0, -1,
&sup, sizeof(sup)) == -1)
fatalx("imsg_compose error");
}