[bgpd] bug #210: Enable crucial VPNv4 code which was disabled
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.
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 07c3cbb..8b024a1 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -150,8 +150,6 @@
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 @@
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 @@
/* 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_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 @@
{
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 @@
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