@@ -85,7 +85,7 @@ int bgp_parse_fec_update(void)
85
85
if (label == MPLS_INVALID_LABEL )
86
86
bgp_unset_valid_label (& dest -> local_label );
87
87
else {
88
- label_ntop (label , 1 , & dest -> local_label );
88
+ dest -> local_label = mpls_lse_encode (label , 0 , 0 , 1 );
89
89
bgp_set_valid_label (& dest -> local_label );
90
90
}
91
91
SET_FLAG (dest -> flags , BGP_NODE_LABEL_CHANGED );
@@ -129,9 +129,16 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
129
129
uint16_t flags = 0 ;
130
130
size_t flags_pos = 0 ;
131
131
mpls_label_t * local_label = & (dest -> local_label );
132
- bool have_label_to_reg =
133
- bgp_is_valid_label (local_label )
134
- && label_pton (local_label ) != MPLS_LABEL_IMPLICIT_NULL ;
132
+ uint32_t ttl = 0 ;
133
+ uint32_t bos = 0 ;
134
+ uint32_t exp = 0 ;
135
+ mpls_label_t label = MPLS_INVALID_LABEL ;
136
+ bool have_label_to_reg ;
137
+
138
+ mpls_lse_decode (* local_label , & label , & ttl , & exp , & bos );
139
+
140
+ have_label_to_reg = bgp_is_valid_label (local_label ) &&
141
+ label != MPLS_LABEL_IMPLICIT_NULL ;
135
142
136
143
p = bgp_dest_get_prefix (dest );
137
144
@@ -142,7 +149,7 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
142
149
if (BGP_DEBUG (labelpool , LABELPOOL ))
143
150
zlog_debug ("%s: FEC %sregister %pRN label_index=%u label=%u" ,
144
151
__func__ , reg ? "" : "un" , bgp_dest_to_rnode (dest ),
145
- label_index , label_pton ( local_label ) );
152
+ label_index , label );
146
153
/* If the route node has a local_label assigned or the
147
154
* path node has an MPLS SR label index allowing zebra to
148
155
* derive the label, proceed with registration. */
@@ -161,7 +168,7 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
161
168
stream_putl (s , label_index );
162
169
} else if (have_label_to_reg ) {
163
170
flags |= ZEBRA_FEC_REGISTER_LABEL ;
164
- stream_putl (s , label_pton ( local_label ) );
171
+ stream_putl (s , label );
165
172
}
166
173
SET_FLAG (dest -> flags , BGP_NODE_REGISTERED_FOR_LABEL );
167
174
} else
@@ -216,13 +223,13 @@ int bgp_reg_for_label_callback(mpls_label_t new_label, void *labelid,
216
223
*/
217
224
if (CHECK_FLAG (dest -> flags , BGP_NODE_REGISTERED_FOR_LABEL )) {
218
225
UNSET_FLAG (dest -> flags , BGP_NODE_LABEL_REQUESTED );
219
- label_ntop ( MPLS_LABEL_IMPLICIT_NULL , 1 ,
220
- & dest -> local_label );
226
+ dest -> local_label = mpls_lse_encode (
227
+ MPLS_LABEL_IMPLICIT_NULL , 0 , 0 , 1 );
221
228
bgp_set_valid_label (& dest -> local_label );
222
229
}
223
230
}
224
231
225
- label_ntop (new_label , 1 , & dest -> local_label );
232
+ dest -> local_label = mpls_lse_encode (new_label , 0 , 0 , 1 );
226
233
bgp_set_valid_label (& dest -> local_label );
227
234
228
235
/*
@@ -238,9 +245,16 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
238
245
{
239
246
bool with_label_index = false;
240
247
const struct prefix * p ;
241
- bool have_label_to_reg =
242
- bgp_is_valid_label (& dest -> local_label )
243
- && label_pton (& dest -> local_label ) != MPLS_LABEL_IMPLICIT_NULL ;
248
+ bool have_label_to_reg ;
249
+ uint32_t ttl = 0 ;
250
+ uint32_t bos = 0 ;
251
+ uint32_t exp = 0 ;
252
+ mpls_label_t label = MPLS_INVALID_LABEL ;
253
+
254
+ mpls_lse_decode (dest -> local_label , & label , & ttl , & exp , & bos );
255
+
256
+ have_label_to_reg = bgp_is_valid_label (& dest -> local_label ) &&
257
+ label != MPLS_LABEL_IMPLICIT_NULL ;
244
258
245
259
p = bgp_dest_get_prefix (dest );
246
260
@@ -283,8 +297,7 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
283
297
}
284
298
} else {
285
299
UNSET_FLAG (dest -> flags , BGP_NODE_LABEL_REQUESTED );
286
- bgp_lp_release (LP_TYPE_BGP_LU , dest ,
287
- label_pton (& dest -> local_label ));
300
+ bgp_lp_release (LP_TYPE_BGP_LU , dest , label );
288
301
}
289
302
290
303
bgp_send_fec_register_label_msg (
0 commit comments