]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: `prefix_sg` => `pim_sgaddr`
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 4 Jan 2022 16:54:44 +0000 (17:54 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 12 Jan 2022 17:24:25 +0000 (18:24 +0100)
Mostly just 2 sed calls:

- `sed -e 's%struct prefix_sg%pim_sgaddr%g'`
- `sed -e 's%memset(&sg, 0, sizeof(pim_sgaddr));%memset(\&sg, 0, sizeof(sg));%g'`

Plus a bunch of fixing whatever that broke.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
29 files changed:
pimd/pim_assert.c
pimd/pim_br.c
pimd/pim_br.h
pimd/pim_cmd.c
pimd/pim_ifchannel.c
pimd/pim_ifchannel.h
pimd/pim_igmp_mtrace.c
pimd/pim_join.c
pimd/pim_mlag.c
pimd/pim_mroute.c
pimd/pim_msdp.c
pimd/pim_msdp.h
pimd/pim_msdp_packet.c
pimd/pim_msdp_packet.h
pimd/pim_nb_config.c
pimd/pim_oil.c
pimd/pim_oil.h
pimd/pim_register.c
pimd/pim_register.h
pimd/pim_str.c
pimd/pim_str.h
pimd/pim_tlv.c
pimd/pim_tlv.h
pimd/pim_upstream.c
pimd/pim_upstream.h
pimd/pim_vxlan.c
pimd/pim_vxlan.h
pimd/pim_zebra.c
pimd/pim_zlookup.c

index a335bc8c1a3125730678f7d1c34b935d8bfbea9a..79b46994aaf25dd19f78517cf48249509f5bf555 100644 (file)
@@ -141,9 +141,9 @@ static int dispatch_assert(struct interface *ifp, struct in_addr source_addr,
                           struct pim_assert_metric recv_metric)
 {
        struct pim_ifchannel *ch;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = source_addr;
        sg.grp = group_addr;
        ch = pim_ifchannel_add(ifp, &sg, 0, 0);
@@ -215,7 +215,7 @@ static int dispatch_assert(struct interface *ifp, struct in_addr source_addr,
 int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh,
                    struct in_addr src_addr, uint8_t *buf, int buf_size)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct prefix msg_source_addr;
        struct pim_assert_metric msg_metric;
        int offset;
@@ -231,7 +231,7 @@ int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh,
        /*
          Parse assert group addr
         */
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        offset = pim_parse_addr_group(&sg, curr, curr_size);
        if (offset < 1) {
                char src_str[INET_ADDRSTRLEN];
index fc6a02ec9316c8a7d8632dcc53f278cf7be15325..b3fc8969b8874908536692cf2e79bb433ef63cc3 100644 (file)
@@ -29,7 +29,7 @@
 #include "linklist.h"
 
 struct pim_br {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct in_addr pmbr;
 };
 
@@ -37,7 +37,7 @@ struct in_addr pim_br_unknown = {.s_addr = 0};
 
 static struct list *pim_br_list = NULL;
 
-struct in_addr pim_br_get_pmbr(struct prefix_sg *sg)
+struct in_addr pim_br_get_pmbr(pim_sgaddr *sg)
 {
        struct listnode *node;
        struct pim_br *pim_br;
@@ -51,7 +51,7 @@ struct in_addr pim_br_get_pmbr(struct prefix_sg *sg)
        return pim_br_unknown;
 }
 
-void pim_br_set_pmbr(struct prefix_sg *sg, struct in_addr br)
+void pim_br_set_pmbr(pim_sgaddr *sg, struct in_addr br)
 {
        struct listnode *node, *next;
        struct pim_br *pim_br;
@@ -75,7 +75,7 @@ void pim_br_set_pmbr(struct prefix_sg *sg, struct in_addr br)
 /*
  * Remove the (S,G) from the stored values
  */
-void pim_br_clear_pmbr(struct prefix_sg *sg)
+void pim_br_clear_pmbr(pim_sgaddr *sg)
 {
        struct listnode *node, *next;
        struct pim_br *pim_br;
index 836ff5ee8344e4e659c16daf139980134c9de47f..ef24ef3c197efee08f9930cc72488870fad05750 100644 (file)
 #ifndef PIM_BR_H
 #define PIM_BR_H
 
-struct in_addr pim_br_get_pmbr(struct prefix_sg *sg);
+struct in_addr pim_br_get_pmbr(pim_sgaddr *sg);
 
-void pim_br_set_pmbr(struct prefix_sg *sg, struct in_addr value);
-void pim_br_clear_pmbr(struct prefix_sg *sg);
+void pim_br_set_pmbr(pim_sgaddr *sg, struct in_addr value);
+void pim_br_clear_pmbr(pim_sgaddr *sg);
 
 void pim_br_init(void);
 
index 86a09f72f9416f831410fc820d9efc560b1345c8..c9dabfb3e8c7f6ab0e1303670ef7d5246d8f17ae 100644 (file)
@@ -1741,7 +1741,7 @@ static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
 }
 
 static void pim_show_join(struct pim_instance *pim, struct vty *vty,
-                         struct prefix_sg *sg, bool uj)
+                         pim_sgaddr *sg, bool uj)
 {
        struct pim_interface *pim_ifp;
        struct pim_ifchannel *ch;
@@ -2439,7 +2439,7 @@ static const char *pim_reg_state2brief_str(enum pim_reg_state reg_state,
 }
 
 static void pim_show_upstream(struct pim_instance *pim, struct vty *vty,
-                             struct prefix_sg *sg, bool uj)
+                             pim_sgaddr *sg, bool uj)
 {
        struct pim_upstream *up;
        time_t now;
@@ -4603,7 +4603,7 @@ DEFPY (show_ip_pim_join,
        "The Group\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        struct vrf *v;
        bool uj = !!json;
        struct pim_instance *pim;
@@ -4644,7 +4644,7 @@ DEFUN (show_ip_pim_join_vrf_all,
        "PIM interface join information\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        bool uj = use_json(argc, argv);
        struct vrf *vrf;
        bool first = true;
@@ -5223,7 +5223,7 @@ DEFPY (show_ip_pim_upstream,
        "The Group\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        struct vrf *v;
        bool uj = !!json;
        struct pim_instance *pim;
@@ -5263,7 +5263,7 @@ DEFUN (show_ip_pim_upstream_vrf_all,
        "PIM upstream information\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        bool uj = use_json(argc, argv);
        struct vrf *vrf;
        bool first = true;
@@ -5888,7 +5888,7 @@ DEFUN(show_ip_multicast_count_vrf_all,
 }
 
 static void show_mroute(struct pim_instance *pim, struct vty *vty,
-                       struct prefix_sg *sg, bool fill, bool uj)
+                       pim_sgaddr *sg, bool fill, bool uj)
 {
        struct listnode *node;
        struct channel_oil *c_oil;
@@ -6273,7 +6273,7 @@ DEFPY (show_ip_mroute,
        "Fill in Assumed data\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        struct pim_instance *pim;
        struct vrf *v;
 
@@ -6311,7 +6311,7 @@ DEFUN (show_ip_mroute_vrf_all,
        "Fill in Assumed data\n"
        JSON_STR)
 {
-       struct prefix_sg sg = {0};
+       pim_sgaddr sg = {0};
        bool uj = use_json(argc, argv);
        int idx = 4;
        struct vrf *vrf;
@@ -8219,7 +8219,7 @@ DEFPY_HIDDEN (pim_test_sg_keepalive,
 {
        struct pim_upstream *up;
        struct pim_instance *pim;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
 
        sg.src = source;
        sg.grp = group;
@@ -10596,7 +10596,7 @@ static void pim_show_vxlan_sg_one(struct pim_instance *pim,
                                  bool uj)
 {
        json_object *json = NULL;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int result = 0;
        struct pim_vxlan_sg *vxlan_sg;
        const char *iif_name;
@@ -10616,8 +10616,6 @@ static void pim_show_vxlan_sg_one(struct pim_instance *pim,
                return;
        }
 
-       sg.family = AF_INET;
-       sg.prefixlen = IPV4_MAX_BITLEN;
        if (uj)
                json = json_object_new_object();
 
index a17e8e89b2dc501507a7aacb7749e62721186be1..c0d693071fab7dfdbc3227ce560e6a22f05f217e 100644 (file)
@@ -446,8 +446,7 @@ void reset_ifassert_state(struct pim_ifchannel *ch)
                                router->infinite_assert_metric);
 }
 
-struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
-                                        struct prefix_sg *sg)
+struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp, pim_sgaddr *sg)
 {
        struct pim_interface *pim_ifp;
        struct pim_ifchannel *ch;
@@ -524,7 +523,7 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp)
  */
 static struct pim_ifchannel *pim_ifchannel_find_parent(struct pim_ifchannel *ch)
 {
-       struct prefix_sg parent_sg = ch->sg;
+       pim_sgaddr parent_sg = ch->sg;
        struct pim_ifchannel *parent = NULL;
 
        // (S,G)
@@ -541,8 +540,7 @@ static struct pim_ifchannel *pim_ifchannel_find_parent(struct pim_ifchannel *ch)
        return NULL;
 }
 
-struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
-                                       struct prefix_sg *sg,
+struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg,
                                        uint8_t source_flags, int up_flags)
 {
        struct pim_interface *pim_ifp;
@@ -752,7 +750,7 @@ static int on_ifjoin_prune_pending_timer(struct thread *t)
 }
 
 static void check_recv_upstream(int is_join, struct interface *recv_ifp,
-                               struct in_addr upstream, struct prefix_sg *sg,
+                               struct in_addr upstream, pim_sgaddr *sg,
                                uint8_t source_flags, int holdtime)
 {
        struct pim_upstream *up;
@@ -817,7 +815,7 @@ static void check_recv_upstream(int is_join, struct interface *recv_ifp,
 }
 
 static int nonlocal_upstream(int is_join, struct interface *recv_ifp,
-                            struct in_addr upstream, struct prefix_sg *sg,
+                            struct in_addr upstream, pim_sgaddr *sg,
                             uint8_t source_flags, uint16_t holdtime)
 {
        struct pim_interface *recv_pim_ifp;
@@ -871,7 +869,7 @@ static void pim_ifchannel_ifjoin_handler(struct pim_ifchannel *ch,
 
 
 void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
-                           struct in_addr upstream, struct prefix_sg *sg,
+                           struct in_addr upstream, pim_sgaddr *sg,
                            uint8_t source_flags, uint16_t holdtime)
 {
        struct pim_interface *pim_ifp;
@@ -1036,7 +1034,7 @@ void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
 }
 
 void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream,
-                        struct prefix_sg *sg, uint8_t source_flags,
+                        pim_sgaddr *sg, uint8_t source_flags,
                         uint16_t holdtime)
 {
        struct pim_ifchannel *ch;
@@ -1172,8 +1170,8 @@ void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream,
        }
 }
 
-int pim_ifchannel_local_membership_add(struct interface *ifp,
-                                      struct prefix_sg *sg, bool is_vxlan)
+int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg,
+                                      bool is_vxlan)
 {
        struct pim_ifchannel *ch, *starch;
        struct pim_interface *pim_ifp;
@@ -1278,8 +1276,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp,
        return 1;
 }
 
-void pim_ifchannel_local_membership_del(struct interface *ifp,
-                                       struct prefix_sg *sg)
+void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg)
 {
        struct pim_ifchannel *starch, *ch, *orig;
        struct pim_interface *pim_ifp;
index e266040697e9c615aa4c83c1d4b5ab86d238d85f..ab405202e3d24e99005915690807013e827cd18d 100644 (file)
@@ -89,7 +89,7 @@ struct pim_ifchannel {
 
        struct pim_ifchannel *parent;
        struct list *sources;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        char sg_str[PIM_SG_LEN];
        struct interface *interface; /* backpointer to interface */
        uint32_t flags;
@@ -123,21 +123,18 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch);
 void pim_ifchannel_delete_all(struct interface *ifp);
 void pim_ifchannel_membership_clear(struct interface *ifp);
 void pim_ifchannel_delete_on_noinfo(struct interface *ifp);
-struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
-                                        struct prefix_sg *sg);
-struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
-                                       struct prefix_sg *sg, uint8_t ch_flags,
-                                       int up_flags);
+struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp, pim_sgaddr *sg);
+struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp, pim_sgaddr *sg,
+                                       uint8_t ch_flags, int up_flags);
 void pim_ifchannel_join_add(struct interface *ifp, struct in_addr neigh_addr,
-                           struct in_addr upstream, struct prefix_sg *sg,
+                           struct in_addr upstream, pim_sgaddr *sg,
                            uint8_t source_flags, uint16_t holdtime);
 void pim_ifchannel_prune(struct interface *ifp, struct in_addr upstream,
-                        struct prefix_sg *sg, uint8_t source_flags,
+                        pim_sgaddr *sg, uint8_t source_flags,
                         uint16_t holdtime);
-int pim_ifchannel_local_membership_add(struct interface *ifp,
-               struct prefix_sg *sg, bool is_vxlan);
-void pim_ifchannel_local_membership_del(struct interface *ifp,
-                                       struct prefix_sg *sg);
+int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg,
+                                      bool is_vxlan);
+void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg);
 
 void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch,
                                 enum pim_ifjoin_state new_state);
