summaryrefslogtreecommitdiffstats
path: root/pimd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-01-05 16:07:17 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-01-17 14:09:01 +0100
commitbca160c6af499365a946d5b86f9cc71cbc948869 (patch)
tree314598940e42dfd3357fc95d30a7a726792f14aa /pimd
parentpimd: deploy pim_sgaddr_* helpers (diff)
downloadfrr-bca160c6af499365a946d5b86f9cc71cbc948869.tar.xz
frr-bca160c6af499365a946d5b86f9cc71cbc948869.zip
pimd: add PIMADDR_ANY & tackle assignments
Need a separate constant that is IPv6 when needed. Also assign the whole struct rather than just s_addr. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd')
-rw-r--r--pimd/pim_addr.h5
-rw-r--r--pimd/pim_ifchannel.c2
-rw-r--r--pimd/pim_igmp_mtrace.c2
-rw-r--r--pimd/pim_join.c4
-rw-r--r--pimd/pim_jp_agg.c4
-rw-r--r--pimd/pim_mroute.c6
-rw-r--r--pimd/pim_upstream.c2
7 files changed, 15 insertions, 10 deletions
diff --git a/pimd/pim_addr.h b/pimd/pim_addr.h
index 657bea39e..c7b37b02c 100644
--- a/pimd/pim_addr.h
+++ b/pimd/pim_addr.h
@@ -34,6 +34,11 @@ typedef struct in6_addr pim_addr;
#define PIM_ADDRSTRLEN INET6_ADDRSTRLEN
#endif
+/* for assignment/initialization (C99 compound literal)
+ * named PIMADDR_ANY (not PIM_ADDR_ANY) to match INADDR_ANY
+ */
+#define PIMADDR_ANY (pim_addr){ }
+
static inline bool pim_addr_is_any(pim_addr addr)
{
pim_addr zero = {};
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 5b650e6e3..8a641a25f 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -514,7 +514,7 @@ static struct pim_ifchannel *pim_ifchannel_find_parent(struct pim_ifchannel *ch)
// (S,G)
if (!pim_addr_is_any(parent_sg.src) &&
!pim_addr_is_any(parent_sg.grp)) {
- parent_sg.src.s_addr = INADDR_ANY;
+ parent_sg.src = PIMADDR_ANY;
parent = pim_ifchannel_find(ch->interface, &parent_sg);
if (parent)
diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c
index c11f2b35d..d8210168e 100644
--- a/pimd/pim_igmp_mtrace.c
+++ b/pimd/pim_igmp_mtrace.c
@@ -119,7 +119,7 @@ static bool mtrace_fwd_info(struct pim_instance *pim,
up = pim_upstream_find(pim, &sg);
if (!up) {
- sg.src.s_addr = INADDR_ANY;
+ sg.src = PIMADDR_ANY;
up = pim_upstream_find(pim, &sg);
}
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 6569e832f..d77d2e996 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -114,7 +114,7 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh,
return;
}
- sg->src.s_addr = INADDR_ANY;
+ sg->src = PIMADDR_ANY;
}
/* Restart join expiry timer */
@@ -163,7 +163,7 @@ static void recv_prune(struct interface *ifp, struct pim_neighbor *neigh,
__func__, received_rp, sg);
}
- sg->src.s_addr = INADDR_ANY;
+ sg->src = PIMADDR_ANY;
}
pim_ifchannel_prune(ifp, upstream, sg, source_flags, holdtime);
diff --git a/pimd/pim_jp_agg.c b/pimd/pim_jp_agg.c
index 290655d12..feeef15f8 100644
--- a/pimd/pim_jp_agg.c
+++ b/pimd/pim_jp_agg.c
@@ -277,7 +277,7 @@ void pim_jp_agg_add_group(struct list *group, struct pim_upstream *up,
if (!jag) {
jag = XCALLOC(MTYPE_PIM_JP_AGG_GROUP,
sizeof(struct pim_jp_agg_group));
- jag->group.s_addr = up->sg.grp.s_addr;
+ jag->group = up->sg.grp;
jag->sources = list_new();
jag->sources->cmp = pim_jp_agg_src_cmp;
jag->sources->del = (void (*)(void *))pim_jp_agg_src_free;
@@ -372,7 +372,7 @@ void pim_jp_agg_single_upstream_send(struct pim_rpf *rpf,
listnode_add(&groups, &jag);
listnode_add(jag.sources, &js);
- jag.group.s_addr = up->sg.grp.s_addr;
+ jag.group = up->sg.grp;
js.up = up;
js.is_join = is_join;
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 1859ac1a2..91b997f44 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -257,7 +257,7 @@ static int pim_mroute_msg_wholepkt(int fd, struct interface *ifp,
up = pim_upstream_find(pim_ifp->pim, &sg);
if (!up) {
pim_sgaddr star = sg;
- star.src.s_addr = INADDR_ANY;
+ star.src = PIMADDR_ANY;
up = pim_upstream_find(pim_ifp->pim, &star);
@@ -377,7 +377,7 @@ static int pim_mroute_msg_wrongvif(int fd, struct interface *ifp,
zlog_debug("%s: WRONGVIF (S,G)=%pSG could not find channel on interface %s",
__func__, &sg, ifp->name);
- star_g.src.s_addr = INADDR_ANY;
+ star_g.src = PIMADDR_ANY;
ch = pim_ifchannel_find(ifp, &star_g);
if (!ch) {
if (PIM_DEBUG_MROUTE)
@@ -459,7 +459,7 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
}
star_g = sg;
- star_g.src.s_addr = INADDR_ANY;
+ star_g.src = PIMADDR_ANY;
pim = pim_ifp->pim;
/*
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 400714237..800ec9c45 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -134,7 +134,7 @@ static struct pim_upstream *pim_upstream_find_parent(struct pim_instance *pim,
// (S,G)
if (!pim_addr_is_any(child->sg.src) &&
!pim_addr_is_any(child->sg.grp)) {
- any.src.s_addr = INADDR_ANY;
+ any.src = PIMADDR_ANY;
up = pim_upstream_find(pim, &any);
if (up)