diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-21 22:11:53 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-21 22:11:53 +0000 |
| commit | 844ec28cee41395cdd1cc0cdf8cf0168f9dc1adf (patch) | |
| tree | f2fe0a9a71bb075a5f6f43cd992b89f46b95574f /pimd/pim_static.c | |
| parent | d0bfb22c223d645e554290ca82581eb06f94ac3b (diff) | |
| parent | 039dc61292de5f3ed5f46316b1940ab6bb184c3f (diff) | |
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Conflicts:
lib/.gitignore
lib/command.c
lib/command.h
Diffstat (limited to 'pimd/pim_static.c')
| -rw-r--r-- | pimd/pim_static.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/pimd/pim_static.c b/pimd/pim_static.c index 47a34daf48..c1154dc088 100644 --- a/pimd/pim_static.c +++ b/pimd/pim_static.c @@ -24,15 +24,16 @@ #include "vty.h" #include "if.h" +#include "log.h" +#include "memory.h" +#include "linklist.h" +#include "pimd.h" +#include "pim_oil.h" #include "pim_static.h" #include "pim_time.h" #include "pim_str.h" -#include "pimd.h" #include "pim_iface.h" -#include "log.h" -#include "memory.h" -#include "linklist.h" void pim_static_route_free(struct static_route *s_route) { @@ -66,12 +67,12 @@ static struct static_route *static_route_new(unsigned int iif, s_route->source = source; s_route->iif = iif; s_route->oif_ttls[oif] = 1; - s_route->oif_count = 1; - s_route->mc.mfcc_origin = source; - s_route->mc.mfcc_mcastgrp = group; - s_route->mc.mfcc_parent = iif; - s_route->mc.mfcc_ttls[oif] = 1; - s_route->creation[oif] = pim_time_monotonic_sec(); + s_route->c_oil.oil_ref_count = 1; + s_route->c_oil.oil.mfcc_origin = source; + s_route->c_oil.oil.mfcc_mcastgrp = group; + s_route->c_oil.oil.mfcc_parent = iif; + s_route->c_oil.oil.mfcc_ttls[oif] = 1; + s_route->c_oil.oif_creation[oif] = pim_time_monotonic_sec(); return s_route; } @@ -84,8 +85,8 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr struct static_route *original_s_route = 0; struct pim_interface *pim_iif = iif ? iif->info : 0; struct pim_interface *pim_oif = oif ? oif->info : 0; - unsigned int iif_index = pim_iif ? pim_iif->mroute_vif_index : 0; - unsigned int oif_index = pim_oif ? pim_oif->mroute_vif_index : 0; + ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0; + ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0; if (!iif_index || !oif_index) { zlog_warn("%s %s: Unable to add static route: Invalid interface index(iif=%d,oif=%d)", @@ -138,30 +139,30 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr /* Route exists and has the same input interface, but adding a new output interface */ if (s_route->iif == iif_index) { s_route->oif_ttls[oif_index] = 1; - s_route->mc.mfcc_ttls[oif_index] = 1; - s_route->creation[oif_index] = pim_time_monotonic_sec(); - ++s_route->oif_count; + s_route->c_oil.oil.mfcc_ttls[oif_index] = 1; + s_route->c_oil.oif_creation[oif_index] = pim_time_monotonic_sec(); + ++s_route->c_oil.oil_ref_count; } else { /* input interface changed */ s_route->iif = iif_index; - s_route->mc.mfcc_parent = iif_index; + s_route->c_oil.oil.mfcc_parent = iif_index; #ifdef PIM_ENFORCE_LOOPFREE_MFC /* check to make sure the new input was not an old output */ if (s_route->oif_ttls[iif_index]) { s_route->oif_ttls[iif_index] = 0; - s_route->creation[iif_index] = 0; - s_route->mc.mfcc_ttls[iif_index] = 0; - --s_route->oif_count; + s_route->c_oil.oif_creation[iif_index] = 0; + s_route->c_oil.oil.mfcc_ttls[iif_index] = 0; + --s_route->c_oil.oil_ref_count; } #endif /* now add the new output, if it is new */ if (!s_route->oif_ttls[oif_index]) { s_route->oif_ttls[oif_index] = 1; - s_route->creation[oif_index] = pim_time_monotonic_sec(); - s_route->mc.mfcc_ttls[oif_index] = 1; - ++s_route->oif_count; + s_route->c_oil.oif_creation[oif_index] = pim_time_monotonic_sec(); + s_route->c_oil.oil.mfcc_ttls[oif_index] = 1; + ++s_route->c_oil.oil_ref_count; } } @@ -175,7 +176,7 @@ int pim_static_add(struct interface *iif, struct interface *oif, struct in_addr listnode_add(qpim_static_route_list, s_route); } - if (pim_mroute_add(&(s_route->mc))) + if (pim_mroute_add(&s_route->c_oil)) { char gifaddr_str[100]; char sifaddr_str[100]; @@ -228,8 +229,8 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr struct static_route *s_route = 0; struct pim_interface *pim_iif = iif ? iif->info : 0; struct pim_interface *pim_oif = oif ? oif->info : 0; - unsigned int iif_index = pim_iif ? pim_iif->mroute_vif_index : 0; - unsigned int oif_index = pim_oif ? pim_oif->mroute_vif_index : 0; + ifindex_t iif_index = pim_iif ? pim_iif->mroute_vif_index : 0; + ifindex_t oif_index = pim_oif ? pim_oif->mroute_vif_index : 0; if (!iif_index || !oif_index) { zlog_warn("%s %s: Unable to remove static route: Invalid interface index(iif=%d,oif=%d)", @@ -245,11 +246,12 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr s_route->source.s_addr == source.s_addr && s_route->oif_ttls[oif_index]) { s_route->oif_ttls[oif_index] = 0; - s_route->mc.mfcc_ttls[oif_index] = 0; - --s_route->oif_count; + s_route->c_oil.oil.mfcc_ttls[oif_index] = 0; + --s_route->c_oil.oil_ref_count; /* If there are no more outputs then delete the whole route, otherwise set the route with the new outputs */ - if (s_route->oif_count <= 0 ? pim_mroute_del(&s_route->mc) : pim_mroute_add(&s_route->mc)) { + if (s_route->c_oil.oil_ref_count <= 0 ? + pim_mroute_del(&s_route->c_oil) : pim_mroute_add(&s_route->c_oil)) { char gifaddr_str[100]; char sifaddr_str[100]; pim_inet4_dump("<ifaddr?>", group, gifaddr_str, sizeof(gifaddr_str)); @@ -262,15 +264,15 @@ int pim_static_del(struct interface *iif, struct interface *oif, struct in_addr sifaddr_str); s_route->oif_ttls[oif_index] = 1; - s_route->mc.mfcc_ttls[oif_index] = 1; - ++s_route->oif_count; + s_route->c_oil.oil.mfcc_ttls[oif_index] = 1; + ++s_route->c_oil.oil_ref_count; return -1; } - s_route->creation[oif_index] = 0; + s_route->c_oil.oif_creation[oif_index] = 0; - if (s_route->oif_count <= 0) { + if (s_route->c_oil.oil_ref_count <= 0) { listnode_delete(qpim_static_route_list, s_route); pim_static_route_free(s_route); } |
