summaryrefslogtreecommitdiff
path: root/lib/mpls.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpls.h')
-rw-r--r--lib/mpls.h62
1 files changed, 25 insertions, 37 deletions
diff --git a/lib/mpls.h b/lib/mpls.h
index 1f77aaa536..6cf0142755 100644
--- a/lib/mpls.h
+++ b/lib/mpls.h
@@ -14,15 +14,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QUAGGA_MPLS_H
#define _QUAGGA_MPLS_H
+#include <arpa/inet.h>
+
/* Well-known MPLS label values (RFC 3032 etc). */
#define MPLS_V4_EXP_NULL_LABEL 0
#define MPLS_RA_LABEL 1
@@ -83,7 +84,8 @@ enum lsp_types_t
{
ZEBRA_LSP_NONE = 0, /* No LSP. */
ZEBRA_LSP_STATIC = 1, /* Static LSP. */
- ZEBRA_LSP_LDP = 2 /* LDP LSP. */
+ ZEBRA_LSP_LDP = 2, /* LDP LSP. */
+ ZEBRA_LSP_BGP = 3 /* BGP LSP. */
};
/* Functions for basic label operations. */
@@ -120,62 +122,48 @@ mpls_lse_decode (mpls_lse_t lse, mpls_label_t *label,
*ttl = MPLS_LABEL_TTL(local_lse);
}
+/* Invalid label index value (when used with BGP Prefix-SID). Should
+ * match the BGP definition.
+ */
+#define MPLS_INVALID_LABEL_INDEX 0xFFFFFFFF
+
/* Printable string for labels (with consideration for reserved values). */
static inline char *
-label2str (mpls_label_t label, char *buf, int len)
+label2str (mpls_label_t label, char *buf, size_t len)
{
switch(label) {
case MPLS_V4_EXP_NULL_LABEL:
- strncpy(buf, "IPv4 Explicit Null", len);
+ strlcpy(buf, "IPv4 Explicit Null", len);
return(buf);
- break;
case MPLS_RA_LABEL:
- strncpy(buf, "Router Alert", len);
+ strlcpy(buf, "Router Alert", len);
return(buf);
- break;
case MPLS_V6_EXP_NULL_LABEL:
- strncpy(buf, "IPv6 Explict Null", len);
+ strlcpy(buf, "IPv6 Explict Null", len);
return(buf);
- break;
case MPLS_IMP_NULL_LABEL:
- strncpy(buf, "implicit-null", len);
+ strlcpy(buf, "implicit-null", len);
return(buf);
- break;
case MPLS_ENTROPY_LABEL_INDICATOR:
- strncpy(buf, "Entropy Label Indicator", len);
+ strlcpy(buf, "Entropy Label Indicator", len);
return(buf);
- break;
case MPLS_GAL_LABEL:
- strncpy(buf, "Generic Associated Channel", len);
+ strlcpy(buf, "Generic Associated Channel", len);
return(buf);
- break;
case MPLS_OAM_ALERT_LABEL:
- strncpy(buf, "OAM Alert", len);
+ strlcpy(buf, "OAM Alert", len);
return(buf);
- break;
case MPLS_EXTENSION_LABEL:
- strncpy(buf, "Extension", len);
+ strlcpy(buf, "Extension", len);
return(buf);
- break;
- case 4:
- case 5:
- case 6:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- strncpy(buf, "Reserved", len);
- return(buf);
- break;
default:
- sprintf(buf, "%u", label);
+ if (label < 16)
+ snprintf(buf, len, "Reserved (%u)", label);
+ else
+ snprintf(buf, len, "%u", label);
return(buf);
}
-
- strncpy(buf, "Error", len);
- return(buf);
}
/* constants used by ldpd */