]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_fpm_netlink.c
zebra: let /32 host route with same IP cross VRF
[mirror_frr.git] / zebra / zebra_fpm_netlink.c
index efbd078a526352bc2cb7c228b7d1e80be2f34fc5..ec22c5dd484bf06c0fafef2f43ec6c45dc773091 100644 (file)
@@ -116,6 +116,8 @@ struct fpm_nh_encap_info_t {
  * data structures for convenience.
  */
 struct netlink_nh_info {
+       /* Weight of the nexthop ( for unequal cost ECMP ) */
+       uint8_t weight;
        uint32_t if_index;
        union g_addr *gateway;
 
@@ -179,6 +181,7 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri,
        nhi.recursive = nexthop->rparent ? 1 : 0;
        nhi.type = nexthop->type;
        nhi.if_index = nexthop->ifindex;
+       nhi.weight = nexthop->weight;
 
        if (nexthop->type == NEXTHOP_TYPE_IPV4
            || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) {
@@ -189,7 +192,12 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri,
 
        if (nexthop->type == NEXTHOP_TYPE_IPV6
            || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) {
-               nhi.gateway = &nexthop->gate;
+               /* Special handling for IPv4 route with IPv6 Link Local next hop
+                */
+               if (ri->af == AF_INET)
+                       nhi.gateway = &ipv4ll_gateway;
+               else
+                       nhi.gateway = &nexthop->gate;
        }
 
        if (nexthop->type == NEXTHOP_TYPE_IFINDEX) {
@@ -276,7 +284,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd,
        ri->af = rib_dest_af(dest);
 
        if (zvrf && zvrf->zns)
-               ri->nlmsg_pid = zvrf->zns->netlink_dplane.snl.nl_pid;
+               ri->nlmsg_pid = zvrf->zns->netlink_dplane_out.snl.nl_pid;
 
        ri->nlmsg_type = cmd;
        ri->rtm_table = table_info->table_id;
@@ -475,6 +483,8 @@ static int netlink_route_info_encode(struct netlink_route_info *ri,
                        rtnh->rtnh_ifindex = nhi->if_index;
                }
 
+               rtnh->rtnh_hops = nhi->weight;
+
                encap = nhi->encap_info.encap_type;
                switch (encap) {
                case FPM_NH_ENCAP_NONE: