Parsing fixes.
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 6ad521c..03cf3cd 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -288,7 +288,8 @@
uint16_t checksum;
int i;
- group_addr = *(struct in_addr *)(igmp_msg + 4);
+ //group_addr = *(struct in_addr *)(igmp_msg + 4);
+ memcpy(&group_addr, igmp_msg + 4, sizeof(struct in_addr));
ifp = igmp->interface;
pim_ifp = ifp->info;
@@ -421,8 +422,12 @@
/* Scan sources in query and lower their timers to LMQT */
struct in_addr *sources = (struct in_addr *)(igmp_msg + IGMP_V3_SOURCES_OFFSET);
for (i = 0; i < recv_num_sources; ++i) {
- struct in_addr src_addr = sources[i];
- struct igmp_source *src = igmp_find_source_by_addr(group, src_addr);
+ //struct in_addr src_addr = sources[i];
+ //struct igmp_source *src = igmp_find_source_by_addr(group, src_addr);
+ struct in_addr src_addr;
+ struct igmp_source *src;
+ memcpy(&src_addr, sources + i, sizeof(struct in_addr));
+ src = igmp_find_source_by_addr(group, src_addr);
if (src) {
igmp_source_timer_lower_to_lmqt(src);
}
@@ -506,7 +511,8 @@
rec_auxdatalen = group_record[IGMP_V3_GROUP_RECORD_AUXDATALEN_OFFSET];
rec_num_sources = ntohs(* (uint16_t *) (group_record + IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET));
- rec_group = *(struct in_addr *)(group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET);
+ //rec_group = *(struct in_addr *)(group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET);
+ memcpy(&rec_group, group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET, sizeof(struct in_addr));
if (PIM_DEBUG_IGMP_PACKETS) {
zlog_debug("Recv IGMP report v3 from %s on %s: record=%d type=%d auxdatalen=%d sources=%d group=%s",
@@ -599,7 +605,8 @@
__FILE__, __PRETTY_FUNCTION__);
}
- group_addr = *(struct in_addr *)(igmp_msg + 4);
+ //group_addr = *(struct in_addr *)(igmp_msg + 4);
+ memcpy(&group_addr, igmp_msg + 4, sizeof(struct in_addr));
/* non-existant group is created as INCLUDE {empty} */
group = igmp_add_group_by_addr(igmp, group_addr, ifp->name);
@@ -655,7 +662,8 @@
__FILE__, __PRETTY_FUNCTION__);
}
- group_addr = *(struct in_addr *)(igmp_msg + 4);
+ //group_addr = *(struct in_addr *)(igmp_msg + 4);
+ memcpy(&group_addr, igmp_msg + 4, sizeof(struct in_addr));
/* non-existant group is created as INCLUDE {empty} */
group = igmp_add_group_by_addr(igmp, group_addr, ifp->name);
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 5230bb6..9d8e001 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -129,6 +129,11 @@
addr_offset = pim_parse_addr_ucast(ifp->name, src_addr,
&msg_upstream_addr,
buf, pastend - buf);
+#if 0
+ zlog_warn("%s: pim_parse_addr_ucast addr_offset=%d",
+ __PRETTY_FUNCTION__,
+ addr_offset);
+#endif
if (addr_offset < 1) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
@@ -194,6 +199,11 @@
addr_offset = pim_parse_addr_group(ifp->name, src_addr,
&msg_group_addr,
buf, pastend - buf);
+#if 0
+ zlog_warn("%s: pim_parse_addr_group addr_offset=%d",
+ __PRETTY_FUNCTION__,
+ addr_offset);
+#endif
if (addr_offset < 1) {
return -5;
}
@@ -236,6 +246,11 @@
&msg_source_addr,
&msg_source_flags,
buf, pastend - buf);
+#if 0
+ zlog_warn("%s: pim_parse_addr_source addr_offset=%d",
+ __PRETTY_FUNCTION__,
+ addr_offset);
+#endif
if (addr_offset < 1) {
return -7;
}
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 962c2b8..95ee5ab 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -450,7 +450,7 @@
family = *addr++;
type = *addr++;
- ++addr;
+ //++addr;
++addr; /* skip b_reserved_z fields */
mask_len = *addr++;
@@ -533,9 +533,10 @@
if (type) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: unknown source address encoding type=%d from %s on %s",
+ zlog_warn("%s: unknown source address encoding type=%d from %s on %s: %02x%02x%02x%02x%02x%02x%02x%02x",
__PRETTY_FUNCTION__,
- type, src_str, ifname);
+ type, src_str, ifname,
+ buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
return -2;
}
@@ -578,9 +579,10 @@
{
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: unknown source address encoding family=%d from %s on %s",
+ zlog_warn("%s: unknown source address encoding family=%d from %s on %s: %02x%02x%02x%02x%02x%02x%02x%02x",
__PRETTY_FUNCTION__,
- family, src_str, ifname);
+ family, src_str, ifname,
+ buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
return -5;
}
}