summaryrefslogtreecommitdiffstats
path: root/proto/bgp/bgp.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-04-29 18:58:24 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-04-29 18:58:24 +0200
commit4827b69ff43661f4f34d437999b0edaac76f7355 (patch)
tree4e36a37b04fa4ba6bf363887fe4ecc65016e7fee /proto/bgp/bgp.h
parentad440a570b37e8674ef35f3a18df48f0eb2579eb (diff)
downloadbird-4827b69ff43661f4f34d437999b0edaac76f7355.tar
bird-4827b69ff43661f4f34d437999b0edaac76f7355.zip
Fixes BGP IPv6 link local next hop handling.
When sending 'third party' BGP update, Bird used bogus link local addresses instead of addresses it received before.
Diffstat (limited to 'proto/bgp/bgp.h')
-rw-r--r--proto/bgp/bgp.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/proto/bgp/bgp.h b/proto/bgp/bgp.h
index 83ed9c7..8477f9e 100644
--- a/proto/bgp/bgp.h
+++ b/proto/bgp/bgp.h
@@ -148,6 +148,17 @@ void bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code
/* attrs.c */
+/* Hack: although BA_NEXT_HOP attribute has type EAF_TYPE_IP_ADDRESS, in IPv6
+ * we store two addesses in it - a global address and a link local address.
+ */
+#ifdef IPV6
+#define NEXT_HOP_LENGTH (2*sizeof(ip_addr))
+static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = addr; ((ip_addr *) b)[1] = IPA_NONE; }
+#else
+#define NEXT_HOP_LENGTH sizeof(ip_addr)
+static inline void set_next_hop(byte *b, ip_addr addr) { ((ip_addr *) b)[0] = addr; }
+#endif
+
void bgp_attach_attr(struct ea_list **to, struct linpool *pool, unsigned attr, uintptr_t val);
byte *bgp_attach_attr_wa(struct ea_list **to, struct linpool *pool, unsigned attr, unsigned len);
struct rta *bgp_decode_attrs(struct bgp_conn *conn, byte *a, unsigned int len, struct linpool *pool, int mandatory);