Browse Source

Merge remote-tracking branch 'quagga-gnu.org/master'

Paul Jakma 8 years ago
parent
commit
9fc7574239
3 changed files with 18 additions and 9 deletions
  1. 9 5
      bgpd/bgp_open.c
  2. 7 3
      bgpd/bgp_packet.c
  3. 2 1
      tools/multiple-bgpd.sh

+ 9 - 5
bgpd/bgp_open.c

@@ -421,13 +421,20 @@ bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
 static as_t
 bgp_capability_as4 (struct peer *peer, struct capability_header *hdr)
 {
+  SET_FLAG (peer->cap, PEER_CAP_AS4_RCV);
+  
+  if (hdr->length != CAPABILITY_CODE_AS4_LEN)
+    {
+      zlog_err ("%s AS4 capability has incorrect data length %d",
+                peer->host, hdr->length);
+      return 0;
+    }
+  
   as_t as4 = stream_getl (BGP_INPUT(peer));
   
   if (BGP_DEBUG (as4, AS4))
     zlog_debug ("%s [AS4] about to set cap PEER_CAP_AS4_RCV, got as4 %u",
                 peer->host, as4);
-  SET_FLAG (peer->cap, PEER_CAP_AS4_RCV);
-  
   return as4;
 }
 
@@ -689,9 +696,6 @@ peek_for_as4_capability (struct peer *peer, u_char length)
 
 	      if (hdr.code == CAPABILITY_CODE_AS4)
 	        {
-	          if (hdr.length != CAPABILITY_CODE_AS4_LEN)
-	            goto end;
-                  
 	          if (BGP_DEBUG (as4, AS4))
 	            zlog_info ("[AS4] found AS4 capability, about to parse");
 	          as4 = bgp_capability_as4 (peer, &hdr);

+ 7 - 3
bgpd/bgp_packet.c

@@ -1459,9 +1459,13 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
   /* Open option part parse. */
   if (optlen != 0) 
     {
-      ret = bgp_open_option_parse (peer, optlen, &capability);
-      if (ret < 0)
-	return ret;
+      if ((ret = bgp_open_option_parse (peer, optlen, &capability)) < 0)
+        {
+          bgp_notify_send (peer,
+                 BGP_NOTIFY_OPEN_ERR,
+                 BGP_NOTIFY_OPEN_UNACEP_HOLDTIME);
+	  return ret;
+        }
     }
   else
     {

+ 2 - 1
tools/multiple-bgpd.sh

@@ -20,7 +20,7 @@ for H in `seq 1 ${NUM}` ; do
 	if [ ! -e "$CONF" ] ; then
 		# This sets up a ring of bgpd peerings
 		NEXT=$(( ($H % ${NUM}) + 1 ))
-		PREV=$(( (($H + 3) % ${NUM}) + 1 ))
+		PREV=$(( (($H + $NUM - 2) % ${NUM}) + 1 ))
 		NEXTADDR="${PREFIX}${NEXT}"
 		NEXTAS=$((${ASBASE} + $NEXT))
 		PREVADDR="${PREFIX}${PREV}"
@@ -60,6 +60,7 @@ for H in `seq 1 ${NUM}` ; do
 			 neighbor ${PREVADDR} peer-group default
 			 exit-address-family
 			!
+			! bgpd still has problems with extcommunity rt/soo
 			route-map test permit 10
 			 set extcommunity rt ${ASN}:1
 			 set extcommunity soo ${ASN}:2