summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/prefix.h20
-rw-r--r--pimd/pim_assert.c12
-rw-r--r--pimd/pim_br.c20
-rw-r--r--pimd/pim_br.h6
-rw-r--r--pimd/pim_cmd.c48
-rw-r--r--pimd/pim_ifchannel.c74
-rw-r--r--pimd/pim_ifchannel.h14
-rw-r--r--pimd/pim_join.c36
-rw-r--r--pimd/pim_join.h2
-rw-r--r--pimd/pim_mroute.c26
-rw-r--r--pimd/pim_oil.c14
-rw-r--r--pimd/pim_oil.h2
-rw-r--r--pimd/pim_register.c28
-rw-r--r--pimd/pim_str.c6
-rw-r--r--pimd/pim_str.h2
-rw-r--r--pimd/pim_upstream.c78
-rw-r--r--pimd/pim_upstream.h10
-rw-r--r--pimd/pim_zebra.c18
18 files changed, 206 insertions, 210 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index 4878fcfdd..a2cdfe96f 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -74,20 +74,13 @@ struct prefix
{
u_char prefix;
struct in_addr prefix4;
-#ifdef HAVE_IPV6
struct in6_addr prefix6;
-#endif /* HAVE_IPV6 */
struct
{
struct in_addr id;
struct in_addr adv_router;
} lp;
struct ethaddr prefix_eth; /* AF_ETHERNET */
- struct
- {
- struct in_addr src;
- struct in_addr grp;
- } sg;
u_char val[8];
uintptr_t ptr;
} u __attribute__ ((aligned (8)));
@@ -102,14 +95,12 @@ struct prefix_ipv4
};
/* IPv6 prefix structure. */
-#ifdef HAVE_IPV6
struct prefix_ipv6
{
u_char family;
u_char prefixlen;
struct in6_addr prefix __attribute__ ((aligned (8)));
};
-#endif /* HAVE_IPV6 */
struct prefix_ls
{
@@ -143,6 +134,14 @@ struct prefix_ptr
uintptr_t prefix __attribute__ ((aligned (8)));
};
+struct prefix_sg
+{
+ u_char family;
+ u_char prefixlen;
+ struct in_addr src __attribute ((aligned (8)));
+ struct in_addr grp;
+};
+
/* helper to get type safety/avoid casts on calls
* (w/o this, functions accepting all prefix types need casts on the caller
* side, which strips type safety since the cast will accept any pointer
@@ -276,7 +275,6 @@ extern in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
extern int netmask_str2prefix_str (const char *, const char *, char *);
-#ifdef HAVE_IPV6
extern struct prefix_ipv6 *prefix_ipv6_new (void);
extern void prefix_ipv6_free (struct prefix_ipv6 *);
extern int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
@@ -303,8 +301,6 @@ static inline int ipv6_martian (struct in6_addr *addr)
return 0;
}
-#endif /* HAVE_IPV6 */
-
extern int all_digit (const char *);
/* NOTE: This routine expects the address argument in network byte order. */
diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c
index 07f49c6ad..4443e4459 100644
--- a/pimd/pim_assert.c
+++ b/pimd/pim_assert.c
@@ -145,11 +145,11 @@ static int dispatch_assert(struct interface *ifp,
struct pim_assert_metric recv_metric)
{
struct pim_ifchannel *ch;
- struct prefix sg;
+ struct prefix_sg sg;
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source_addr;
- sg.u.sg.grp = group_addr;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = source_addr;
+ sg.grp = group_addr;
ch = pim_ifchannel_add(ifp, &sg);
if (!ch) {
zlog_warn("%s: (S,G)=%s failure creating channel on interface %s",
@@ -443,7 +443,7 @@ static int pim_assert_do(struct pim_ifchannel *ch,
}
pim_msg_size = pim_assert_build_msg(pim_msg, sizeof(pim_msg), ifp,
- ch->sg.u.sg.grp, ch->sg.u.sg.src,
+ ch->sg.grp, ch->sg.src,
metric.metric_preference,
metric.route_metric,
metric.rpt_bit_flag);
@@ -504,7 +504,7 @@ static int pim_assert_cancel(struct pim_ifchannel *ch)
metric.rpt_bit_flag = 0;
metric.metric_preference = PIM_ASSERT_METRIC_PREFERENCE_MAX;
metric.route_metric = PIM_ASSERT_ROUTE_METRIC_MAX;
- metric.ip_address = ch->sg.u.sg.src;
+ metric.ip_address = ch->sg.src;
return pim_assert_do(ch, metric);
}
diff --git a/pimd/pim_br.c b/pimd/pim_br.c
index ceee40e71..3f84de79c 100644
--- a/pimd/pim_br.c
+++ b/pimd/pim_br.c
@@ -30,7 +30,7 @@
#include "linklist.h"
struct pim_br {
- struct prefix sg;
+ struct prefix_sg sg;
struct in_addr pmbr;
};
@@ -39,14 +39,14 @@ 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)
+pim_br_get_pmbr (struct prefix_sg *sg)
{
struct listnode *node;
struct pim_br *pim_br;
for (ALL_LIST_ELEMENTS_RO (pim_br_list, node, pim_br)) {
- if (sg->u.sg.src.s_addr == pim_br->sg.u.sg.src.s_addr &&
- sg->u.sg.grp.s_addr == pim_br->sg.u.sg.grp.s_addr)
+ if (sg->src.s_addr == pim_br->sg.src.s_addr &&
+ sg->grp.s_addr == pim_br->sg.grp.s_addr)
return pim_br->pmbr;
}
@@ -54,14 +54,14 @@ pim_br_get_pmbr (struct prefix *sg)
}
void
-pim_br_set_pmbr (struct prefix *sg, struct in_addr br)
+pim_br_set_pmbr (struct prefix_sg *sg, struct in_addr br)
{
struct listnode *node, *next;
struct pim_br *pim_br;
for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) {
- if (sg->u.sg.src.s_addr == pim_br->sg.u.sg.src.s_addr &&
- sg->u.sg.grp.s_addr == pim_br->sg.u.sg.grp.s_addr)
+ if (sg->src.s_addr == pim_br->sg.src.s_addr &&
+ sg->grp.s_addr == pim_br->sg.grp.s_addr)
break;
}
@@ -84,14 +84,14 @@ pim_br_set_pmbr (struct prefix *sg, struct in_addr br)
* Remove the (S,G) from the stored values
*/
void
-pim_br_clear_pmbr (struct prefix *sg)
+pim_br_clear_pmbr (struct prefix_sg *sg)
{
struct listnode *node, *next;
struct pim_br *pim_br;
for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) {
- if (sg->u.sg.src.s_addr == pim_br->sg.u.sg.src.s_addr &&
- sg->u.sg.grp.s_addr == pim_br->sg.u.sg.grp.s_addr)
+ if (sg->src.s_addr == pim_br->sg.src.s_addr &&
+ sg->grp.s_addr == pim_br->sg.grp.s_addr)
break;
}
diff --git a/pimd/pim_br.h b/pimd/pim_br.h
index bcb864dfc..8e4f719ed 100644
--- a/pimd/pim_br.h
+++ b/pimd/pim_br.h
@@ -21,10 +21,10 @@
#ifndef PIM_BR_H
#define PIM_BR_H
-struct in_addr pim_br_get_pmbr (struct prefix *sg);
+struct in_addr pim_br_get_pmbr (struct prefix_sg *sg);
-void pim_br_set_pmbr (struct prefix *sg, struct in_addr value);
-void pim_br_clear_pmbr (struct prefix *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_init (void);
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 4319b0681..ed7e57a95 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -128,11 +128,11 @@ static void pim_if_membership_refresh(struct interface *ifp)
for (ALL_LIST_ELEMENTS_RO(grp->group_source_list, srcnode, src)) {
if (IGMP_SOURCE_TEST_FORWARDING(src->source_flags)) {
- struct prefix sg;
+ struct prefix_sg sg;
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = src->source_addr;
- sg.u.sg.grp = grp->group_addr;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = src->source_addr;
+ sg.grp = grp->group_addr;
pim_ifchannel_local_membership_add(ifp, &sg);
}
@@ -180,9 +180,9 @@ static void pim_show_assert(struct vty *vty)
char uptime[10];
char timer[10];
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
pim_inet4_dump("<assrt_win?>", ch->ifassert_winner,
winner_str, sizeof(winner_str));
@@ -238,9 +238,9 @@ static void pim_show_assert_internal(struct vty *vty)
char ch_src_str[100];
char ch_grp_str[100];
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
vty_out(vty, "%-9s %-15s %-15s %-15s %-3s %-3s %-3s %-4s%s",
ifp->name,
@@ -286,9 +286,9 @@ static void pim_show_assert_metric(struct vty *vty)
am = pim_macro_spt_assert_metric(&ch->upstream->rpf, pim_ifp->primary_address);
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
pim_inet4_dump("<addr?>", am.ip_address,
addr_str, sizeof(addr_str));
@@ -339,9 +339,9 @@ static void pim_show_assert_winner_metric(struct vty *vty)
am = &ch->ifassert_winner_metric;
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
pim_inet4_dump("<addr?>", am->ip_address,
addr_str, sizeof(addr_str));
@@ -396,9 +396,9 @@ static void pim_show_membership(struct vty *vty)
char ch_src_str[100];
char ch_grp_str[100];
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
vty_out(vty, "%-9s %-15s %-15s %-15s %-10s%s",
@@ -730,9 +730,9 @@ static void pim_show_join(struct vty *vty)
char expire[10];
char prune[10];
- pim_inet4_dump("<ch_src?>", ch->sg.u.sg.src,
+ pim_inet4_dump("<ch_src?>", ch->sg.src,
ch_src_str, sizeof(ch_src_str));
- pim_inet4_dump("<ch_grp?>", ch->sg.u.sg.grp,
+ pim_inet4_dump("<ch_grp?>", ch->sg.grp,
ch_grp_str, sizeof(ch_grp_str));
pim_time_uptime_begin(uptime, sizeof(uptime), now, ch->ifjoin_creation);
@@ -991,8 +991,8 @@ static void pim_show_upstream(struct vty *vty)
char join_timer[10];
char rs_timer[10];
- pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
pim_time_uptime(uptime, sizeof(uptime), now - up->state_transition);
pim_time_timer_to_hhmmss(join_timer, sizeof(join_timer), up->t_join_timer);
pim_time_timer_to_hhmmss (rs_timer, sizeof (rs_timer), up->t_rs_timer);
@@ -1034,8 +1034,8 @@ static void pim_show_join_desired(struct vty *vty)
for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_ifchannel_list, chnode, ch)) {
struct pim_upstream *up = ch->upstream;
- pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
vty_out(vty, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
ifp->name,
@@ -1070,8 +1070,8 @@ static void pim_show_upstream_rpf(struct vty *vty)
rpf = &up->rpf;
- pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
pim_inet4_dump("<nexthop?>", rpf->source_nexthop.mrib_nexthop_addr, rpf_nexthop_str, sizeof(rpf_nexthop_str));
pim_inet4_dump("<rpf?>", rpf->rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
@@ -1147,8 +1147,8 @@ static void pim_show_rpf(struct vty *vty)
const char *rpf_ifname;
struct pim_rpf *rpf = &up->rpf;
- pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
pim_inet4_dump("<rpf?>", rpf->rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
pim_inet4_dump("<nexthop?>", rpf->source_nexthop.mrib_nexthop_addr, rib_nexthop_str, sizeof(rib_nexthop_str));
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index f1da740e7..dcd9da64b 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -51,13 +51,13 @@ pim_ifchannel_remove_children (struct pim_ifchannel *ch)
struct pim_ifchannel *child;
// Basic sanity, (*,*) not currently supported
- if ((ch->sg.u.sg.src.s_addr == INADDR_ANY) &&
- (ch->sg.u.sg.grp.s_addr == INADDR_ANY))
+ if ((ch->sg.src.s_addr == INADDR_ANY) &&
+ (ch->sg.grp.s_addr == INADDR_ANY))
return;
// Basic sanity (S,G) have no children
- if ((ch->sg.u.sg.src.s_addr != INADDR_ANY) &&
- (ch->sg.u.sg.grp.s_addr != INADDR_ANY))
+ if ((ch->sg.src.s_addr != INADDR_ANY) &&
+ (ch->sg.grp.s_addr != INADDR_ANY))
return;
for (ALL_LIST_ELEMENTS_RO (pim_ifp->pim_ifchannel_list, ch_node, child))
@@ -80,18 +80,18 @@ pim_ifchannel_find_new_children (struct pim_ifchannel *ch)
struct listnode *ch_node;
// Basic Sanity that we are not being silly
- if ((ch->sg.u.sg.src.s_addr != INADDR_ANY) &&
- (ch->sg.u.sg.grp.s_addr != INADDR_ANY))
+ if ((ch->sg.src.s_addr != INADDR_ANY) &&
+ (ch->sg.grp.s_addr != INADDR_ANY))
return;
- if ((ch->sg.u.sg.src.s_addr == INADDR_ANY) &&
- (ch->sg.u.sg.grp.s_addr == INADDR_ANY))
+ if ((ch->sg.src.s_addr == INADDR_ANY) &&
+ (ch->sg.grp.s_addr == INADDR_ANY))
return;
for (ALL_LIST_ELEMENTS_RO (pim_ifp->pim_ifchannel_list, ch_node, child))
{
- if ((ch->sg.u.sg.grp.s_addr != INADDR_ANY) &&
- (child->sg.u.sg.grp.s_addr == ch->sg.u.sg.grp.s_addr) &&
+ if ((ch->sg.grp.s_addr != INADDR_ANY) &&
+ (child->sg.grp.s_addr == ch->sg.grp.s_addr) &&
(child != ch))
child->parent = ch;
}
@@ -244,7 +244,7 @@ void reset_ifassert_state(struct pim_ifchannel *ch)
}
struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
- struct prefix *sg)
+ struct prefix_sg *sg)
{
struct pim_interface *pim_ifp;
struct listnode *ch_node;
@@ -264,8 +264,8 @@ struct pim_ifchannel *pim_ifchannel_find(struct interface *ifp,
for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_ifchannel_list, ch_node, ch)) {
if (
- (sg->u.sg.src.s_addr == ch->sg.u.sg.src.s_addr) &&
- (sg->u.sg.grp.s_addr == ch->sg.u.sg.grp.s_addr)
+ (sg->src.s_addr == ch->sg.src.s_addr) &&
+ (sg->grp.s_addr == ch->sg.grp.s_addr)
) {
return ch;
}
@@ -333,33 +333,33 @@ void pim_ifchannel_delete_on_noinfo(struct interface *ifp)
*/
static struct pim_ifchannel *
pim_ifchannel_find_parent (struct interface *ifp,
- struct prefix *sg)
+ struct prefix_sg *sg)
{
- struct prefix parent_sg = *sg;
+ struct prefix_sg parent_sg = *sg;
// (*,*) || (S,*)
- if (((sg->u.sg.src.s_addr == INADDR_ANY) &&
- (sg->u.sg.grp.s_addr == INADDR_ANY)) ||
- ((sg->u.sg.src.s_addr != INADDR_ANY) &&
- (sg->u.sg.grp.s_addr == INADDR_ANY)))
+ if (((sg->src.s_addr == INADDR_ANY) &&
+ (sg->grp.s_addr == INADDR_ANY)) ||
+ ((sg->src.s_addr != INADDR_ANY) &&
+ (sg->grp.s_addr == INADDR_ANY)))
return NULL;
// (S,G)
- if ((sg->u.sg.src.s_addr != INADDR_ANY) &&
- (sg->u.sg.grp.s_addr != INADDR_ANY))
+ if ((sg->src.s_addr != INADDR_ANY) &&
+ (sg->grp.s_addr != INADDR_ANY))
{
- parent_sg.u.sg.src.s_addr = INADDR_ANY;
+ parent_sg.src.s_addr = INADDR_ANY;
return pim_ifchannel_find (ifp, &parent_sg);
}
// (*,G) -- Not going to find anything currently
- parent_sg.u.sg.grp.s_addr = INADDR_ANY;
+ parent_sg.grp.s_addr = INADDR_ANY;
return pim_ifchannel_find (ifp, &parent_sg);
}
struct pim_ifchannel *
pim_ifchannel_add(struct interface *ifp,
- struct prefix *sg)
+ struct prefix_sg *sg)
{
struct pim_interface *pim_ifp;
struct pim_ifchannel *ch;
@@ -459,7 +459,7 @@ static int on_ifjoin_prune_pending_timer(struct thread *t)
int send_prune_echo; /* boolean */
struct interface *ifp;
struct pim_interface *pim_ifp;
- struct prefix sg;
+ struct prefix_sg sg;
zassert(t);
ch = THREAD_ARG(t);
@@ -490,7 +490,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,
+ struct prefix_sg *sg,
uint8_t source_flags,
int holdtime)
{
@@ -557,7 +557,7 @@ static void check_recv_upstream(int is_join,
static int nonlocal_upstream(int is_join,
struct interface *recv_ifp,
struct in_addr upstream,
- struct prefix *sg,
+ struct prefix_sg *sg,
uint8_t source_flags,
uint16_t holdtime)
{
@@ -596,7 +596,7 @@ static int nonlocal_upstream(int is_join,
void pim_ifchannel_join_add(struct interface *ifp,
struct in_addr neigh_addr,
struct in_addr upstream,
- struct prefix *sg,
+ struct prefix_sg *sg,
uint8_t source_flags,
uint16_t holdtime)
{
@@ -696,7 +696,7 @@ void pim_ifchannel_join_add(struct interface *ifp,
void pim_ifchannel_prune(struct interface *ifp,
struct in_addr upstream,
- struct prefix *sg,
+ struct prefix_sg *sg,
uint8_t source_flags,
uint16_t holdtime)
{
@@ -753,7 +753,7 @@ void pim_ifchannel_prune(struct interface *ifp,
}
void pim_ifchannel_local_membership_add(struct interface *ifp,
- struct prefix *sg)
+ struct prefix_sg *sg)
{
struct pim_ifchannel *ch;
struct pim_interface *pim_ifp;
@@ -776,7 +776,7 @@ void pim_ifchannel_local_membership_add(struct interface *ifp,
}
void pim_ifchannel_local_membership_del(struct interface *ifp,
- struct prefix *sg)
+ struct prefix_sg *sg)
{
struct pim_ifchannel *ch;
struct pim_interface *pim_ifp;
@@ -808,8 +808,8 @@ void pim_ifchannel_update_could_assert(struct pim_ifchannel *ch)
if (PIM_DEBUG_PIM_EVENTS) {
char src_str[100];
char grp_str[100];
- pim_inet4_dump("<src?>", ch->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", ch->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", ch->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", ch->sg.grp, grp_str, sizeof(grp_str));
zlog_debug("%s: CouldAssert(%s,%s,%s) changed from %d to %d",
__PRETTY_FUNCTION__,
src_str, grp_str, ch->interface->name,
@@ -852,8 +852,8 @@ void pim_ifchannel_update_my_assert_metric(struct pim_ifchannel *ch)
char grp_str[100];
char old_addr_str[100];
char new_addr_str[100];
- pim_inet4_dump("<src?>", ch->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", ch->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", ch->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", ch->sg.grp, grp_str, sizeof(grp_str));
pim_inet4_dump("<old_addr?>", ch->ifassert_my_metric.ip_address, old_addr_str, sizeof(old_addr_str));
pim_inet4_dump("<new_addr?>", my_metric_new.ip_address, new_addr_str, sizeof(new_addr_str));
zlog_debug("%s: my_assert_metric(%s,%s,%s) changed from %u,%u,%u,%s to %u,%u,%u,%s",
@@ -888,8 +888,8 @@ void pim_ifchannel_update_assert_tracking_desired(struct pim_ifchannel *ch)
if (PIM_DEBUG_PIM_EVENTS) {
char src_str[100];
char grp_str[100];
- pim_inet4_dump("<src?>", ch->sg.u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump("<grp?>", ch->sg.u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump("<src?>", ch->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", ch->sg.grp, grp_str, sizeof(grp_str));
zlog_debug("%s: AssertTrackingDesired(%s,%s,%s) changed from %d to %d",
__PRETTY_FUNCTION__,
src_str, grp_str, ch->interface->name,
diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h
index eb6b0925a..7036131e5 100644
--- a/pimd/pim_ifchannel.h
+++ b/pimd/pim_ifchannel.h
@@ -73,7 +73,7 @@ struct pim_assert_metric {
*/
struct pim_ifchannel {
struct pim_ifchannel *parent;
- struct prefix sg;
+ struct prefix_sg sg;
struct interface *interface; /* backpointer to interface */
uint32_t flags;
@@ -103,24 +103,24 @@ void pim_ifchannel_delete(struct pim_ifchannel *ch);
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);
+ struct prefix_sg *sg);
struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
- struct prefix *sg);
+ struct prefix_sg *sg);
void pim_ifchannel_join_add(struct interface *ifp,
struct in_addr neigh_addr,
struct in_addr upstream,
- struct prefix *sg,
+ struct prefix_sg *sg,
uint8_t source_flags,
uint16_t holdtime);
void pim_ifchannel_prune(struct interface *ifp,
struct in_addr upstream,
- struct prefix *sg,
+ struct prefix_sg *sg,
uint8_t source_flags,
uint16_t holdtime);
void pim_ifchannel_local_membership_add(struct interface *ifp,
- struct prefix *sg);
+ struct prefix_sg *sg);
void pim_ifchannel_local_membership_del(struct interface *ifp,
- struct prefix *sg);
+ struct prefix_sg *sg);
void pim_ifchannel_ifjoin_switch(const char *caller,
struct pim_ifchannel *ch,
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 3d98f9f95..7e0f268f9 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -58,11 +58,11 @@ static void recv_join(struct interface *ifp,
struct in_addr source,
uint8_t source_flags)
{
- struct prefix sg;
+ struct prefix_sg sg;
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source;
- sg.u.sg.grp = group;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = source;
+ sg.grp = group;
if (PIM_DEBUG_PIM_TRACE) {
char up_str[100];
@@ -84,23 +84,23 @@ static void recv_join(struct interface *ifp,
if ((source_flags & PIM_RPT_BIT_MASK) &&
(source_flags & PIM_WILDCARD_BIT_MASK))
{
- struct pim_rpf *rp = RP (sg.u.sg.grp);
+ struct pim_rpf *rp = RP (sg.grp);
/*
* If the RP sent in the message is not
* our RP for the group, drop the message
*/
- if (sg.u.sg.src.s_addr != rp->rpf_addr.s_addr)
+ if (sg.src.s_addr != rp->rpf_addr.s_addr)
return;
- sg.u.sg.src.s_addr = INADDR_ANY;
+ sg.src.s_addr = INADDR_ANY;
}
/* Restart join expiry timer */
pim_ifchannel_join_add(ifp, neigh->source_addr, upstream,
&sg, source_flags, holdtime);
- if (sg.u.sg.src.s_addr == INADDR_ANY)
+ if (sg.src.s_addr == INADDR_ANY)
{
struct pim_upstream *up = pim_upstream_find (&sg);
struct pim_upstream *child;
@@ -133,11 +133,11 @@ static void recv_prune(struct interface *ifp,
struct in_addr source,
uint8_t source_flags)
{
- struct prefix sg;
+ struct prefix_sg sg;
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source;
- sg.u.sg.grp = group;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = source;
+ sg.grp = group;
if (PIM_DEBUG_PIM_TRACE) {
char up_str[100];
@@ -155,18 +155,18 @@ static void recv_prune(struct interface *ifp,
if ((source_flags & PIM_RPT_BIT_MASK) &&
(source_flags & PIM_WILDCARD_BIT_MASK))
{
- struct pim_rpf *rp = RP (sg.u.sg.grp);
+ struct pim_rpf *rp = RP (sg.grp);
// Ignoring Prune *,G's at the moment.
- if (sg.u.sg.src.s_addr != rp->rpf_addr.s_addr)
+ if (sg.src.s_addr != rp->rpf_addr.s_addr)
return;
- sg.u.sg.src.s_addr = INADDR_ANY;
+ sg.src.s_addr = INADDR_ANY;
}
pim_ifchannel_prune(ifp, upstream, &sg, source_flags, holdtime);
- if (sg.u.sg.src.s_addr == INADDR_ANY)
+ if (sg.src.s_addr == INADDR_ANY)
{
struct pim_upstream *up = pim_upstream_find (&sg);
struct pim_upstream *child;
@@ -355,7 +355,7 @@ int pim_joinprune_recv(struct interface *ifp,
int pim_joinprune_send(struct interface *ifp,
struct in_addr upstream_addr,
- struct prefix *sg,
+ struct prefix_sg *sg,
int send_join)
{
struct pim_interface *pim_ifp;
@@ -411,7 +411,7 @@ int pim_joinprune_send(struct interface *ifp,
Build PIM message
*/
pim_msg_size = pim_msg_join_prune_encode (pim_msg, 1000, send_join,
- sg->u.sg.src, sg->u.sg.grp,
+ sg->src, sg->grp,
upstream_addr, PIM_JP_HOLDTIME);
if (pim_msg_size < 0)
diff --git a/pimd/pim_join.h b/pimd/pim_join.h
index 6777587c3..e6bddf31b 100644
--- a/pimd/pim_join.h
+++ b/pimd/pim_join.h
@@ -35,7 +35,7 @@ int pim_joinprune_recv(struct interface *ifp,
int pim_joinprune_send(struct interface *ifp,
struct in_addr upstream_addr,
- struct prefix *sg,
+ struct prefix_sg *sg,
int send_join);
#endif /* PIM_JOIN_H */
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index f26fb7ae2..aa2d021ee 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -95,7 +95,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
struct pim_interface *pim_ifp = ifp->info;
struct pim_upstream *up;
struct pim_rpf *rpg;
- struct prefix sg;
+ struct prefix_sg sg;
rpg = RP(msg->im_dst);
/*
@@ -126,9 +126,9 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
__PRETTY_FUNCTION__, grp_str, src_str);
}
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = msg->im_src;
- sg.u.sg.grp = msg->im_dst;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = msg->im_src;
+ sg.grp = msg->im_dst;
up = pim_upstream_add (&sg, ifp);
if (!up) {
if (PIM_DEBUG_MROUTE) {
@@ -164,16 +164,16 @@ pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
const char *src_str, const char *grp_str)
{
struct pim_interface *pim_ifp;
- struct prefix sg;
+ struct prefix_sg 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.u.sg.src = ip_hdr->ip_src;
- sg.u.sg.grp = ip_hdr->ip_dst;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = ip_hdr->ip_src;
+ sg.grp = ip_hdr->ip_dst;
up = pim_upstream_find(&sg);
if (!up) {
@@ -186,7 +186,7 @@ pim_mroute_msg_wholepkt (int fd, struct interface *ifp, const char *buf,
pim_ifp = up->rpf.source_nexthop.interface->info;
- rpg = RP(sg.u.sg.grp);
+ rpg = RP(sg.grp);
if ((rpg->rpf_addr.s_addr == INADDR_NONE) ||
(!pim_ifp) ||
@@ -213,7 +213,7 @@ pim_mroute_msg_wrongvif (int fd, struct interface *ifp, const struct igmpmsg *ms
{
struct pim_ifchannel *ch;
struct pim_interface *pim_ifp;
- struct prefix sg;
+ struct prefix_sg sg;
/*
Send Assert(S,G) on iif as response to WRONGVIF kernel upcall.
@@ -245,9 +245,9 @@ pim_mroute_msg_wrongvif (int fd, struct interface *ifp, const struct igmpmsg *ms
return -2;
}
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = msg->im_src;
- sg.u.sg.grp = msg->im_dst;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = msg->im_src;
+ sg.grp = msg->im_dst;
ch = pim_ifchannel_find(ifp, &sg);
if (!ch) {
if (PIM_DEBUG_MROUTE) {
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c
index 8c7beeb97..d3895ea28 100644
--- a/pimd/pim_oil.c
+++ b/pimd/pim_oil.c
@@ -51,7 +51,7 @@ pim_del_channel_oil (struct channel_oil *c_oil)
}
static struct channel_oil *
-pim_add_channel_oil (struct prefix *sg,
+pim_add_channel_oil (struct prefix_sg *sg,
int input_vif_index)
{
struct channel_oil *c_oil;
@@ -71,8 +71,8 @@ pim_add_channel_oil (struct prefix *sg,
return NULL;
}
- c_oil->oil.mfcc_mcastgrp = sg->u.sg.grp;
- c_oil->oil.mfcc_origin = sg->u.sg.src;
+ c_oil->oil.mfcc_mcastgrp = sg->grp;
+ c_oil->oil.mfcc_origin = sg->src;
c_oil->oil.mfcc_parent = input_vif_index;
c_oil->oil_ref_count = 1;
c_oil->installed = 0;
@@ -82,21 +82,21 @@ pim_add_channel_oil (struct prefix *sg,
return c_oil;
}
-static struct channel_oil *pim_find_channel_oil(struct prefix *sg)
+static struct channel_oil *pim_find_channel_oil(struct prefix_sg *sg)
{
struct listnode *node;
struct channel_oil *c_oil;
for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list, node, c_oil)) {
- if ((sg->u.sg.grp.s_addr == c_oil->oil.mfcc_mcastgrp.s_addr) &&
- (sg->u.sg.src.s_addr == c_oil->oil.mfcc_origin.s_addr))
+ if ((sg->grp.s_addr == c_oil->oil.mfcc_mcastgrp.s_addr) &&
+ (sg->src.s_addr == c_oil->oil.mfcc_origin.s_addr))
return c_oil;
}
return 0;
}
-struct channel_oil *pim_channel_oil_add(struct prefix *sg,
+struct channel_oil *pim_channel_oil_add(struct prefix_sg *sg,
int input_vif_index)
{
struct channel_oil *c_oil;
diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h
index fc5188e32..6b55bdc4d 100644
--- a/pimd/pim_oil.h
+++ b/pimd/pim_oil.h
@@ -78,7 +78,7 @@ struct channel_oil {
};
void pim_channel_oil_free(struct channel_oil *c_oil);
-struct channel_oil *pim_channel_oil_add(struct prefix *sg,
+struct channel_oil *pim_channel_oil_add(struct prefix_sg *sg,
int input_vif_index);
void pim_channel_oil_del(struct channel_oil *c_oil);
diff --git a/pimd/pim_register.c b/pimd/pim_register.c
index 456581127..c43818dff 100644
--- a/pimd/pim_register.c
+++ b/pimd/pim_register.c
@@ -67,7 +67,7 @@ pim_check_is_my_ip_address (struct in_addr dest_addr)
}
static void
-pim_register_stop_send (struct interface *ifp, struct prefix *sg,
+pim_register_stop_send (struct interface *ifp, struct prefix_sg *sg,
struct in_addr originator)
{
struct pim_interface *pinfo;
@@ -86,12 +86,12 @@ pim_register_stop_send (struct interface *ifp, struct prefix *sg,
memset (buffer, 0, 3000);
b1 = (uint8_t *)buffer + PIM_MSG_REGISTER_STOP_LEN;
- length = pim_encode_addr_group (b1, AFI_IP, 0, 0, sg->u.sg.grp);
+ length = pim_encode_addr_group (b1, AFI_IP, 0, 0, sg->grp);
b1length += length;
b1 += length;
p.family = AF_INET;
- p.u.prefix4 = sg->u.sg.src;
+ p.u.prefix4 = sg->src;
p.prefixlen = 32;
length = pim_encode_addr_ucast (b1, &p);
b1length += length;
@@ -123,16 +123,16 @@ pim_register_stop_recv (uint8_t *buf, int buf_size)
struct pim_upstream *upstream = NULL;
struct prefix source;
struct prefix group;
- struct prefix sg;
+ struct prefix_sg sg;
int l;
l = pim_parse_addr_group (&group, buf, buf_size);
buf += l;
buf_size -= l;
l = pim_parse_addr_ucast (&source, buf, buf_size);
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source.u.prefix4;
- sg.u.sg.grp = group.u.prefix4;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = source.u.prefix4;
+ sg.grp = group.u.prefix4;
if (PIM_DEBUG_PIM_REG)
{
@@ -260,7 +260,7 @@ pim_register_recv (struct interface *ifp,
{
int sentRegisterStop = 0;
struct ip *ip_hdr;
- struct prefix sg;
+ struct prefix_sg sg;
uint32_t *bits;
if (!pim_check_is_my_ip_address (dest_addr)) {
@@ -310,11 +310,11 @@ pim_register_recv (struct interface *ifp,
*/
#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
- memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = ip_hdr->ip_src;
- sg.u.sg.grp = ip_hdr->ip_dst;
+ memset (&sg, 0, sizeof (struct prefix_sg));
+ sg.src = ip_hdr->ip_src;
+ sg.grp = ip_hdr->ip_dst;
- if (I_am_RP (sg.u.sg.grp) && (dest_addr.s_addr == ((RP (sg.u.sg.grp))->rpf_addr.s_addr))) {
+ if (I_am_RP (sg.grp) && (dest_addr.s_addr == ((RP (sg.grp))->rpf_addr.s_addr))) {
sentRegisterStop = 0;
if (*bits & PIM_REGISTER_BORDER_BIT) {
@@ -342,11 +342,11 @@ pim_register_recv (struct interface *ifp,
{
upstream = pim_upstream_add (&sg, ifp);
- pim_rp_set_upstream_addr (&upstream->upstream_addr, sg.u.sg.src);
+ pim_rp_set_upstream_addr (&upstream->upstream_addr, sg.src);
pim_nexthop_lookup (&upstream->rpf.source_nexthop,
upstream->upstream_addr, NULL);
upstream->rpf.source_nexthop.interface = ifp;
- upstream->sg.u.sg.src = sg.u.sg.src;
+ upstream->sg.src = sg.src;
upstream->rpf.rpf_addr = upstream->rpf.source_nexthop.mrib_nexthop_addr;
pim_upstream_switch (upstream, PIM_UPSTREAM_PRUNE);
diff --git a/pimd/pim_str.c b/pimd/pim_str.c
index f02732426..8e1d7cec2 100644
--- a/pimd/pim_str.c
+++ b/pimd/pim_str.c
@@ -44,14 +44,14 @@ void pim_inet4_dump(const char *onfail, struct in_addr addr, char *buf, int buf_
}
char *
-pim_str_sg_dump (const struct prefix *sg)
+pim_str_sg_dump (const struct prefix_sg *sg)
{
char src_str[100];
char grp_str[100];
static char sg_str[200];
- pim_inet4_dump ("<src?>", sg->u.sg.src, src_str, sizeof(src_str));
- pim_inet4_dump ("<grp?>", sg->u.sg.grp, grp_str, sizeof(grp_str));
+ pim_inet4_dump ("<src?>", sg->src, src_str, sizeof(src_str));
+ pim_inet4_dump ("<grp?>", sg->grp, grp_str, sizeof(grp_str));
snprintf (sg_str, 200, "(%s,%s)", src_str, grp_str);
return sg_str;
}
diff --git a/pimd/pim_str.h b/pimd/pim_str.h
index ca2035250..3dff9fa1e 100644
--- a/pimd/pim_str.h
+++ b/pimd/pim_str.h
@@ -29,6 +29,6 @@
#include <prefix.h>
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);
+char *pim_str_sg_dump (const struct prefix_sg *sg);
#endif
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index a304f359e..3321161c5 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -62,13 +62,13 @@ pim_upstream_remove_children (struct pim_upstream *up)
struct pim_upstream *child;
// Basic sanity, (*,*) not currently supported
- if ((up->sg.u.sg.src.s_addr == INADDR_ANY) &&
- (up->sg.u.sg.grp.s_addr == INADDR_ANY))
+ if ((up->sg.src.s_addr == INADDR_ANY) &&
+ (up->sg.grp.s_addr == INADDR_ANY))
return;
// Basic sanity (S,G) have no children
- if ((up->sg.u.sg.src.s_addr != INADDR_ANY) &&
- (up->sg.u.sg.grp.s_addr != INADDR_ANY))
+ if ((up->sg.src.s_addr != INADDR_ANY) &&
+ (up->sg.grp.s_addr != INADDR_ANY))
return;
for (ALL_LIST_ELEMENTS_RO (qpim_upstream_list, ch_node, child))
@@ -89,18 +89,18 @@ pim_upstream_find_new_children (struct pim_upstream *up)
struct pim_upstream *child;
struct listnode *ch_node;
- if ((up->sg.u.sg.src.s_addr != INADDR_ANY) &&
- (up->sg.u.sg.grp.s_addr != INADDR_ANY))
+ if ((up->sg.src.s_addr != INADDR_ANY) &&
+ (up->sg.grp.s_addr != INADDR_ANY))
return;
- if ((up->sg.u.sg.src.s_addr == INADDR_ANY) &&
- (up->sg.u.sg.grp.s_addr == INADDR_ANY))
+ if ((up->sg.src.s_addr == INADDR_ANY) &&
+ (up->sg.grp.s_addr == INADDR_ANY))
return;
for (ALL_LIST_ELEMENTS_RO (qpim_upstream_list, ch_node, child))
{
- if ((up->sg.u.sg.grp.s_addr != INADDR_ANY) &&
- (child->sg.u.sg.grp.s_addr == up->sg.u.sg.grp.s_addr) &&
+ if ((up->sg.grp.s_addr != INADDR_ANY) &&
+ (child->sg.grp.s_addr == up->sg.grp.s_addr) &&
(child != up))
child->parent = up;
}
@@ -112,27 +112,27 @@ pim_upstream_find_new_children (struct pim_upstream *up)
* If we have a (*,G), find the (*,*)
*/
static struct pim_upstream *
-pim_upstream_find_parent (struct prefix *sg)
+pim_upstream_find_parent (struct prefix_sg *sg)
{
- struct prefix any = *sg;
+ struct prefix_sg any = *sg;
// (*,*) || (S,*)
- if (((sg->u.sg.src.s_addr == INADDR_ANY) &&
- (sg->u.sg.grp.s_addr == INADDR_ANY)) ||
- ((sg->u.sg.src.s_addr != INADDR_ANY) &&
- (sg->u.sg.grp.s_addr == INADDR_ANY)))
+ if (((sg->src.s_addr == INADDR_ANY) &&
+ (sg->grp.s_addr == INADDR_ANY)) ||
+ ((sg->src.s_addr != INADDR_ANY) &&
+ (sg->grp.s_addr == INADDR_ANY)))
return NULL;
// (S,G)
- if ((sg->u.sg.src.s_addr != INADDR_ANY) &&
- (sg->u.sg.grp.s_addr != INADDR_ANY))
+ if ((sg->src.s_addr != INADDR_ANY) &&
+ (sg->grp.s_addr != INADDR_ANY))
{
- any.u.sg.src.s_addr = INADDR_ANY;
+ any.src.s_addr = INADDR_ANY;
return pim_upstream_find (&any);
}
// (*,G)
- any.u.sg.grp.s_addr = INADDR_ANY;
+ any.grp.s_addr = INADDR_ANY;
return pim_upstream_find (&any);
}
@@ -416,7 +416,7 @@ pim_upstream_switch(struct pim_upstream *up,
}
}
-static struct pim_upstream *pim_upstream_new(struct prefix *sg,
+static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
struct interface *incoming)
{
struct pim_upstream *up;
@@ -430,7 +430,7 @@ static struct pim_upstream *pim_upstream_new(struct prefix *sg,
}
up->sg = *sg;
- if (!pim_rp_set_upstream_addr (&up->upstream_addr, sg->u.sg.src))
+ if (!pim_rp_set_upstream_addr (&up->upstream_addr, sg->src))
{
if (PIM_DEBUG_PIM_TRACE)
zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__);
@@ -471,39 +471,39 @@ static struct pim_upstream *pim_upstream_new(struct prefix *sg,
/*
* For a given sg, find any non * source
*/
-struct pim_upstream *pim_upstream_find_non_any (struct prefix *sg)
+struct pim_upstream *pim_upstream_find_non_any (struct prefix_sg *sg)
{
struct listnode *up_node;
- struct prefix any = *sg;
+ struct prefix_sg any = *sg;
struct pim_upstream *up;
- any.u.sg.src.s_addr = INADDR_ANY;
+ any.src.s_addr = INADDR_ANY;
for (ALL_LIST_ELEMENTS_RO (qpim_upstream_list, up_node, up))
{
- if ((any.u.sg.grp.s_addr == up->sg.u.sg.grp.s_addr) &&
- (up->sg.u.sg.src.s_addr != any.u.sg.src.s_addr))
+ if ((any.grp.s_addr == up->sg.grp.s_addr) &&
+ (up->sg.src.s_addr != any.src.s_addr))
return up;
}
return NULL;
}
-struct pim_upstream *pim_upstream_find(struct prefix *sg)
+struct pim_upstream *pim_upstream_find(struct prefix_sg *sg)
{
struct listnode *up_node;
struct pim_upstream *up;
for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list, up_node, up)) {
- if ((sg->u.sg.grp.s_addr == up->sg.u.sg.grp.s_addr) &&
- (sg->u.sg.src.s_addr == up->sg.u.sg.src.s_addr))
+ if ((sg->grp.s_addr == up->sg.grp.s_addr) &&
+ (sg->src.s_addr == up->sg.src.s_addr))
return up;
}
return NULL;
}
-struct pim_upstream *pim_upstream_add(struct prefix *sg,
+struct pim_upstream *pim_upstream_add(struct prefix_sg *sg,
struct interface *incoming)
{
struct pim_upstream *up;
@@ -794,7 +794,7 @@ pim_upstream_keep_alive_timer (struct thread *t)
up = THREAD_ARG(t);
- if (I_am_RP (up->sg.u.sg.grp))
+ if (I_am_RP (up->sg.grp))
{
pim_br_clear_pmbr (&up->sg);
/*
@@ -859,9 +859,9 @@ pim_upstream_keep_alive_timer_start (struct pim_upstream *up,
* received for the source and group.
*/
int
-pim_upstream_switch_to_spt_desired (struct prefix *sg)
+pim_upstream_switch_to_spt_desired (struct prefix_sg *sg)
{
- if (I_am_RP (sg->u.sg.grp))
+ if (I_am_RP (sg->grp))
return 1;
return 0;
@@ -914,13 +914,13 @@ pim_upstream_register_stop_timer (struct thread *t)
up->join_state = PIM_UPSTREAM_JOIN_PENDING;
pim_upstream_start_register_stop_timer (up, 1);
- rpg = RP (up->sg.u.sg.grp);
+ rpg = RP (up->sg.grp);
memset (&ip_hdr, 0, sizeof (struct ip));
ip_hdr.ip_p = PIM_IP_PROTO_PIM;
ip_hdr.ip_hl = 5;
ip_hdr.ip_v = 4;
- ip_hdr.ip_src = up->sg.u.sg.src;
- ip_hdr.ip_dst = up->sg.u.sg.grp;
+ ip_hdr.ip_src = up->sg.src;
+ ip_hdr.ip_dst = up->sg.grp;
ip_hdr.ip_len = 20;
// checksum is broken
pim_register_send ((uint8_t *)&ip_hdr, sizeof (struct ip), rpg, 1);
@@ -990,7 +990,7 @@ pim_upstream_inherited_olist (struct pim_upstream *up)
struct listnode *chnode;
struct listnode *ifnode;
struct interface *ifp;
- struct prefix anysrc;
+ struct prefix_sg anysrc;
int output_intf = 0;
pim_ifp = up->rpf.source_nexthop.interface->info;
@@ -998,7 +998,7 @@ pim_upstream_inherited_olist (struct pim_upstream *up)
if (!up->channel_oil)
up->channel_oil = pim_channel_oil_add (&up->sg, pim_ifp->mroute_vif_index);
anysrc = up->sg;
- anysrc.u.sg.src.s_addr = INADDR_ANY;
+ anysrc.src.s_addr = INADDR_ANY;
anysrc_up = pim_upstream_find (&anysrc);
if (anysrc_up)
diff --git a/pimd/pim_upstream.h b/pimd/pim_upstream.h
index 92535c46b..eea945601 100644
--- a/pimd/pim_upstream.h
+++ b/pimd/pim_upstream.h
@@ -90,7 +90,7 @@ struct pim_upstream {
struct pim_upstream *parent;
int fhr;
struct in_addr upstream_addr;/* Who we are talking to */
- struct prefix sg; /* (S,G) group key */
+ struct prefix_sg sg; /* (S,G) group key */
uint32_t flags;
struct channel_oil *channel_oil;
@@ -122,9 +122,9 @@ struct pim_upstream {
void pim_upstream_free(struct pim_upstream *up);
void pim_upstream_delete(struct pim_upstream *up);
-struct pim_upstream *pim_upstream_find (struct prefix *sg);
-struct pim_upstream *pim_upstream_find_non_any (struct prefix *sg);
-struct pim_upstream *pim_upstream_add (struct prefix *sg,
+struct pim_upstream *pim_upstream_find (struct prefix_sg *sg);
+struct pim_upstream *pim_upstream_find_non_any (struct prefix_sg *sg);
+struct pim_upstream *pim_upstream_add (struct prefix_sg *sg,
struct interface *ifp);
void pim_upstream_del(struct pim_upstream *up);
@@ -147,7 +147,7 @@ void pim_upstream_update_my_assert_metric(struct pim_upstream *up);
void pim_upstream_keep_alive_timer_start (struct pim_upstream *up, uint32_t time);
-int pim_upstream_switch_to_spt_desired (struct prefix *sg);
+int pim_upstream_switch_to_spt_desired (struct prefix_sg *sg);
#define SwitchToSptDesired(sg) pim_upstream_switch_to_spt_desired (sg)
void pim_upstream_start_register_stop_timer (struct pim_upstream *up, int null_register);
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 66550d9cb..b4fb07044 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -948,12 +948,12 @@ static int del_oif(struct channel_oil *channel_oil,
void igmp_source_forward_start(struct igmp_source *source)
{
struct igmp_group *group;
- struct prefix sg;
+ struct prefix_sg sg;
int result;
memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source->source_addr;
- sg.u.sg.grp = source->source_group->group_addr;
+ sg.src = source->source_addr;
+ sg.grp = source->source_group->group_addr;
if (PIM_DEBUG_IGMP_TRACE) {
zlog_debug("%s: (S,G)=%s igmp_sock=%d oif=%s fwd=%d",
@@ -1056,12 +1056,12 @@ void igmp_source_forward_start(struct igmp_source *source)
void igmp_source_forward_stop(struct igmp_source *source)
{
struct igmp_group *group;
- struct prefix sg;
+ struct prefix_sg sg;
int result;
memset (&sg, 0, sizeof (struct prefix));
- sg.u.sg.src = source->source_addr;
- sg.u.sg.grp = source->source_group->group_addr;
+ sg.src = source->source_addr;
+ sg.grp = source->source_group->group_addr;
if (PIM_DEBUG_IGMP_TRACE) {
zlog_debug("%s: (S,G)=%s igmp_sock=%d oif=%s fwd=%d",
@@ -1119,8 +1119,8 @@ void pim_forward_start(struct pim_ifchannel *ch)
char group_str[100];
char upstream_str[100];
- pim_inet4_dump("<source?>", ch->sg.u.sg.src, source_str, sizeof(source_str));
- pim_inet4_dump("<group?>", ch->sg.u.sg.grp, group_str, sizeof(group_str));
+ pim_inet4_dump("<source?>", ch->sg.src, source_str, sizeof(source_str));
+ pim_inet4_dump("<group?>", ch->sg.grp, group_str, sizeof(group_str));
pim_inet4_dump("<upstream?>", up->upstream_addr, upstream_str, sizeof(upstream_str));
zlog_debug("%s: (S,G)=(%s,%s) oif=%s(%s)",
__PRETTY_FUNCTION__,
@@ -1131,7 +1131,7 @@ void pim_forward_start(struct pim_ifchannel *ch)
int input_iface_vif_index = fib_lookup_if_vif_index(up->upstream_addr);
if (input_iface_vif_index < 1) {
char source_str[100];
- pim_inet4_dump("<source?>", up->sg.u.sg.src, source_str, sizeof(source_str));
+ pim_inet4_dump("<source?>", up->sg.src, source_str, sizeof(source_str));
zlog_warn("%s %s: could not find input interface for source %s",
__FILE__, __PRETTY_FUNCTION__,
source_str);