From 7d061b3cb120c35c5b580bbbcfb1ec9602f58956 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 14 Feb 2018 01:11:09 -0500 Subject: lib, sharpd, zebra: Update the zapi_vrf_label call to add afi Add the ability to pass in an afi to zebra. zebra_vrf keeps track of the afi/label tuple and then does the right thing before we call down. AF_MPLS does not care about v4 or v6 it just knows label and what device to use for lookup. Signed-off-by: Donald Sharp --- sharpd/sharp_vty.c | 7 +++++-- sharpd/sharp_zebra.c | 4 ++-- sharpd/sharp_zebra.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'sharpd') diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 4f7d61b22..0e7d1f2c2 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -80,14 +80,17 @@ DEFPY (install_routes, } DEFPY(vrf_label, vrf_label_cmd, - "sharp label vrf NAME$name label (0-100000)$label", + "sharp label vrf NAME$name label (0-100000)$label", "Sharp Routing Protocol\n" "Give a vrf a label\n" + "Pop and forward for IPv4\n" + "Pop and forward for IPv6\n" VRF_CMD_HELP_STR "The label to use, 0 specifies remove the label installed from previous\n" "Specified range to use\n") { struct vrf *vrf; + afi_t afi = (ipv4) ? AFI_IP : AFI_IP6; if (strcmp(name, "default") == 0) vrf = vrf_lookup_by_id(VRF_DEFAULT); @@ -102,7 +105,7 @@ DEFPY(vrf_label, vrf_label_cmd, if (label == 0) label = MPLS_LABEL_NONE; - vrf_label_add(vrf->vrf_id, label); + vrf_label_add(vrf->vrf_id, afi, label); return CMD_SUCCESS; } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index f771e53f0..78e8cf0ad 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -152,9 +152,9 @@ static void zebra_connected(struct zclient *zclient) zclient_send_reg_requests(zclient, VRF_DEFAULT); } -void vrf_label_add(vrf_id_t vrf_id, mpls_label_t label) +void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label) { - zclient_send_vrf_label(zclient, vrf_id, label, ZEBRA_LSP_SHARP); + zclient_send_vrf_label(zclient, vrf_id, afi, label, ZEBRA_LSP_SHARP); } void route_add(struct prefix *p, struct nexthop *nh) diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h index 281c67ff9..0bba443bd 100644 --- a/sharpd/sharp_zebra.h +++ b/sharpd/sharp_zebra.h @@ -24,7 +24,7 @@ extern void sharp_zebra_init(void); -extern void vrf_label_add(vrf_id_t vrf_id, mpls_label_t label); +extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label); extern void route_add(struct prefix *p, struct nexthop *nh); extern void route_delete(struct prefix *p); #endif -- cgit v1.2.3