summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-11-17 02:41:37 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-11-17 02:41:37 +0100
commit0f1e3463b6a722d8076fa61fe56f3b4de5f0e76b (patch)
treed531b5a86e1a244be904627f983251caed02c8e9 /proto
parent5b885bf70848908c7fed07c8efba18ea316379d4 (diff)
downloadbird-0f1e3463b6a722d8076fa61fe56f3b4de5f0e76b.tar
bird-0f1e3463b6a722d8076fa61fe56f3b4de5f0e76b.zip
BGP: Enable sending of multicast routes, for IPv6multicast-old
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.h4
-rw-r--r--proto/bgp/packets.c27
2 files changed, 22 insertions, 9 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 6f998b0..066dc27 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -74,8 +74,8 @@ struct bgp_conn {
int start_state; /* protocol start_state snapshot when connection established */
int want_as4_support; /* Connection tries to establish AS4 session */
int peer_as4_support; /* Peer supports 4B AS numbers [RFC4893] */
- int want_multicast_support; /* We want to exchange multicast routes */
- int peer_multicast_support; /* Peer supports multicast routes [RFC4760] */
+ int want_multicast_support; /* We want to exchange multicast routes */
+ int peer_multicast_support; /* Peer supports multicast routes [RFC4760] */
int peer_refresh_support; /* Peer supports route refresh [RFC2918] */
unsigned hold_time, keepalive_time; /* Times calculated from my and neighbor's requirements */
};
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 8e657cc..ad3a0bb 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -6,7 +6,7 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
-#define LOCAL_DEBUG
+#undef LOCAL_DEBUG
#include "nest/bird.h"
#include "nest/iface.h"
@@ -335,10 +335,12 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
#else /* IPv6 version */
static byte *
-bgp_create_update(struct bgp_conn *conn, byte *buf)
+bgp_create_update_cast(struct bgp_conn *conn, byte *buf, int cast)
{
struct bgp_proto *p = conn->bgp;
- struct bgp_bucket_info *bi = &p->unicast_buckets;
+ int multicast = (cast == RTC_MULTICAST);
+ struct bgp_bucket_info *bi = multicast ? &p->multicast_buckets : &p->unicast_buckets;
+ int sub = multicast ? BGP_SAF_MULTICAST : BGP_SAF_UNICAST;
struct bgp_bucket *buck;
int size, second, rem_stored;
int remains = BGP_MAX_PACKET_LENGTH - BGP_HEADER_LENGTH - 4;
@@ -357,7 +359,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
tmp = bgp_attach_attr_wa(&ea, bgp_linpool, BA_MP_UNREACH_NLRI, remains-8);
*tmp++ = 0;
*tmp++ = BGP_AF_IPV6;
- *tmp++ = BGP_SAF_UNICAST;
+ *tmp++ = sub;
ea->attrs[0].u.ptr->length = 3 + bgp_encode_prefixes(bi, tmp, buck, remains-11);
size = bgp_encode_attrs(p, w, ea, remains);
ASSERT(size >= 0);
@@ -449,7 +451,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
tstart = tmp = bgp_attach_attr_wa(&ea, bgp_linpool, BA_MP_REACH_NLRI, remains-8);
*tmp++ = 0;
*tmp++ = BGP_AF_IPV6;
- *tmp++ = 1;
+ *tmp++ = sub;
if (ipa_nonzero(ip_ll))
{
@@ -490,6 +492,17 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
return NULL;
}
+static byte *
+bgp_create_update(struct bgp_conn *conn, byte *buf)
+{
+ byte *end = bgp_create_update_cast(conn, buf, RTC_UNICAST);
+
+ if ((!end) && conn->bgp->multicast_session)
+ end = bgp_create_update_cast(conn, buf, RTC_MULTICAST);
+
+ return end;
+}
+
#endif
static byte *
@@ -500,8 +513,8 @@ bgp_create_route_refresh(struct bgp_conn *conn, byte *buf)
*buf++ = 0;
*buf++ = BGP_AF;
- *buf++ = 0; /* RFU */
- *buf++ = 1; /* and SAFI 1 */
+ *buf++ = 0; /* RFU */
+ *buf++ = BGP_SAF_UNICAST; /* and SAFI 1 */
return buf;
}