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);
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;
/*
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];
#include "linklist.h"
struct pim_br {
- struct prefix_sg sg;
+ pim_sgaddr sg;
struct in_addr pmbr;
};
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;
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;
/*
* 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;
#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);
}
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;
}
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;
"The Group\n"
JSON_STR)
{
- struct prefix_sg sg = {0};
+ pim_sgaddr sg = {0};
struct vrf *v;
bool uj = !!json;
struct pim_instance *pim;
"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;
"The Group\n"
JSON_STR)
{
- struct prefix_sg sg = {0};
+ pim_sgaddr sg = {0};
struct vrf *v;
bool uj = !!json;
struct pim_instance *pim;
"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;
}
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;
"Fill in Assumed data\n"
JSON_STR)
{
- struct prefix_sg sg = {0};
+ pim_sgaddr sg = {0};
struct pim_instance *pim;
struct vrf *v;
"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;
{
struct pim_upstream *up;
struct pim_instance *pim;
- struct prefix_sg sg;
+ pim_sgaddr sg;
sg.src = source;
sg.grp = group;
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;
return;
}
- sg.family = AF_INET;
- sg.prefixlen = IPV4_MAX_BITLEN;
if (uj)
json = json_object_new_object();
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;
*/
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)
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;
}
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;
}
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;
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;
}
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;
}
}
-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;
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;
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;
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);
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;
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);
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);
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;
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;
}
/*
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;
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);
}
/* 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;
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;
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)
{
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)
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);
}
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);
}
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;
/*
return 0;
}
- memset(&sg, 0, sizeof(struct prefix_sg));
+ memset(&sg, 0, sizeof(sg));
sg.src = msg->im_src;
sg.grp = msg->im_dst;
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;
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);
{
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;
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",
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;
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;
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;
/* 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;
}
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;
}
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;
}
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;
}
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;
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;
/* 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;
}
}
-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;
}
}
-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));
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 */
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);
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);
}
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;
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;
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);
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
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(
{
char *out;
struct interface *ifp;
- struct prefix_sg sg;
+ pim_sgaddr sg;
int i;
sg.src = c_oil->oil.mfcc_origin;
}
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;
}
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;
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;
}
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;
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);
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;
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;
{
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;
* 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;
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);
}
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);
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];
#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)
{
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
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 */
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 */
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 */
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)
}
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)
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;
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;
__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)
* 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;
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;
}
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);
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);
}
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;
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;
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;
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;
struct pim_instance *pim;
/* key */
- struct prefix_sg sg;
+ pim_sgaddr sg;
char sg_str[PIM_SG_LEN];
enum pim_vxlan_sg_flags flags;
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);
{
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)
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];
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;
|| !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;
{
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;
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;
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;
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;