summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_common.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-01-23 11:21:17 +0000
committerChris Hall <GMCH@hestia.halldom.com>2010-01-23 11:21:17 +0000
commit0341d5ce47c301b4a4d92b77a83930da4fdc8fb3 (patch)
treeacff360d75d85e711d65e8d4fbe5139bf19b25e0 /bgpd/bgp_common.c
parenteeda1184fa60c5077c2d404d0a8415d11e836ccd (diff)
downloadquagga-0341d5ce47c301b4a4d92b77a83930da4fdc8fb3.tar.bz2
quagga-0341d5ce47c301b4a4d92b77a83930da4fdc8fb3.tar.xz
Blitz on bgp_msg_read, particularly OPEN message handling
In the BGP Engine the OPEN message needs to be processed into the open_recv structure in the *connection*. The OPEN that arrives must be checked for acceptability before it is acknowledged. Later the connection may be discarded in collision resolution, or the connection may become the Established connection, and the open_recv structure is passed to the session and hence to the Peering Engine. modified: bgpd/bgp.h modified: bgpd/bgp_common.c modified: bgpd/bgp_common.h modified: bgpd/bgp_connection.c modified: bgpd/bgp_connection.h modified: bgpd/bgp_fsm.c modified: bgpd/bgp_msg_read.c modified: bgpd/bgp_msg_read.h modified: bgpd/bgp_msg_write.c modified: bgpd/bgp_notification.c modified: bgpd/bgp_notification.h modified: bgpd/bgp_open.h modified: bgpd/bgp_open_state.c modified: bgpd/bgp_open_state.h modified: bgpd/bgp_packet.c modified: bgpd/bgp_session.h modified: lib/distribute.c modified: lib/if_rmap.c modified: lib/qafi_safi.h modified: lib/stream.c modified: lib/stream.h
Diffstat (limited to 'bgpd/bgp_common.c')
-rw-r--r--bgpd/bgp_common.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/bgpd/bgp_common.c b/bgpd/bgp_common.c
index 15ecdf3b..90281ff5 100644
--- a/bgpd/bgp_common.c
+++ b/bgpd/bgp_common.c
@@ -109,11 +109,12 @@ const iSAFI_t iSAFI_map[] =
} ;
/*==============================================================================
- * Convert iAFI/iSAFI => qafx_num_t
- * and qAFI/qSAFI => qafx_num_t
+ * Convert iAFI/iSAFI => qafx_num_t -- tolerates unknown/reserved
+ * and qAFI/qSAFI => qafx_num_t -- tolerates undef, but not unknown
*/
-/* iAFI/iSAFI = qafx_num_t unknowns => qafx_num_other
+/*------------------------------------------------------------------------------
+ * iAFI/iSAFI => qafx_num_t unknowns => qafx_num_other
* reserved => qafx_num_undef
*/
extern qafx_num_t
@@ -170,7 +171,8 @@ qafx_num_from_iAFI_iSAFI(iAFI_t afi, iSAFI_t safi)
return qafx_num_other ;
} ;
-/* qAFI/qSAFI = qafx_num_t
+/*------------------------------------------------------------------------------
+ * qAFI/qSAFI => qafx_num_t
*
* NB: qAFI_undef with any qSAFI_xxx => qafx_num_undef
* qSAFI_undef with any qAFI_xxx => qafx_num_undef
@@ -228,3 +230,43 @@ qafx_num_from_qAFI_qSAFI(qAFI_t afi, qSAFI_t safi)
zabort("invalid qAFI or qSAFI") ;
} ;
+
+/*==============================================================================
+ * Convert iAFI/iSAFI => qafx_bit_t -- tolerates unknown/reserved
+ * and qAFI/qSAFI => qafx_bit_t -- tolerates undef, but not unknown
+ */
+
+/*------------------------------------------------------------------------------
+ * iAFI/iSAFI => qafx_bit_t unknowns => 0
+ * reserved => 0
+ */
+extern qafx_bit_t
+qafx_bit_from_iAFI_iSAFI(iAFI_t afi, iSAFI_t safi)
+{
+ qafx_num_t qn = qafx_num_from_iAFI_iSAFI(afi, safi) ;
+
+ if ((qn != qafx_num_undef) && (qn != qafx_num_other))
+ return qafx_bit(qn) ;
+ else
+ return 0 ;
+} ;
+
+/*------------------------------------------------------------------------------
+ * qAFI/qSAFI => qafx_bit_t
+ *
+ * NB: qAFI_undef with any qSAFI_xxx => 0
+ * qSAFI_undef with any qAFI_xxx => 0
+ * qSAFI_Unused qith any qAFI_xxx => 0
+ *
+ * NB: any unrecognised qAFI/qSAFI combinations => FATAL error
+ */
+extern qafx_bit_t
+qafx_bit_from_qAFI_qSAFI(qAFI_t afi, qSAFI_t safi)
+{
+ qafx_num_t qn = qafx_num_from_qAFI_qSAFI(afi, safi) ;
+
+ if ((qn != qafx_num_undef) && (qn != qafx_num_other))
+ return qafx_bit(qn) ;
+ else
+ return 0 ;
+} ;