diff options
author | Mobashshera Rasool <mrasool@vmware.com> | 2022-02-03 10:38:54 +0100 |
---|---|---|
committer | Mobashshera Rasool <mrasool@vmware.com> | 2022-03-08 09:57:51 +0100 |
commit | 119fcc3defb2337c80917280641f602a9499a9ee (patch) | |
tree | 5d548cd1513ac234fbfa2fed4fa1222aa1ba262d /pimd/pim_nb_config.c | |
parent | pim6d: Modify pim_rp_new for pimv6 (diff) | |
download | frr-119fcc3defb2337c80917280641f602a9499a9ee.tar.xz frr-119fcc3defb2337c80917280641f602a9499a9ee.zip |
pim6d: Modify pim_*_cmd_worker api passing pim_addr parameter
Pass pim_addr as parameter for rp address to accomodate ipv6.
Modifying pim_rp_cmd_worker and pim_no_rp_cmd_worker function
parameters from in_addr to pim_addr.
Changes in the caller functions are done as well to make it work
for IPv6.
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd/pim_nb_config.c')
-rw-r--r-- | pimd/pim_nb_config.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index d1611b6fe..c10f7daf5 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -256,10 +256,9 @@ static int pim_ssm_cmd_worker(struct pim_instance *pim, const char *plist, return ret; } -static int pim_rp_cmd_worker(struct pim_instance *pim, - struct in_addr rp_addr, - struct prefix group, const char *plist, - char *errmsg, size_t errmsg_len) +static int pim_rp_cmd_worker(struct pim_instance *pim, pim_addr rp_addr, + struct prefix group, const char *plist, + char *errmsg, size_t errmsg_len) { char rp_str[INET_ADDRSTRLEN]; int result; @@ -295,9 +294,8 @@ static int pim_rp_cmd_worker(struct pim_instance *pim, return NB_OK; } -static int pim_no_rp_cmd_worker(struct pim_instance *pim, - struct in_addr rp_addr, struct prefix group, - const char *plist, +static int pim_no_rp_cmd_worker(struct pim_instance *pim, pim_addr rp_addr, + struct prefix group, const char *plist, char *errmsg, size_t errmsg_len) { char rp_str[INET_ADDRSTRLEN]; @@ -2340,7 +2338,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp struct vrf *vrf; struct pim_instance *pim; struct prefix group; - struct ipaddr rp_addr; + pim_addr rp_addr; const char *plist; int result = 0; @@ -2352,15 +2350,15 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp case NB_EV_APPLY: vrf = nb_running_get_entry(args->dnode, NULL, true); pim = vrf->info; - yang_dnode_get_ip(&rp_addr, args->dnode, "./rp-address"); + yang_dnode_get_pimaddr(&rp_addr, args->dnode, "./rp-address"); if (yang_dnode_get(args->dnode, "./group-list")) { - yang_dnode_get_ipv4p(&group, args->dnode, - "./group-list"); - apply_mask_ipv4((struct prefix_ipv4 *)&group); - result = pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, - group, NULL, args->errmsg, - args->errmsg_len); + yang_dnode_get_prefix(&group, args->dnode, + "./group-list"); + apply_mask(&group); + result = pim_no_rp_cmd_worker(pim, rp_addr, group, NULL, + args->errmsg, + args->errmsg_len); } else if (yang_dnode_get(args->dnode, "./prefix-list")) { @@ -2373,10 +2371,9 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp return NB_ERR_INCONSISTENCY; } - result = pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, - group, plist, - args->errmsg, - args->errmsg_len); + result = pim_no_rp_cmd_worker(pim, rp_addr, group, + plist, args->errmsg, + args->errmsg_len); } if (result) @@ -2396,7 +2393,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp struct vrf *vrf; struct pim_instance *pim; struct prefix group; - struct ipaddr rp_addr; + pim_addr rp_addr; switch (args->event) { case NB_EV_VALIDATE: @@ -2406,11 +2403,11 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp case NB_EV_APPLY: vrf = nb_running_get_entry(args->dnode, NULL, true); pim = vrf->info; - yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_pimaddr(&rp_addr, args->dnode, "../rp-address"); yang_dnode_get_prefix(&group, args->dnode, NULL); apply_mask(&group); - return pim_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, - NULL, args->errmsg, args->errmsg_len); + return pim_rp_cmd_worker(pim, rp_addr, group, NULL, + args->errmsg, args->errmsg_len); } return NB_OK; @@ -2422,7 +2419,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp struct vrf *vrf; struct pim_instance *pim; struct prefix group; - struct ipaddr rp_addr; + pim_addr rp_addr; switch (args->event) { case NB_EV_VALIDATE: @@ -2432,13 +2429,12 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp case NB_EV_APPLY: vrf = nb_running_get_entry(args->dnode, NULL, true); pim = vrf->info; - yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_pimaddr(&rp_addr, args->dnode, "../rp-address"); yang_dnode_get_prefix(&group, args->dnode, NULL); apply_mask(&group); - return pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, - NULL, args->errmsg, - args->errmsg_len); + return pim_no_rp_cmd_worker(pim, rp_addr, group, NULL, + args->errmsg, args->errmsg_len); } return NB_OK; @@ -2453,7 +2449,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp struct vrf *vrf; struct pim_instance *pim; struct prefix group; - struct ipaddr rp_addr; + pim_addr rp_addr; const char *plist; switch (args->event) { @@ -2465,14 +2461,14 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp vrf = nb_running_get_entry(args->dnode, NULL, true); pim = vrf->info; plist = yang_dnode_get_string(args->dnode, NULL); - yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_pimaddr(&rp_addr, args->dnode, "../rp-address"); if (!str2prefix("224.0.0.0/4", &group)) { flog_err(EC_LIB_DEVELOPMENT, "Unable to convert 224.0.0.0/4 to prefix"); return NB_ERR_INCONSISTENCY; } - return pim_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, - plist, args->errmsg, args->errmsg_len); + return pim_rp_cmd_worker(pim, rp_addr, group, plist, + args->errmsg, args->errmsg_len); } return NB_OK; @@ -2484,7 +2480,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp struct vrf *vrf; struct pim_instance *pim; struct prefix group; - struct ipaddr rp_addr; + pim_addr rp_addr; const char *plist; switch (args->event) { @@ -2495,16 +2491,15 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp case NB_EV_APPLY: vrf = nb_running_get_entry(args->dnode, NULL, true); pim = vrf->info; - yang_dnode_get_ip(&rp_addr, args->dnode, "../rp-address"); + yang_dnode_get_pimaddr(&rp_addr, args->dnode, "../rp-address"); plist = yang_dnode_get_string(args->dnode, NULL); if (!str2prefix("224.0.0.0/4", &group)) { flog_err(EC_LIB_DEVELOPMENT, "Unable to convert 224.0.0.0/4 to prefix"); return NB_ERR_INCONSISTENCY; } - return pim_no_rp_cmd_worker(pim, rp_addr.ip._v4_addr, group, - plist, args->errmsg, - args->errmsg_len); + return pim_no_rp_cmd_worker(pim, rp_addr, group, plist, + args->errmsg, args->errmsg_len); break; } |