index 65a8ca4e4072ad132a97323e9a62462261eb40a6..1518ef232209926424988eeb77cd34356cdd8e10 100644 (file)
@@ -106,13 +106,13 @@ static bool mtrace_fwd_info(struct pim_instance *pim,
                            struct igmp_mtrace_rsp *rspp,
                            struct interface **ifpp)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct pim_upstream *up;
        struct interface *ifp_in;
        struct in_addr nh_addr;
        uint32_t total;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = mtracep->src_addr;
        sg.grp = mtracep->grp_addr;
 
@@ -426,14 +426,14 @@ static int mtrace_un_forward_packet(struct pim_instance *pim, struct ip *ip_hdr,
 
 static int mtrace_mc_forward_packet(struct pim_instance *pim, struct ip *ip_hdr)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct channel_oil *c_oil;
        struct listnode *chnode;
        struct listnode *chnextnode;
        struct pim_ifchannel *ch = NULL;
        int ret = -1;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.grp = ip_hdr->ip_dst;
 
        c_oil = pim_find_channel_oil(pim, &sg);
@@ -477,14 +477,14 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
                                   struct igmp_mtrace *mtracep,
                                   size_t mtrace_len)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct channel_oil *c_oil;
        struct listnode *chnode;
        struct listnode *chnextnode;
        struct pim_ifchannel *ch = NULL;
        int ret = -1;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.grp = mtracep->rsp_addr;
 
        c_oil = pim_find_channel_oil(pim, &sg);
