]> git.proxmox.com Git - mirror_frr.git/blobdiff - pbrd/pbr_zebra.c
Merge pull request #2992 from opensourcerouting/large_as_path_fix
[mirror_frr.git] / pbrd / pbr_zebra.c
index cdb01bae9ed89bb9f9534c6073c7889f474711e2..25d64238bfd3b6ced06a290e6795e8bad96d93db 100644 (file)
@@ -45,17 +45,6 @@ DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface")
 /* Zebra structure to hold current status. */
 struct zclient *zclient;
 
-static struct interface *zebra_interface_if_lookup(struct stream *s)
-{
-       char ifname_tmp[INTERFACE_NAMSIZ];
-
-       /* Read interface name. */
-       stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
-
-       /* And look it up. */
-       return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
-}
-
 struct pbr_interface *pbr_if_new(struct interface *ifp)
 {
        struct pbr_interface *pbr_ifp;
@@ -65,13 +54,8 @@ struct pbr_interface *pbr_if_new(struct interface *ifp)
 
        pbr_ifp = XCALLOC(MTYPE_PBR_INTERFACE, sizeof(*pbr_ifp));
 
-       if (!pbr_ifp) {
-               zlog_err("%s: PBR XCALLOC(%zu) failure", __PRETTY_FUNCTION__,
-                        sizeof(*pbr_ifp));
-               return 0;
-       }
-
-       return (pbr_ifp);
+       ifp->info = pbr_ifp;
+       return pbr_ifp;
 }
 
 /* Inteface addition message from zebra. */
@@ -85,12 +69,8 @@ static int interface_add(int command, struct zclient *zclient,
        if (!ifp)
                return 0;
 
-       if (!ifp->info) {
-               struct pbr_interface *pbr_ifp;
-
-               pbr_ifp = pbr_if_new(ifp);
-               ifp->info = pbr_ifp;
-       }
+       if (!ifp->info)
+               pbr_if_new(ifp);
 
        return 0;
 }
@@ -140,7 +120,7 @@ static int interface_state_up(int command, struct zclient *zclient,
                              zebra_size_t length, vrf_id_t vrf_id)
 {
 
-       zebra_interface_if_lookup(zclient->ibuf);
+       zebra_interface_state_read(zclient->ibuf, vrf_id);
 
        return 0;
 }
@@ -236,7 +216,9 @@ static int rule_notify_owner(int command, struct zclient *zclient,
                DEBUGD(&pbr_dbg_zebra, "%s: Recived RULE_INSTALLED",
                       __PRETTY_FUNCTION__);
                break;
+       case ZAPI_RULE_FAIL_REMOVE:
        case ZAPI_RULE_REMOVED:
+               pbrms->installed &= ~installed;
                DEBUGD(&pbr_dbg_zebra, "%s: Received RULE REMOVED",
                       __PRETTY_FUNCTION__);
                break;
@@ -492,6 +474,7 @@ static void pbr_encode_pbr_map_sequence(struct stream *s,
        stream_putw(s, 0);  /* src port */
        pbr_encode_pbr_map_sequence_prefix(s, pbrms->dst, family);
        stream_putw(s, 0);  /* dst port */
+       stream_putl(s, 0);  /* fwmark */
        if (pbrms->nhgrp_name)
                stream_putl(s, pbr_nht_get_table(pbrms->nhgrp_name));
        else if (pbrms->nhg)
@@ -504,7 +487,7 @@ void pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
 {
        struct pbr_map *pbrm = pbrms->parent;
        struct stream *s;
-       uint64_t is_installed = 1 << pmi->install_bit;
+       uint64_t is_installed = (uint64_t)1 << pmi->install_bit;
 
        is_installed &= pbrms->installed;