summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_label.h
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2017-06-16 21:12:57 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2017-06-16 21:12:57 +0200
commit9bedbb1e52fbef082702723ee0a119d76a997ec8 (patch)
tree4732c6ea051da93c49e01910192226828e54781f /bgpd/bgp_label.h
parentMerge pull request #718 from qlyoung/fix-vtysh-shit (diff)
downloadfrr-9bedbb1e52fbef082702723ee0a119d76a997ec8.tar.xz
frr-9bedbb1e52fbef082702723ee0a119d76a997ec8.zip
bgpd: Install SAFI_LABELED_UNICAST routes in SAFI_UNICAST table
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> - All ipv4 labeled-unicast routes are now installed in the ipv4 unicast table. This allows us to do things like take routes from an ipv4 unicast peer, allocate a label for them and TX them to a ipv4 labeled-unicast peer. We can do the opposite where we take routes from a labeled-unicast peer, remove the label and advertise them to an ipv4 unicast peer. - Multipath over a labeled route and non-labeled route is not allowed. - You cannot activate a peer for both 'ipv4 unicast' and 'ipv4 labeled-unicast' - The 'tag' variable was overloaded for zebra's route tag feature as well as the mpls label. I added a 'mpls_label_t mpls' variable to avoid this. This is much cleaner but resulted in touching a lot of code.
Diffstat (limited to 'bgpd/bgp_label.h')
-rw-r--r--bgpd/bgp_label.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/bgpd/bgp_label.h b/bgpd/bgp_label.h
index dbc675dd4..796df6652 100644
--- a/bgpd/bgp_label.h
+++ b/bgpd/bgp_label.h
@@ -32,8 +32,8 @@ struct peer;
extern void bgp_reg_dereg_for_label (struct bgp_node *rn, struct bgp_info *ri,
int reg);
extern int bgp_parse_fec_update(void);
-extern u_char * bgp_adv_label(struct bgp_node *rn, struct bgp_info *ri,
- struct peer *to, afi_t afi, safi_t safi);
+extern mpls_label_t bgp_adv_label(struct bgp_node *rn, struct bgp_info *ri,
+ struct peer *to, afi_t afi, safi_t safi);
extern int bgp_nlri_parse_label (struct peer *peer, struct attr *attr,
struct bgp_nlri *packet);
@@ -48,38 +48,35 @@ bgp_labeled_safi (safi_t safi)
}
static inline int
-bgp_is_withdraw_label (u_char *pkt)
+bgp_is_withdraw_label (mpls_label_t *label)
{
+ u_char *pkt = (u_char *) label;
if ((pkt[0] == 0x80) && (pkt[1] == 0x00) && (pkt[2] == 0x00))
return 1;
return 0;
}
-static inline u_char *
-bgp_encode_withdraw_label (u_char *pkt)
-{
- *pkt++ = 0x80; *pkt++ = 0x00; *pkt++ = 0x00;
- return pkt;
-}
-
static inline int
-bgp_is_valid_label (u_char *t)
+bgp_is_valid_label (mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
if (!t)
return 0;
return (t[2] & 0x02);
}
static inline void
-bgp_set_valid_label (u_char *t)
+bgp_set_valid_label (mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
if (t)
t[2] |= 0x02;
}
static inline void
-bgp_unset_valid_label (u_char *t)
+bgp_unset_valid_label (mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
if (t)
t[2] &= ~0x02;
}
@@ -98,16 +95,18 @@ bgp_unregister_for_label (struct bgp_node *rn)
/* Label stream to value */
static inline u_int32_t
-label_pton (u_char t[])
+label_pton (mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
return ((((unsigned int) t[0]) << 12) | (((unsigned int) t[1]) << 4) |
((unsigned int) ((t[2] & 0xF0) >> 4)));
}
/* Encode label values */
static inline void
-label_ntop (u_int32_t l, int bos, u_char t[])
+label_ntop (u_int32_t l, int bos, mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
t[0] = ((l & 0x000FF000) >> 12);
t[1] = ((l & 0x00000FF0) >> 4);
t[2] = ((l & 0x0000000F) << 4);
@@ -117,8 +116,9 @@ label_ntop (u_int32_t l, int bos, u_char t[])
/* Return BOS value of label stream */
static inline u_char
-label_bos (u_char t[])
+label_bos (mpls_label_t *label)
{
+ u_char *t= (u_char *) label;
return (t[2] & 0x01);
};