index b2e1b1a28af8591679eef31a38b4cb65a3e35aa7..5e96d39e8ff508a31b5e512b208f4f3283ed516c 100644 (file)
@@ -55,7 +55,7 @@ static void on_trace(const char *label, struct interface *ifp,
 
 static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
                      uint16_t holdtime, struct in_addr upstream,
-                     struct prefix_sg *sg, uint8_t source_flags)
+                     pim_sgaddr *sg, uint8_t source_flags)
 {
        struct pim_interface *pim_ifp = NULL;
 
@@ -87,8 +87,8 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
                struct pim_rpf *rp = RP(pim_ifp->pim, sg->grp);
 
                if (!rp) {
-                       zlog_warn("%s: Lookup of RP failed for %pPSG4",
-                                 __func__, sg);
+                       zlog_warn("%s: Lookup of RP failed for %pSG", __func__,
+                                 sg);
                        return;
                }
                /*
@@ -125,7 +125,7 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
 
 static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh,
                       uint16_t holdtime, struct in_addr upstream,
-                      struct prefix_sg *sg, uint8_t source_flags)
+                      pim_sgaddr *sg, uint8_t source_flags)
 {
        struct pim_interface *pim_ifp = NULL;
 
@@ -160,7 +160,7 @@ static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh,
 
                        pim_inet4_dump("<received?>", sg->src, received_rp,
                                       sizeof(received_rp));
-                       zlog_debug("%s: Prune received with RP(%s) for %pPSG4",
+                       zlog_debug("%s: Prune received with RP(%s) for %pSG",
                                   __func__, received_rp, sg);
                }
 
@@ -247,7 +247,7 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
 
        /* Scan groups */
        for (group = 0; group < msg_num_groups; ++group) {
-               struct prefix_sg sg;
+               pim_sgaddr sg;
                uint8_t msg_source_flags;
                uint16_t msg_num_joined_sources;
                uint16_t msg_num_pruned_sources;
@@ -255,7 +255,7 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
                struct pim_ifchannel *starg_ch = NULL, *sg_ch = NULL;
                bool filtered = false;
 
-               memset(&sg, 0, sizeof(struct prefix_sg));
+               memset(&sg, 0, sizeof(sg));
                addr_offset = pim_parse_addr_group(&sg, buf, pastend - buf);
                if (addr_offset < 1) {
                        return -5;
index 4f1cab7d5a19b891250d8e2b161b263d05453ea4..1f38b1c93dc1a6ab7c92c658a85b0d12c6140c07 100644 (file)
@@ -253,11 +253,11 @@ static void pim_mlag_up_peer_add(struct mlag_mroute_add *msg)
        struct pim_upstream *up;
        struct pim_instance *pim;
        int flags = 0;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct vrf *vrf;
        char sg_str[PIM_SG_LEN];
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src.s_addr = htonl(msg->source_ip);
        sg.grp.s_addr = htonl(msg->group_ip);
        if (PIM_DEBUG_MLAG)
@@ -327,11 +327,11 @@ static void pim_mlag_up_peer_del(struct mlag_mroute_del *msg)
 {
        struct pim_upstream *up;
        struct pim_instance *pim;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct vrf *vrf;
        char sg_str[PIM_SG_LEN];
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src.s_addr = htonl(msg->source_ip);
        sg.grp.s_addr = htonl(msg->group_ip);
        if (PIM_DEBUG_MLAG)
@@ -737,17 +737,17 @@ static void pim_mlag_process_vxlan_update(struct mlag_vxlan *msg)
 static void pim_mlag_process_mroute_add(struct mlag_mroute_add msg)
 {
        if (PIM_DEBUG_MLAG) {
-               struct prefix_sg sg;
+               pim_sgaddr sg;
 
                sg.grp.s_addr = ntohl(msg.group_ip);
                sg.src.s_addr = ntohl(msg.source_ip);
 
                zlog_debug(
-                       "%s: msg dump: vrf_name: %s, s.ip: 0x%x, g.ip: 0x%x (%pPSG4) cost: %u",
+                       "%s: msg dump: vrf_name: %s, s.ip: 0x%x, g.ip: 0x%x (%pSG) cost: %u",
                        __func__, msg.vrf_name, msg.source_ip, msg.group_ip,
                        &sg, msg.cost_to_rp);
                zlog_debug(
-                       "(%pPSG4)owner_id: %d, DR: %d, Dual active: %d, vrf_id: 0x%x intf_name: %s",
+                       "(%pSG)owner_id: %d, DR: %d, Dual active: %d, vrf_id: 0x%x intf_name: %s",
                        &sg, msg.owner_id, msg.am_i_dr, msg.am_i_dual_active,
                        msg.vrf_id, msg.intf_name);
        }
@@ -767,15 +767,15 @@ static void pim_mlag_process_mroute_add(struct mlag_mroute_add msg)
 static void pim_mlag_process_mroute_del(struct mlag_mroute_del msg)
 {
        if (PIM_DEBUG_MLAG) {
-               struct prefix_sg sg;
+               pim_sgaddr sg;
 
                sg.grp.s_addr = ntohl(msg.group_ip);
                sg.src.s_addr = ntohl(msg.source_ip);
                zlog_debug(
-                       "%s: msg dump: vrf_name: %s, s.ip: 0x%x, g.ip: 0x%x(%pPSG4)",
+                       "%s: msg dump: vrf_name: %s, s.ip: 0x%x, g.ip: 0x%x(%pSG)",
                        __func__, msg.vrf_name, msg.source_ip, msg.group_ip,
                        &sg);
-               zlog_debug("(%pPSG4)owner_id: %d, vrf_id: 0x%x intf_name: %s",
+               zlog_debug("(%pSG)owner_id: %d, vrf_id: 0x%x intf_name: %s",
                           &sg, msg.owner_id, msg.vrf_id, msg.intf_name);
        }
 
index ad21178849300e89ad869eb2aeefcbee41068e3b..8b6b16f2367a665be9fcb68d1011940bf4d1acf0 100644 (file)
@@ -154,7 +154,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
        struct pim_interface *pim_ifp = ifp->info;
        struct pim_upstream *up;
        struct pim_rpf *rpg;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
 
        rpg = pim_ifp ? RP(pim_ifp->pim, msg->im_dst) : NULL;
        /*
@@ -183,7 +183,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
                return 0;
        }
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = msg->im_src;
        sg.grp = msg->im_dst;
 
@@ -242,7 +242,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
                                   const char *buf)
 {
        struct pim_interface *pim_ifp;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct pim_rpf *rpg;
        const struct ip *ip_hdr;
        struct pim_upstream *up;
@@ -251,13 +251,13 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
 
        ip_hdr = (const struct ip *)buf;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = ip_hdr->ip_src;
        sg.grp = ip_hdr->ip_dst;
 
        up = pim_upstream_find(pim_ifp->pim, &sg);
        if (!up) {
-               struct prefix_sg star = sg;
+               pim_sgaddr star = sg;
                star.src.s_addr = INADDR_ANY;
 
                up = pim_upstream_find(pim_ifp->pim, &star);
@@ -342,9 +342,9 @@ static int pim_mroute_msg_wrongvif(int fd, struct interface *ifp,
 {
        struct pim_ifchannel *ch;
        struct pim_interface *pim_ifp;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = msg->im_src;
        sg.grp = msg->im_dst;
 
@@ -378,7 +378,7 @@ static int pim_mroute_msg_wrongvif(int fd, struct interface *ifp,
 
        ch = pim_ifchannel_find(ifp, &sg);
        if (!ch) {
-               struct prefix_sg star_g = sg;
+               pim_sgaddr star_g = sg;
                if (PIM_DEBUG_MROUTE)
                        zlog_debug(
                                "%s: WRONGVIF (S,G)=%s could not find channel on interface %s",
@@ -448,12 +448,12 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
        struct pim_instance *pim;
        struct pim_ifchannel *ch;
        struct pim_upstream *up;
-       struct prefix_sg star_g;
-       struct prefix_sg sg;
+       pim_sgaddr star_g;
+       pim_sgaddr sg;
 
        pim_ifp = ifp->info;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = ip_hdr->ip_src;
        sg.grp = ip_hdr->ip_dst;
 
@@ -1213,7 +1213,7 @@ void pim_mroute_update_counters(struct channel_oil *c_oil)
        if (!c_oil->installed) {
                c_oil->cc.lastused = 100 * pim->keep_alive_time;
                if (PIM_DEBUG_MROUTE) {
-                       struct prefix_sg sg;
+                       pim_sgaddr sg;
 
                        sg.src = c_oil->oil.mfcc_origin;
                        sg.grp = c_oil->oil.mfcc_mcastgrp;
@@ -1230,7 +1230,7 @@ void pim_mroute_update_counters(struct channel_oil *c_oil)
 
        pim_zlookup_sg_statistics(c_oil);
        if (ioctl(pim->mroute_socket, SIOCGETSGCNT, &sgreq)) {
-               struct prefix_sg sg;
+               pim_sgaddr sg;
 
                sg.src = c_oil->oil.mfcc_origin;
                sg.grp = c_oil->oil.mfcc_mcastgrp;
index fa7f1da79ad87d4b1b45c8fe0df4cf0c5eb70432..40d864d1da4675efe8b0aafe4b471bddea275da1 100644 (file)
@@ -152,7 +152,7 @@ static bool pim_msdp_sa_upstream_add_ok(struct pim_msdp_sa *sa,
 
        /* check if we have a (*, G) with a non-empty immediate OIL */
        if (!xg_up) {
-               struct prefix_sg sg;
+               pim_sgaddr sg;
 
                memset(&sg, 0, sizeof(sg));
                sg.grp = sa->sg.grp;
@@ -237,8 +237,7 @@ static void pim_msdp_sa_free(struct pim_msdp_sa *sa)
 }
 
 static struct pim_msdp_sa *pim_msdp_sa_new(struct pim_instance *pim,
-                                          struct prefix_sg *sg,
-                                          struct in_addr rp)
+                                          pim_sgaddr *sg, struct in_addr rp)
 {
        struct pim_msdp_sa *sa;
 
@@ -262,7 +261,7 @@ static struct pim_msdp_sa *pim_msdp_sa_new(struct pim_instance *pim,
 }
 
 static struct pim_msdp_sa *pim_msdp_sa_find(struct pim_instance *pim,
-                                           struct prefix_sg *sg)
+                                           pim_sgaddr *sg)
 {
        struct pim_msdp_sa lookup;
 
@@ -271,8 +270,7 @@ static struct pim_msdp_sa *pim_msdp_sa_find(struct pim_instance *pim,
 }
 
 static struct pim_msdp_sa *pim_msdp_sa_add(struct pim_instance *pim,
-                                          struct prefix_sg *sg,
-                                          struct in_addr rp)
+                                          pim_sgaddr *sg, struct in_addr rp)
 {
        struct pim_msdp_sa *sa;
 
@@ -386,7 +384,7 @@ static void pim_msdp_sa_deref(struct pim_msdp_sa *sa,
 }
 
 void pim_msdp_sa_ref(struct pim_instance *pim, struct pim_msdp_peer *mp,
-                    struct prefix_sg *sg, struct in_addr rp)
+                    pim_sgaddr *sg, struct in_addr rp)
 {
        struct pim_msdp_sa *sa;
 
@@ -467,15 +465,14 @@ static bool pim_msdp_sa_local_add_ok(struct pim_upstream *up)
        return false;
 }
 
-static void pim_msdp_sa_local_add(struct pim_instance *pim,
-                                 struct prefix_sg *sg)
+static void pim_msdp_sa_local_add(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct in_addr rp;
        rp.s_addr = INADDR_ANY;
        pim_msdp_sa_ref(pim, NULL /* mp */, sg, rp);
 }
 
-void pim_msdp_sa_local_del(struct pim_instance *pim, struct prefix_sg *sg)
+void pim_msdp_sa_local_del(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct pim_msdp_sa *sa;
 
@@ -488,7 +485,7 @@ void pim_msdp_sa_local_del(struct pim_instance *pim, struct prefix_sg *sg)
 /* we need to be very cautious with this API as SA del too can trigger an
  * upstream del and we will get stuck in a simple loop */
 static void pim_msdp_sa_local_del_on_up_del(struct pim_instance *pim,
-                                           struct prefix_sg *sg)
+                                           pim_sgaddr *sg)
 {
        struct pim_msdp_sa *sa;
 
@@ -643,7 +640,7 @@ void pim_msdp_up_join_state_changed(struct pim_instance *pim,
        }
 }
 
-static void pim_msdp_up_xg_del(struct pim_instance *pim, struct prefix_sg *sg)
+static void pim_msdp_up_xg_del(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct listnode *sanode;
        struct pim_msdp_sa *sa;
@@ -667,7 +664,7 @@ static void pim_msdp_up_xg_del(struct pim_instance *pim, struct prefix_sg *sg)
        }
 }
 
-void pim_msdp_up_del(struct pim_instance *pim, struct prefix_sg *sg)
+void pim_msdp_up_del(struct pim_instance *pim, pim_sgaddr *sg)
 {
        if (PIM_DEBUG_MSDP_INTERNAL) {
                zlog_debug("MSDP up %s del", pim_str_sg_dump(sg));
index a074f21b47a64277e28084a5686f3398047c72da..3fa6a604c1f1b25b1cffa73e91faa58c34c05bef 100644 (file)
@@ -78,7 +78,7 @@ enum pim_msdp_sa_flags {
 struct pim_msdp_sa {
        struct pim_instance *pim;
 
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        char sg_str[PIM_SG_LEN];
        struct in_addr rp;   /* Last RP address associated with this SA */
        struct in_addr peer; /* last peer from who we heard this SA */
@@ -246,14 +246,14 @@ bool pim_msdp_peer_config_write(struct vty *vty, struct pim_instance *pim,
                                const char *spaces);
 void pim_msdp_peer_pkt_txed(struct pim_msdp_peer *mp);
 void pim_msdp_sa_ref(struct pim_instance *pim, struct pim_msdp_peer *mp,
-                    struct prefix_sg *sg, struct in_addr rp);
+                    pim_sgaddr *sg, struct in_addr rp);
 void pim_msdp_sa_local_update(struct pim_upstream *up);
-void pim_msdp_sa_local_del(struct pim_instance *pim, struct prefix_sg *sg);
+void pim_msdp_sa_local_del(struct pim_instance *pim, pim_sgaddr *sg);
 void pim_msdp_i_am_rp_changed(struct pim_instance *pim);
 bool pim_msdp_peer_rpf_check(struct pim_msdp_peer *mp, struct in_addr rp);
 void pim_msdp_up_join_state_changed(struct pim_instance *pim,
                                    struct pim_upstream *xg_up);
-void pim_msdp_up_del(struct pim_instance *pim, struct prefix_sg *sg);
+void pim_msdp_up_del(struct pim_instance *pim, pim_sgaddr *sg);
 enum pim_msdp_err pim_msdp_mg_del(struct pim_instance *pim,
                                  const char *mesh_group_name);
 
index eb5f46951e8f5e63dd314a80846cd3b5438f46b7..64fdbaa89bb2e3bd36bc78a2ca1644fda746f87b 100644 (file)
@@ -66,14 +66,14 @@ static char *pim_msdp_pkt_type_dump(enum pim_msdp_tlv type, char *buf,
 
 static void pim_msdp_pkt_sa_dump_one(struct stream *s)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
 
        /* just throw away the three reserved bytes */
        stream_get3(s);
        /* throw away the prefix length also */
        stream_getc(s);
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.grp.s_addr = stream_get_ipv4(s);
        sg.src.s_addr = stream_get_ipv4(s);
 
@@ -458,7 +458,7 @@ void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp)
 }
 
 void pim_msdp_pkt_sa_tx_one_to_one_peer(struct pim_msdp_peer *mp,
-                                       struct in_addr rp, struct prefix_sg sg)
+                                       struct in_addr rp, pim_sgaddr sg)
 {
        struct pim_msdp_sa sa;
 
@@ -493,7 +493,7 @@ static void pim_msdp_pkt_ka_rx(struct pim_msdp_peer *mp, int len)
 static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
 {
        int prefix_len;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct listnode *peer_node;
        struct pim_msdp_peer *peer;
 
@@ -501,7 +501,7 @@ static void pim_msdp_pkt_sa_rx_one(struct pim_msdp_peer *mp, struct in_addr rp)
        stream_get3(mp->ibuf);
        prefix_len = stream_getc(mp->ibuf);
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.grp.s_addr = stream_get_ipv4(mp->ibuf);
        sg.src.s_addr = stream_get_ipv4(mp->ibuf);
 
index 10b7ca4198b32e88ddf868f5a5af2e48a0b3d05d..e2c4b0e6b5594ef212ba4f74408faffbf5138cbd 100644 (file)
@@ -69,6 +69,6 @@ void pim_msdp_pkt_sa_tx(struct pim_instance *pim);
 void pim_msdp_pkt_sa_tx_one(struct pim_msdp_sa *sa);
 void pim_msdp_pkt_sa_tx_to_one_peer(struct pim_msdp_peer *mp);
 void pim_msdp_pkt_sa_tx_one_to_one_peer(struct pim_msdp_peer *mp,
-                                       struct in_addr rp, struct prefix_sg sg);
+                                       struct in_addr rp, pim_sgaddr sg);
 
 #endif
index 9b79646dafba751e954d773d2f4e2b14dea6c53c..233f866e0979400fd7cc7946e02f482ce46ccbe8 100644 (file)
@@ -95,9 +95,9 @@ static void pim_if_membership_refresh(struct interface *ifp)
                                          src)) {
 
                        if (IGMP_SOURCE_TEST_FORWARDING(src->source_flags)) {
-                               struct prefix_sg sg;
+                               pim_sgaddr sg;
 
-                               memset(&sg, 0, sizeof(struct prefix_sg));
+                               memset(&sg, 0, sizeof(sg));
                                sg.src = src->source_addr;
                                sg.grp = grp->group_addr;
                                pim_ifchannel_local_membership_add(
index 83424c1b6938e3054830616ce4c3ad34c4dc71c9..c094e99a7142a11238ba2f1a3b99997214b89302 100644 (file)
@@ -39,7 +39,7 @@ char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
 {
        char *out;
        struct interface *ifp;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int i;
 
        sg.src = c_oil->oil.mfcc_origin;
@@ -104,7 +104,7 @@ void pim_channel_oil_free(struct channel_oil *c_oil)
 }
 
 struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
-                                        struct prefix_sg *sg)
+                                        pim_sgaddr *sg)
 {
        struct channel_oil *c_oil = NULL;
        struct channel_oil lookup;
@@ -118,8 +118,7 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
 }
 
 struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
-                                       struct prefix_sg *sg,
-                                       const char *name)
+                                       pim_sgaddr *sg, const char *name)
 {
        struct channel_oil *c_oil;
 
@@ -145,7 +144,7 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
 
                if (PIM_DEBUG_MROUTE)
                        zlog_debug(
-                               "%s(%s): Existing oil for %pPSG4 Ref Count: %d (Post Increment)",
+                               "%s(%s): Existing oil for %pSG Ref Count: %d (Post Increment)",
                                __func__, name, sg, c_oil->oil_ref_count);
                return c_oil;
        }
@@ -174,11 +173,11 @@ struct channel_oil *pim_channel_oil_del(struct channel_oil *c_oil,
                                        const char *name)
 {
        if (PIM_DEBUG_MROUTE) {
-               struct prefix_sg sg = {.src = c_oil->oil.mfcc_mcastgrp,
-                                      .grp = c_oil->oil.mfcc_origin};
+               pim_sgaddr sg = {.src = c_oil->oil.mfcc_mcastgrp,
+                                .grp = c_oil->oil.mfcc_origin};
 
                zlog_debug(
-                       "%s(%s): Del oil for %pPSG4, Ref Count: %d (Predecrement)",
+                       "%s(%s): Del oil for %pSG, Ref Count: %d (Predecrement)",
                        __func__, name, &sg, c_oil->oil_ref_count);
        }
        --c_oil->oil_ref_count;
index af8ac8459400d8d3ff8ce79513a21e959ebe28d7..696ef70645135cbefb51ede52f6a8c42fc2bb144 100644 (file)
@@ -123,10 +123,9 @@ void pim_oil_terminate(struct pim_instance *pim);
 
 void pim_channel_oil_free(struct channel_oil *c_oil);
 struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
-                                        struct prefix_sg *sg);
+                                        pim_sgaddr *sg);
 struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
-                                       struct prefix_sg *sg,
-                                       const char *name);
+                                       pim_sgaddr *sg, const char *name);
 void pim_channel_oil_change_iif(struct pim_instance *pim,
                                struct channel_oil *c_oil, int input_vif_index,
                                const char *name);
index 57449f816bc174ac0f5535468b6c7b3b9337e54a..e7bbeb4f62cdf62333a98568816661c27b928631 100644 (file)
@@ -64,7 +64,7 @@ void pim_register_join(struct pim_upstream *up)
        pim_vxlan_update_sg_reg_state(pim, up, true /*reg_join*/);
 }
 
