diff options
author | Everton Marques <everton.marques@gmail.com> | 2014-02-13 19:50:30 -0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-02-04 06:07:55 +0100 |
commit | d4595869045498d830be34403217822f77446ae0 (patch) | |
tree | 7b8278dd176415ae90e00afdabf49706a92a1977 | |
parent | 3defeb3465a1f6e7a50d0f2b3d292686bb1449b1 (diff) | |
download | quagga-d4595869045498d830be34403217822f77446ae0.tar.bz2 quagga-d4595869045498d830be34403217822f77446ae0.tar.xz |
Parsing fixes.
-rw-r--r-- | pimd/pim_igmp.c | 20 | ||||
-rw-r--r-- | pimd/pim_join.c | 15 | ||||
-rw-r--r-- | pimd/pim_tlv.c | 12 |
3 files changed, 36 insertions, 11 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 6ad521ca..03cf3cd1 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -288,7 +288,8 @@ static int recv_igmp_query(struct igmp_sock *igmp, int query_version, 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 @@ static int recv_igmp_query(struct igmp_sock *igmp, int query_version, /* 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 @@ static int igmp_v3_report(struct igmp_sock *igmp, 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 @@ static int igmp_v2_report(struct igmp_sock *igmp, __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 @@ static int igmp_v1_report(struct igmp_sock *igmp, __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 5230bb6c..9d8e0012 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -129,6 +129,11 @@ int pim_joinprune_recv(struct interface *ifp, 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 @@ int pim_joinprune_recv(struct interface *ifp, 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 @@ int pim_joinprune_recv(struct interface *ifp, &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 962c2b87..95ee5ab0 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -450,7 +450,7 @@ int pim_parse_addr_group(const char *ifname, struct in_addr src_addr, family = *addr++; type = *addr++; - ++addr; + //++addr; ++addr; /* skip b_reserved_z fields */ mask_len = *addr++; @@ -533,9 +533,10 @@ int pim_parse_addr_source(const char *ifname, 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 @@ int pim_parse_addr_source(const char *ifname, { 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; } } |