diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-11-18 17:07:39 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-11-18 17:07:39 +0000 |
commit | 3939abe9d5c0b96842845b1c60a475263a5d54fa (patch) | |
tree | a1510d833f7b116368d819cd60afcfe9bfd3984b /usr.sbin/bgpd | |
parent | e112c79850e5d494d63994f614589d7f82c98411 (diff) |
add an instance of struct capabilities to peer_conf, and inherit
peer->capa.ann from this
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 11 | ||||
-rw-r--r-- | usr.sbin/bgpd/parse.y | 9 | ||||
-rw-r--r-- | usr.sbin/bgpd/printconf.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.c | 9 | ||||
-rw-r--r-- | usr.sbin/bgpd/session.h | 8 |
5 files changed, 22 insertions, 19 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 3c6516a4314..bb55a21e5fb 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.147 2004/11/18 15:40:58 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.148 2004/11/18 17:07:38 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -201,6 +201,12 @@ struct peer_auth { u_int8_t enc_keylen_out; }; +struct capabilities { + u_int8_t mp_v4; /* multiprotocol extensions, RFC 2858 */ + u_int8_t mp_v6; + u_int8_t refresh; /* route refresh, RFC 2918 */ +}; + struct peer_config { u_int32_t id; u_int32_t groupid; @@ -222,7 +228,8 @@ struct peer_config { enum announce_type announce_type; enum enforce_as enforce_as; struct peer_auth auth; - u_int8_t capabilities; + u_int8_t announce_capa; + struct capabilities capabilities; u_int8_t reflector_client; char if_depend[IFNAMSIZ]; enum reconf_action reconf_action; diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 8cde3ff2169..91d85050a33 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.144 2004/11/11 10:35:15 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.145 2004/11/18 17:07:38 henning Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -724,7 +724,7 @@ peeropts : REMOTEAS asnumber { free($7); } | ANNOUNCE CAPABILITIES yesno { - curpeer->conf.capabilities = $3; + curpeer->conf.announce_capa = $3; } | SET filter_set_opt { if (merge_filterset(&curpeer->conf.attrset, &$2) == -1) @@ -1745,7 +1745,10 @@ alloc_peer(void) p->next = NULL; p->conf.distance = 1; p->conf.announce_type = ANNOUNCE_UNDEF; - p->conf.capabilities = 1; + p->conf.announce_capa = 1; + p->conf.capabilities.mp_v4 = SAFI_UNICAST; + p->conf.capabilities.mp_v6 = SAFI_NONE; + p->conf.capabilities.refresh = 1; return (p); } diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c index e1587d0506f..564ed3e004b 100644 --- a/usr.sbin/bgpd/printconf.c +++ b/usr.sbin/bgpd/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.33 2004/11/11 10:35:15 claudio Exp $ */ +/* $OpenBSD: printconf.c,v 1.34 2004/11/18 17:07:38 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -166,7 +166,7 @@ print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c) printf("%s\tholdtime %u\n", c, p->holdtime); if (p->min_holdtime) printf("%s\tholdtime min %u\n", c, p->min_holdtime); - if (p->capabilities == 0) + if (p->announce_capa == 0) printf("%s\tannounce capabilities no\n", c); if (p->announce_type == ANNOUNCE_SELF) printf("%s\tannounce self\n", c); diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index 6f06d5478c4..0ef51c3742a 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.205 2004/11/18 16:38:05 henning Exp $ */ +/* $OpenBSD: session.c,v 1.206 2004/11/18 17:07:38 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -533,10 +533,8 @@ init_peer(struct peer *p) { p->fd = p->wbuf.fd = -1; - p->capa.ann.mp_v4 = SAFI_UNICAST; - p->capa.ann.mp_v6 = SAFI_NONE; - p->capa.ann.refresh = 1; - if (!p->conf.capabilities) + memcpy(&p->capa.ann, &p->conf.capabilities, sizeof(p->capa.ann)); + if (!p->conf.announce_capa) session_capa_ann_none(p); if (p->conf.if_depend[0]) @@ -848,6 +846,7 @@ change_state(struct peer *peer, enum session_state state, msgbuf_clear(&peer->wbuf); free(peer->rbuf); peer->rbuf = NULL; + bzero(&peer->capa.peer, sizeof(peer->capa.peer)); if (peer->state == STATE_ESTABLISHED) session_down(peer); if (event != EVNT_STOP) { diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index eed4b51d372..c8183fbb892 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.71 2004/11/18 16:38:05 henning Exp $ */ +/* $OpenBSD: session.h,v 1.72 2004/11/18 17:07:38 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -146,12 +146,6 @@ struct peer_stats { u_int32_t prefix_cnt; }; -struct capabilities { - u_int8_t mp_v4; /* multiprotocol extensions, RFC 2858 */ - u_int8_t mp_v6; - u_int8_t refresh; /* route refresh, RFC 2918 */ -}; - struct peer { struct peer_config conf; struct peer_stats stats; |