-void pim_register_stop_send(struct interface *ifp, struct prefix_sg *sg,
+void pim_register_stop_send(struct interface *ifp, pim_sgaddr *sg,
                            struct in_addr src, struct in_addr originator)
 {
        struct pim_interface *pinfo;
@@ -119,12 +119,12 @@ int pim_register_stop_recv(struct interface *ifp, uint8_t *buf, int buf_size)
        struct pim_instance *pim = pim_ifp->pim;
        struct pim_upstream *upstream = NULL;
        struct prefix source;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int l;
 
        ++pim_ifp->pim_ifstat_reg_stop_recv;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        l = pim_parse_addr_group(&sg, buf, buf_size);
        buf += l;
        buf_size -= l;
@@ -318,7 +318,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
 {
        int sentRegisterStop = 0;
        struct ip *ip_hdr;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        uint32_t *bits;
        int i_am_rp = 0;
        struct pim_interface *pim_ifp = ifp->info;
@@ -367,7 +367,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
         * Line above.  So we need to add 4 bytes to get to the
         * start of the actual Encapsulated data.
         */
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = ip_hdr->ip_src;
        sg.grp = ip_hdr->ip_dst;
 
@@ -416,7 +416,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
                                                       src_str,
                                                       sizeof(src_str));
                                        zlog_debug(
-                                               "%s: Sending register-stop to %s for %pPSG4 due to prefix-list denial, dropping packet",
+                                               "%s: Sending register-stop to %s for %pSG due to prefix-list denial, dropping packet",
                                                __func__, src_str, &sg);
                                }
 
index caaacd9d5460453d60f3e56c51267108af6d6e84..fd4284b80215cffdae15ff90884c554aaf2d2b99 100644 (file)
@@ -39,7 +39,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
 void pim_register_send(const uint8_t *buf, int buf_size, struct in_addr src,
                       struct pim_rpf *rpg, int null_register,
                       struct pim_upstream *up);
-void pim_register_stop_send(struct interface *ifp, struct prefix_sg *sg,
+void pim_register_stop_send(struct interface *ifp, pim_sgaddr *sg,
                            struct in_addr src, struct in_addr originator);
 void pim_register_join(struct pim_upstream *up);
 void pim_null_register_send(struct pim_upstream *up);
index f6acd087394a3012ee91299530d89425cb9040a9..180ed69fd273a22085909b9a2ac5267eb0b82c9d 100644 (file)
@@ -42,7 +42,7 @@ void pim_addr_dump(const char *onfail, struct prefix *p, char *buf,
        errno = save_errno;
 }
 
-char *pim_str_sg_dump(const struct prefix_sg *sg)
+char *pim_str_sg_dump(const pim_sgaddr *sg)
 {
        static char sg_str[PIM_SG_LEN];
 
index ec25db810ad0b30a43be614062628303d9a18a61..f6d209b79b95ec2dc35d607ba3284a52ed1b27c9 100644 (file)
@@ -24,7 +24,8 @@
 #include <sys/socket.h>
 #include <arpa/inet.h>
 
-#include <prefix.h>
+#include "prefix.h"
+#include "pim_addr.h"
 
 #include "pim_addr.h"
 
  */
 #define PIM_SG_LEN PREFIX_SG_STR_LEN
 #define pim_inet4_dump prefix_mcast_inet4_dump
-#define pim_str_sg_set prefix_sg2str
+
+static inline const char *pim_str_sg_set(const pim_sgaddr *sg, char *str)
+{
+       snprintfrr(str, PREFIX_SG_STR_LEN, "%pSG", sg);
+       return str;
+}
 
 static inline void pim_addr_copy(pim_addr *dest, pim_addr *source)
 {
@@ -58,6 +64,6 @@ void pim_addr_dump(const char *onfail, struct prefix *p, char *buf,
                   int buf_size);
 void pim_inet4_dump(const char *onfail, struct in_addr addr, char *buf,
                    int buf_size);
-char *pim_str_sg_dump(const struct prefix_sg *sg);
+char *pim_str_sg_dump(const pim_sgaddr *sg);
 
 #endif
index 8e6ff2f3a7ce87cdc6fc22e8cb7fa71d7c5cce4a..a4f60e51988816bf912f5845a9532cd3d7f3f63d 100644 (file)
@@ -510,7 +510,7 @@ int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size)
        return addr - buf;
 }
 
-int pim_parse_addr_group(struct prefix_sg *sg, const uint8_t *buf, int buf_size)
+int pim_parse_addr_group(pim_sgaddr *sg, const uint8_t *buf, int buf_size)
 {
        const int grp_encoding_min_len =
                4; /* 1 family + 1 type + 1 reserved + 1 addr */
@@ -569,8 +569,8 @@ int pim_parse_addr_group(struct prefix_sg *sg, const uint8_t *buf, int buf_size)
        return addr - buf;
 }
 
-int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags,
-                         const uint8_t *buf, int buf_size)
+int pim_parse_addr_source(pim_sgaddr *sg, uint8_t *flags, const uint8_t *buf,
+                         int buf_size)
 {
        const int src_encoding_min_len =
                4; /* 1 family + 1 type + 1 reserved + 1 addr */
index ef764656d3cf10773dc6f0a2effa26f72079627c..1aa60d5dbb0dd7e5dc4cf98c8b544db22ac2fdcd 100644 (file)
@@ -111,9 +111,8 @@ int pim_encode_addr_group(uint8_t *buf, afi_t afi, int bidir, int scope,
                          struct in_addr group);
 
 int pim_parse_addr_ucast(struct prefix *p, const uint8_t *buf, int buf_size);
-int pim_parse_addr_group(struct prefix_sg *sg, const uint8_t *buf,
-                        int buf_size);
-int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags,
-                         const uint8_t *buf, int buf_size);
+int pim_parse_addr_group(pim_sgaddr *sg, const uint8_t *buf, int buf_size);
+int pim_parse_addr_source(pim_sgaddr *sg, uint8_t *flags, const uint8_t *buf,
+                         int buf_size);
 
 #endif /* PIM_TLV_H */
index 05da3cb7c2fde095a7c0e90f1c96594518347a5c..ef356213e6c4bea461448bf9eece4306d2ed0624 100644 (file)
@@ -131,7 +131,7 @@ static void pim_upstream_find_new_children(struct pim_instance *pim,
 static struct pim_upstream *pim_upstream_find_parent(struct pim_instance *pim,
                                                     struct pim_upstream *child)
 {
-       struct prefix_sg any = child->sg;
+       pim_sgaddr any = child->sg;
        struct pim_upstream *up = NULL;
 
        // (S,G)
@@ -860,7 +860,7 @@ void pim_upstream_fill_static_iif(struct pim_upstream *up,
 }
 
 static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
-                                            struct prefix_sg *sg,
+                                            pim_sgaddr *sg,
                                             struct interface *incoming,
                                             int flags,
                                             struct pim_ifchannel *ch)
@@ -1012,8 +1012,7 @@ uint32_t pim_up_mlag_peer_cost(struct pim_upstream *up)
        return up->mlag.peer_mrib_metric;
 }
 
-struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
-                                      struct prefix_sg *sg)
+struct pim_upstream *pim_upstream_find(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct pim_upstream lookup;
        struct pim_upstream *up = NULL;
@@ -1023,9 +1022,9 @@ struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
        return up;
 }
 
-struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,
-               struct interface *incoming,
-               int flags, const char *name)
+struct pim_upstream *pim_upstream_find_or_add(pim_sgaddr *sg,
+                                             struct interface *incoming,
+                                             int flags, const char *name)
 {
        struct pim_interface *pim_ifp = incoming->info;
 
@@ -1069,8 +1068,7 @@ void pim_upstream_ref(struct pim_upstream *up, int flags, const char *name)
                           __func__, name, up->sg_str, up->ref_count);
 }
 
-struct pim_upstream *pim_upstream_add(struct pim_instance *pim,
-                                     struct prefix_sg *sg,
+struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg,
                                      struct interface *incoming, int flags,
                                      const char *name,
                                      struct pim_ifchannel *ch)
@@ -1584,7 +1582,7 @@ void pim_upstream_msdp_reg_timer_start(struct pim_upstream *up)
  *  received for the source and group.
  */
 int pim_upstream_switch_to_spt_desired_on_rp(struct pim_instance *pim,
-                                      struct prefix_sg *sg)
+                                            pim_sgaddr *sg)
 {
        if (I_am_RP(pim, sg->grp))
                return 1;
index b4469ad329901e21bc54c9c4ec949667018e2467..25ff3bffe75284bd45f0a4dd9005790fe258b4c2 100644 (file)
@@ -231,7 +231,7 @@ struct pim_upstream {
        struct pim_upstream *parent;
        pim_addr upstream_addr;           /* Who we are talking to */
        pim_addr upstream_register;       /*Who we received a register from*/
-       struct prefix_sg sg;              /* (S,G) group key */
+       pim_sgaddr sg;                    /* (S,G) group key */
        char sg_str[PIM_SG_LEN];
        uint32_t flags;
        struct channel_oil *channel_oil;
@@ -291,12 +291,11 @@ static inline bool pim_up_mlag_is_local(struct pim_upstream *up)
 }
 
 struct pim_upstream *pim_upstream_find(struct pim_instance *pim,
-                                      struct prefix_sg *sg);
-struct pim_upstream *pim_upstream_find_or_add(struct prefix_sg *sg,
+                                      pim_sgaddr *sg);
+struct pim_upstream *pim_upstream_find_or_add(pim_sgaddr *sg,
                                              struct interface *ifp, int flags,
                                              const char *name);
-struct pim_upstream *pim_upstream_add(struct pim_instance *pim,
-                                     struct prefix_sg *sg,
+struct pim_upstream *pim_upstream_add(struct pim_instance *pim, pim_sgaddr *sg,
                                      struct interface *ifp, int flags,
                                      const char *name,
                                      struct pim_ifchannel *ch);
@@ -338,7 +337,7 @@ void pim_upstream_keep_alive_timer_start(struct pim_upstream *up,
                                         uint32_t time);
 
 int pim_upstream_switch_to_spt_desired_on_rp(struct pim_instance *pim,
-                                      struct prefix_sg *sg);
+                                            pim_sgaddr *sg);
 #define SwitchToSptDesiredOnRp(pim, sg) pim_upstream_switch_to_spt_desired_on_rp (pim, sg)
 int pim_upstream_is_sg_rpt(struct pim_upstream *up);
 
index edd41bc44d5d72954cc2968b5f126692333eb182..3aa8bacb843cf77eab57a35b4203581275ca4a9b 100644 (file)
@@ -734,7 +734,7 @@ static bool pim_vxlan_sg_hash_eq(const void *p1, const void *p2)
 }
 
 static struct pim_vxlan_sg *pim_vxlan_sg_new(struct pim_instance *pim,
-               struct prefix_sg *sg)
+                                            pim_sgaddr *sg)
 {
        struct pim_vxlan_sg *vxlan_sg;
 
@@ -760,8 +760,7 @@ static struct pim_vxlan_sg *pim_vxlan_sg_new(struct pim_instance *pim,
        return vxlan_sg;
 }
 
-struct pim_vxlan_sg *pim_vxlan_sg_find(struct pim_instance *pim,
-               struct prefix_sg *sg)
+struct pim_vxlan_sg *pim_vxlan_sg_find(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct pim_vxlan_sg lookup;
 
@@ -769,8 +768,7 @@ struct pim_vxlan_sg *pim_vxlan_sg_find(struct pim_instance *pim,
        return hash_lookup(pim->vxlan.sg_hash, &lookup);
 }
 
-struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim,
-               struct prefix_sg *sg)
+struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct pim_vxlan_sg *vxlan_sg;
 
@@ -805,7 +803,7 @@ static void pim_vxlan_sg_del_item(struct pim_vxlan_sg *vxlan_sg)
        XFREE(MTYPE_PIM_VXLAN_SG, vxlan_sg);
 }
 
