diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-03-16 13:52:31 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-03-16 13:52:31 +0000 |
commit | 1c11c66b14f0baffe2840228c73712bb51015334 (patch) | |
tree | 1dd2c9c735c763e5f9ae1fd16f3163dbad300e06 | |
parent | 5ebbb16f839208abf89472a7e135ec3118b8afa4 (diff) |
Update multiprotocol extension code to RFC 4760. This actually removes
a few things we actually never realy cared about.
OK henning@
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 19 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_update.c | 6 |
3 files changed, 12 insertions, 18 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 7851e448ae9..cf5231ed25d 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.212 2007/03/06 16:52:48 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.213 2007/03/16 13:52:30 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -688,11 +688,10 @@ struct rde_memstats { #define AFI_IPv6 2 #define AFI_ALL 0xffff -/* Subsequent Address Family Identifier as per rfc2858 */ +/* Subsequent Address Family Identifier as per rfc4760 */ #define SAFI_NONE 0x00 #define SAFI_UNICAST 0x01 #define SAFI_MULTICAST 0x02 -#define SAFI_BOTH 0x03 #define SAFI_ALL 0xff /* prototypes */ diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 1ff27167d25..8c9c858da77 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.220 2007/03/12 15:49:54 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.221 2007/03/16 13:52:30 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1366,14 +1366,11 @@ rde_get_mp_nexthop(u_char *data, u_int16_t len, u_int16_t afi, */ asp->nexthop->refcnt++; - totlen += nhlen; - data += nhlen; + /* ignore reserved (old SNPA) field as per RFC 4760 */ + totlen += nhlen + 1; + data += nhlen + 1; - if (*data != 0) { - log_warnx("SNPA are not supported for IPv6"); - return (-1); - } - return (++totlen); + return (totlen); default: log_warnx("bad multiprotocol nexthop, bad AF"); break; @@ -2429,8 +2426,7 @@ peer_dump(u_int32_t id, u_int16_t afi, u_int8_t safi) } if (afi == AFI_ALL || afi == AFI_IPv4) - if (safi == SAFI_ALL || safi == SAFI_UNICAST || - safi == SAFI_BOTH) { + if (safi == SAFI_ALL || safi == SAFI_UNICAST) { if (peer->conf.announce_type == ANNOUNCE_DEFAULT_ROUTE) up_generate_default(rules_l, peer, AF_INET); @@ -2438,8 +2434,7 @@ peer_dump(u_int32_t id, u_int16_t afi, u_int8_t safi) pt_dump(rde_up_dump_upcall, peer, AF_INET); } if (afi == AFI_ALL || afi == AFI_IPv6) - if (safi == SAFI_ALL || safi == SAFI_UNICAST || - safi == SAFI_BOTH) { + if (safi == SAFI_ALL || safi == SAFI_UNICAST) { if (peer->conf.announce_type == ANNOUNCE_DEFAULT_ROUTE) up_generate_default(rules_l, peer, AF_INET6); diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c index 28c69c49da3..fd4bb304d09 100644 --- a/usr.sbin/bgpd/rde_update.c +++ b/usr.sbin/bgpd/rde_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_update.c,v 1.53 2007/01/31 15:23:19 claudio Exp $ */ +/* $OpenBSD: rde_update.c,v 1.54 2007/03/16 13:52:30 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -554,7 +554,7 @@ up_generate_mp_reach(struct rde_peer *peer, struct update_attr *upa, switch (af) { case AF_INET6: - upa->mpattr_len = 21; /* AFI + SAFI + NH LEN + NH + SNPA LEN */ + upa->mpattr_len = 21; /* AFI + SAFI + NH LEN + NH + Reserved */ upa->mpattr = malloc(upa->mpattr_len); if (upa->mpattr == NULL) fatal("up_generate_mp_reach"); @@ -562,7 +562,7 @@ up_generate_mp_reach(struct rde_peer *peer, struct update_attr *upa, memcpy(upa->mpattr, &tmp, sizeof(tmp)); upa->mpattr[2] = SAFI_UNICAST; upa->mpattr[3] = sizeof(struct in6_addr); - upa->mpattr[20] = 0; /* SNPA always 0 */ + upa->mpattr[20] = 0; /* Reserved must be 0 */ /* nexthop dance see also up_get_nexthop() */ if (peer->conf.ebgp == 0) { |