bgpd: wire up VPNv6 protocol processing

There wasn't much missing for VPNv6 to begin with; just a few bits of
de- & encoding and a few lists to be updated.

Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>

[Editorial note: Signed-off-by may imply an authorship claim, but need not]

Edited-by: Paul Jakma <paul.jakma@hpe.com> / <paul@jakma.org>
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 7a5f5ce..302e4ce 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -842,7 +842,8 @@
 	  && ! peer->afc_nego[AFI_IP][SAFI_MULTICAST]
 	  && ! peer->afc_nego[AFI_IP][SAFI_MPLS_VPN]
 	  && ! peer->afc_nego[AFI_IP6][SAFI_UNICAST]
-	  && ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST])
+	  && ! peer->afc_nego[AFI_IP6][SAFI_MULTICAST]
+	  && ! peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN])
 	{
 	  plog_err (peer->log, "%s [Error] Configured AFI/SAFIs do not "
 		    "overlap with received MP capabilities",
@@ -1012,6 +1013,18 @@
       stream_putc (s, 0);
       stream_putc (s, SAFI_MULTICAST);
     }
+  /* IPv6 VPN. */
+  if (peer->afc[AFI_IP6][SAFI_MPLS_VPN])
+    {
+      peer->afc_adv[AFI_IP6][SAFI_MPLS_VPN] = 1;
+      stream_putc (s, BGP_OPEN_OPT_CAP);
+      stream_putc (s, CAPABILITY_CODE_MP_LEN + 2);
+      stream_putc (s, CAPABILITY_CODE_MP);
+      stream_putc (s, CAPABILITY_CODE_MP_LEN);
+      stream_putw (s, AFI_IP6);
+      stream_putc (s, 0);
+      stream_putc (s, SAFI_MPLS_LABELED_VPN);
+    }
 #endif /* HAVE_IPV6 */
 
   /* Route refresh. */