summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/ChangeLog10
-rw-r--r--bgpd/bgp_attr.c4
-rw-r--r--bgpd/bgp_attr.h4
-rw-r--r--bgpd/bgp_packet.c24
4 files changed, 26 insertions, 16 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 2a442f27..a0ba520c 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,13 @@
+2006-05-04 Paul Jakma <paul.jakma@sun.com>
+
+ * (general) VPNv4 fixes. Certain VPNv4 code was not enabled.
+ See bug #210.
+ * bgp_attr.{c,h}: (bgp_packet_{withdraw,attribute}) Tag should be
+ u_char really.
+ * bgp_packet.c: (bgp_{update,withdraw}_packet) Enable some
+ VPNv4 code which inexplicably was ifdef'd out. comments from
+ a tester on IRC suggest this fixes bug #210.
+
2006-03-30 Paul Jakma <paul.jakma@sun.com>
* bgp_community.c: (community_gettoken) Unknown token should
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 27ddab11..e9dde0fd 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1350,7 +1350,7 @@ bgp_size_t
bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
struct stream *s, struct attr *attr, struct prefix *p,
afi_t afi, safi_t safi, struct peer *from,
- struct prefix_rd *prd, char *tag)
+ struct prefix_rd *prd, u_char *tag)
{
size_t cp;
unsigned int aspath_data_size;
@@ -1703,7 +1703,7 @@ bgp_packet_attribute (struct bgp *bgp, struct peer *peer,
bgp_size_t
bgp_packet_withdraw (struct peer *peer, struct stream *s, struct prefix *p,
afi_t afi, safi_t safi, struct prefix_rd *prd,
- char *tag)
+ u_char *tag)
{
unsigned long cp;
unsigned long attrlen_pnt;
diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h
index a018256f..777869ce 100644
--- a/bgpd/bgp_attr.h
+++ b/bgpd/bgp_attr.h
@@ -123,10 +123,10 @@ extern struct attr *bgp_attr_aggregate_intern (struct bgp *, u_char,
extern bgp_size_t bgp_packet_attribute (struct bgp *bgp, struct peer *,
struct stream *, struct attr *,
struct prefix *, afi_t, safi_t,
- struct peer *, struct prefix_rd *, char *);
+ struct peer *, struct prefix_rd *, u_char *);
extern bgp_size_t bgp_packet_withdraw (struct peer *peer, struct stream *s,
struct prefix *p, afi_t, safi_t,
- struct prefix_rd *, char *);
+ struct prefix_rd *, u_char *);
extern void bgp_dump_routes_attr (struct stream *, struct attr *,
struct prefix *);
extern unsigned int attrhash_key_make (struct attr *);
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 07c3cbb1..8b024a1c 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -150,8 +150,6 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
bgp_size_t total_attr_len = 0;
unsigned long pos;
char buf[BUFSIZ];
- struct prefix_rd *prd = NULL;
- char *tag = NULL;
s = peer->work;
stream_reset (s);
@@ -165,12 +163,6 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
adj = adv->adj;
if (adv->binfo)
binfo = adv->binfo;
-#ifdef MPLS_VPN
- if (rn)
- prd = (struct prefix_rd *) &rn->prn->p;
- if (binfo)
- tag = binfo->tag;
-#endif /* MPLS_VPN */
/* When remaining space can't include NLRI and it's length. */
if (rn && STREAM_REMAIN (s) <= BGP_NLRI_LENGTH + PSIZE (rn->p.prefixlen))
@@ -179,6 +171,14 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi)
/* If packet is empty, set attribute. */
if (stream_empty (s))
{
+ struct prefix_rd *prd = NULL;
+ u_char *tag = NULL;
+
+ if (rn->prn)
+ prd = (struct prefix_rd *) &rn->prn->p;
+ if (binfo)
+ tag = binfo->tag;
+
bgp_packet_set_marker (s, BGP_MSG_UPDATE);
stream_putw (s, 0);
pos = stream_get_endp (s);
@@ -282,7 +282,6 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
bgp_size_t unfeasible_len;
bgp_size_t total_attr_len;
char buf[BUFSIZ];
- struct prefix_rd *prd = NULL;
s = peer->work;
stream_reset (s);
@@ -291,9 +290,6 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
{
adj = adv->adj;
rn = adv->rn;
-#ifdef MPLS_VPN
- prd = (struct prefix_rd *) &rn->prn->p;
-#endif /* MPLS_VPN */
if (STREAM_REMAIN (s)
< (BGP_NLRI_LENGTH + BGP_TOTAL_ATTR_LEN + PSIZE (rn->p.prefixlen)))
@@ -309,6 +305,10 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi)
stream_put_prefix (s, &rn->p);
else
{
+ struct prefix_rd *prd = NULL;
+
+ if (rn->prn)
+ prd = (struct prefix_rd *) &rn->prn->p;
pos = stream_get_endp (s);
stream_putw (s, 0);
total_attr_len