-void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg)
+void pim_vxlan_sg_del(struct pim_instance *pim, pim_sgaddr *sg)
 {
        struct pim_vxlan_sg *vxlan_sg;
 
index d17de8e3d0e9b6fd6471bcc3a98c39bcb23be167..cd3de23e618399ef8760a66aacb6c3ae20435360 100644 (file)
@@ -41,7 +41,7 @@ struct pim_vxlan_sg {
        struct pim_instance *pim;
 
        /* key */
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        char sg_str[PIM_SG_LEN];
 
        enum pim_vxlan_sg_flags flags;
@@ -127,10 +127,10 @@ static inline bool pim_vxlan_is_term_dev_cfg(struct pim_instance *pim,
 
 extern struct pim_vxlan *pim_vxlan_p;
 extern struct pim_vxlan_sg *pim_vxlan_sg_find(struct pim_instance *pim,
-                                           struct prefix_sg *sg);
+                                             pim_sgaddr *sg);
 extern struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim,
-                                          struct prefix_sg *sg);
-extern void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg);
+                                            pim_sgaddr *sg);
+extern void pim_vxlan_sg_del(struct pim_instance *pim, pim_sgaddr *sg);
 extern void pim_vxlan_update_sg_reg_state(struct pim_instance *pim,
                struct pim_upstream *up, bool reg_join);
 extern struct pim_interface *pim_vxlan_get_term_ifp(struct pim_instance *pim);
