summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/rde.c25
-rw-r--r--usr.sbin/bgpd/session.c25
2 files changed, 11 insertions, 39 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index dadd2cdb1db..24eb801b0fc 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.322 2013/05/31 23:10:12 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.323 2013/07/10 15:56:06 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -393,13 +393,7 @@ rde_dispatch_imsg_session(struct imsgbuf *ibuf)
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(pconf))
fatalx("incorrect size of session request");
memcpy(&pconf, imsg.data, sizeof(pconf));
- peer = peer_add(imsg.hdr.peerid, &pconf);
- if (peer == NULL) {
- log_warnx("session add: "
- "peer id %d already exists",
- imsg.hdr.peerid);
- break;
- }
+ peer_add(imsg.hdr.peerid, &pconf);
break;
case IMSG_SESSION_UP:
if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(sup))
@@ -644,7 +638,6 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
struct mrt xmrt;
struct rde_rib rn;
struct rde_peer *peer;
- struct peer_config *pconf;
struct filter_rule *r;
struct filter_set *s;
struct nexthop *nh;
@@ -726,16 +719,6 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
} else
ribs[rid].state = RECONF_KEEP;
break;
- case IMSG_RECONF_PEER:
- if (imsg.hdr.len - IMSG_HEADER_SIZE !=
- sizeof(struct peer_config))
- fatalx("IMSG_RECONF_PEER bad len");
- if ((peer = peer_get(imsg.hdr.peerid)) == NULL)
- break;
- pconf = imsg.data;
- strlcpy(peer->conf.rib, pconf->rib,
- sizeof(peer->conf.rib));
- break;
case IMSG_RECONF_FILTER:
if (imsg.hdr.len - IMSG_HEADER_SIZE !=
sizeof(struct filter_rule))
@@ -3144,8 +3127,10 @@ peer_add(u_int32_t id, struct peer_config *p_conf)
struct rde_peer_head *head;
struct rde_peer *peer;
- if (peer_get(id))
+ if ((peer = peer_get(id))) {
+ memcpy(&peer->conf, p_conf, sizeof(struct peer_config));
return (NULL);
+ }
peer = calloc(1, sizeof(struct rde_peer));
if (peer == NULL)
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index cc588d7b2ac..d642209bef1 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.331 2013/05/30 20:29:27 florian Exp $ */
+/* $OpenBSD: session.c,v 1.332 2013/07/10 15:56:06 claudio Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -79,7 +79,6 @@ void session_notification(struct peer *, u_int8_t, u_int8_t, void *,
ssize_t);
void session_rrefresh(struct peer *, u_int8_t);
int session_graceful_restart(struct peer *);
-int session_graceful_is_restarting(struct peer *);
int session_graceful_stop(struct peer *);
int session_dispatch_msg(struct pollfd *, struct peer *);
int session_process_msg(struct peer *);
@@ -1724,17 +1723,6 @@ session_graceful_restart(struct peer *p)
}
int
-session_graceful_is_restarting(struct peer *p)
-{
- u_int8_t i;
-
- for (i = 0; i < AID_MAX; i++)
- if (p->capa.neg.grestart.flags[i] & CAPA_GR_RESTARTING)
- return (1);
- return (0);
-}
-
-int
session_graceful_stop(struct peer *p)
{
u_int8_t i;
@@ -2623,7 +2611,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
/* sync the RDE in case we keep the peer */
if (reconf == RECONF_KEEP) {
- if (imsg_compose(ibuf_rde, IMSG_RECONF_PEER,
+ if (imsg_compose(ibuf_rde, IMSG_SESSION_ADD,
p->conf.id, 0, -1, &p->conf,
sizeof(struct peer_config)) == -1)
fatalx("imsg_compose error");
@@ -2637,7 +2625,7 @@ session_dispatch_imsg(struct imsgbuf *ibuf, int idx, u_int *listener_cnt)
NULL, np->conf.id,
np->conf.remote_as);
if (imsg_compose(ibuf_rde,
- IMSG_RECONF_PEER,
+ IMSG_SESSION_ADD,
np->conf.id, 0, -1,
&np->conf,
sizeof(struct peer_config))
@@ -3156,10 +3144,9 @@ session_up(struct peer *p)
{
struct session_up sup;
- if (!session_graceful_is_restarting(p))
- if (imsg_compose(ibuf_rde, IMSG_SESSION_ADD, p->conf.id, 0, -1,
- &p->conf, sizeof(p->conf)) == -1)
- fatalx("imsg_compose error");
+ if (imsg_compose(ibuf_rde, IMSG_SESSION_ADD, p->conf.id, 0, -1,
+ &p->conf, sizeof(p->conf)) == -1)
+ fatalx("imsg_compose error");
sa2addr((struct sockaddr *)&p->sa_local, &sup.local_addr);
sa2addr((struct sockaddr *)&p->sa_remote, &sup.remote_addr);