]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripd/rip_zebra.c
Merge pull request #1484 from chiragshah6/ospfv3_dev
[mirror_frr.git] / ripd / rip_zebra.c
index 28144a24351dd2aaf83233d949fb8e14f9bb22ea..041635e1533d315ac329b0dffdddd8ba09e6d49c 100644 (file)
@@ -56,7 +56,7 @@ static void rip_zebra_ipv4_send(struct route_node *rp, u_char cmd)
                if (count >= MULTIPATH_NUM)
                        break;
                api_nh = &api.nexthops[count];
-               api_nh->gate.ipv4 = rinfo->nexthop;
+               api_nh->gate = rinfo->nh.gate;
                api_nh->type = NEXTHOP_TYPE_IPV4;
                if (cmd == ZEBRA_ROUTE_ADD)
                        SET_FLAG(rinfo->flags, RIP_RTF_FIB);
@@ -121,8 +121,7 @@ static int rip_zebra_read_route(int command, struct zclient *zclient,
                                zebra_size_t length, vrf_id_t vrf_id)
 {
        struct zapi_route api;
-       struct in_addr nexthop;
-       unsigned long ifindex;
+       struct nexthop nh;
 
        if (!rip)
                return 0;
@@ -130,19 +129,21 @@ static int rip_zebra_read_route(int command, struct zclient *zclient,
        if (zapi_route_decode(zclient->ibuf, &api) < 0)
                return -1;
 
-       nexthop = api.nexthops[0].gate.ipv4;
-       ifindex = api.nexthops[0].ifindex;
+       memset(&nh, 0, sizeof(nh));
+       nh.type = api.nexthops[0].type;
+       nh.gate.ipv4 = api.nexthops[0].gate.ipv4;
+       nh.ifindex = api.nexthops[0].ifindex;
 
        /* Then fetch IPv4 prefixes. */
        if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
                rip_redistribute_add(api.type, RIP_ROUTE_REDISTRIBUTE,
-                                    (struct prefix_ipv4 *)&api.prefix, ifindex,
-                                    &nexthop, api.metric, api.distance,
+                                    (struct prefix_ipv4 *)&api.prefix, &nh,
+                                    api.metric, api.distance,
                                     api.tag);
        else if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL)
                rip_redistribute_delete(api.type, RIP_ROUTE_REDISTRIBUTE,
                                        (struct prefix_ipv4 *)&api.prefix,
-                                       ifindex);
+                                       nh.ifindex);
 
        return 0;
 }
@@ -501,15 +502,19 @@ DEFUN (rip_default_information_originate,
        "Distribute a default route\n")
 {
        struct prefix_ipv4 p;
+       struct nexthop nh;
 
        if (!rip->default_information) {
                memset(&p, 0, sizeof(struct prefix_ipv4));
+               memset(&nh, 0, sizeof(nh));
+
                p.family = AF_INET;
+               nh.type = NEXTHOP_TYPE_IPV4;
 
                rip->default_information = 1;
 
-               rip_redistribute_add(ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p, 0,
-                                    NULL, 0, 0, 0);
+               rip_redistribute_add(ZEBRA_ROUTE_RIP, RIP_ROUTE_DEFAULT, &p,
+                                    &nh, 0, 0, 0);
        }
 
        return CMD_SUCCESS;
@@ -585,8 +590,8 @@ static void rip_zebra_connected(struct zclient *zclient)
 void rip_zclient_init(struct thread_master *master)
 {
        /* Set default value to the zebra client structure. */
-       zclient = zclient_new(master);
-       zclient_init(zclient, ZEBRA_ROUTE_RIP, 0);
+       zclient = zclient_new_notify(master, &zclient_options_default);
+       zclient_init(zclient, ZEBRA_ROUTE_RIP, 0, &ripd_privs);
        zclient->zebra_connected = rip_zebra_connected;
        zclient->interface_add = rip_interface_add;
        zclient->interface_delete = rip_interface_delete;