index 5708c35751f9f4b5198adadff79e742a31e95700..8ddffbd2ed4f728dfb46a0e60e01af827a3d0d47 100644 (file)
@@ -327,7 +327,8 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS)
 {
        struct stream *s;
        struct pim_instance *pim;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
+       size_t prefixlen;
 
        pim = pim_get_pim_instance(vrf_id);
        if (!pim)
@@ -335,10 +336,9 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS)
 
        s = zclient->ibuf;
 
-       sg.family = AF_INET;
-       sg.prefixlen = stream_getl(s);
-       stream_get(&sg.src.s_addr, s, sg.prefixlen);
-       stream_get(&sg.grp.s_addr, s, sg.prefixlen);
+       prefixlen = stream_getl(s);
+       stream_get(&sg.src.s_addr, s, prefixlen);
+       stream_get(&sg.grp.s_addr, s, prefixlen);
 
        if (PIM_DEBUG_ZEBRA) {
                char sg_str[PIM_SG_LEN];
@@ -502,7 +502,7 @@ void igmp_anysource_forward_stop(struct gm_group *group)
 static void igmp_source_forward_reevaluate_one(struct pim_instance *pim,
                                               struct gm_source *source)
 {
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        struct gm_group *group = source->source_group;
        struct pim_ifchannel *ch;
 
@@ -510,7 +510,7 @@ static void igmp_source_forward_reevaluate_one(struct pim_instance *pim,
            || !IGMP_SOURCE_TEST_FORWARDING(source->source_flags))
                return;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = source->source_addr;
        sg.grp = group->group_addr;
 
@@ -581,11 +581,11 @@ void igmp_source_forward_start(struct pim_instance *pim,
 {
        struct pim_interface *pim_oif;
        struct gm_group *group;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int result;
        int input_iface_vif_index = 0;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = source->source_addr;
        sg.grp = source->source_group->group_addr;
 
@@ -761,10 +761,10 @@ void igmp_source_forward_start(struct pim_instance *pim,
 void igmp_source_forward_stop(struct gm_source *source)
 {
        struct gm_group *group;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int result;
 
-       memset(&sg, 0, sizeof(struct prefix_sg));
+       memset(&sg, 0, sizeof(sg));
        sg.src = source->source_addr;
        sg.grp = source->source_group->group_addr;
 
index abf1119ac57b11b9ffb1500d846ce05ac3d1c6e6..755b9b1320ae31588ab1b3e37850db07f622e1e5 100644 (file)
@@ -524,14 +524,14 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
        struct stream *s = zlookup->obuf;
        uint16_t command = 0;
        unsigned long long lastused;
-       struct prefix_sg sg;
+       pim_sgaddr sg;
        int count = 0;
        int ret;
        struct interface *ifp =
                pim_if_find_by_vif_index(c_oil->pim, c_oil->oil.mfcc_parent);
 
        if (PIM_DEBUG_ZEBRA) {
-               struct prefix_sg more;
+               pim_sgaddr more;
 
                more.src = c_oil->oil.mfcc_origin;
                more.grp = c_oil->oil.mfcc_mcastgrp;
@@ -587,7 +587,7 @@ int pim_zlookup_sg_statistics(struct channel_oil *c_oil)
        if (sg.src.s_addr != c_oil->oil.mfcc_origin.s_addr
            || sg.grp.s_addr != c_oil->oil.mfcc_mcastgrp.s_addr) {
                if (PIM_DEBUG_ZEBRA) {
-                       struct prefix_sg more;
+                       pim_sgaddr more;
 
                        more.src = c_oil->oil.mfcc_origin;
                        more.grp = c_oil->oil.mfcc_mcastgrp;