diff options
author | Everton Marques <everton.marques@gmail.com> | 2009-08-12 10:52:22 -0300 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2015-02-04 06:07:50 +0100 |
commit | d12beab1b9ce09c50672adb3c980e64ccd11edb4 (patch) | |
tree | b22f8a83ea98c416efc5b6d76d013d21a1d706d5 | |
parent | 236b01556122fba479118797163c44849073ff46 (diff) | |
download | quagga-d12beab1b9ce09c50672adb3c980e64ccd11edb4.tar.bz2 quagga-d12beab1b9ce09c50672adb3c980e64ccd11edb4.tar.xz |
[pim] Move encoded source address length check to pim_parse_addr_source
-rw-r--r-- | pimd/pim_igmp.c | 2 | ||||
-rw-r--r-- | pimd/pim_join.c | 24 | ||||
-rw-r--r-- | pimd/pim_tlv.c | 20 |
3 files changed, 20 insertions, 26 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index b8f25814..82db37f6 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -392,7 +392,7 @@ static int recv_igmp_query(struct igmp_sock *igmp, int query_version, /* this is a general query */ /* log that general query should have the s_flag set */ - zlog_warn("General IGMP query v%d from %s on %s: Router-Side Processing flag is clear", + zlog_warn("General IGMP query v%d from %s on %s: Suppress Router-Side Processing flag is clear", query_version, from_str, ifp->name); } else { diff --git a/pimd/pim_join.c b/pimd/pim_join.c index 6b46759a..aa3aa789 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -240,18 +240,6 @@ int pim_joinprune_recv(struct interface *ifp, return -7; } - /* - RFC 4601: 4.9.1 Encoded Source and Group Address Formats - - Encoded-Source Address - (...) - The mask length MUST be equal to the mask length in bits for the - given Address Family and Encoding Type (32 for IPv4 native and - 128 for IPv6 native). A router SHOULD ignore any messages - received with any other mask length. - */ - if (msg_source_addr.prefixlen!=32) return; - buf += addr_offset; recv_join(ifp, neigh, msg_holdtime, @@ -271,18 +259,6 @@ int pim_joinprune_recv(struct interface *ifp, return -8; } - /* - RFC 4601: 4.9.1 Encoded Source and Group Address Formats - - Encoded-Source Address - (...) - The mask length MUST be equal to the mask length in bits for the - given Address Family and Encoding Type (32 for IPv4 native and - 128 for IPv6 native). A router SHOULD ignore any messages - received with any other mask length. - */ - if (msg_source_addr.prefixlen!=32) return; - buf += addr_offset; recv_prune(ifp, neigh, msg_holdtime, diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index c578a70d..fc48c888 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -559,6 +559,24 @@ int pim_parse_addr_source(const char *ifname, p->u.prefix4 = *(const struct in_addr *) addr; p->prefixlen = mask_len; + /* + RFC 4601: 4.9.1 Encoded Source and Group Address Formats + + Encoded-Source Address + + The mask length MUST be equal to the mask length in bits for + the given Address Family and Encoding Type (32 for IPv4 native + and 128 for IPv6 native). A router SHOULD ignore any messages + received with any other mask length. + */ + if (p->prefixlen != 32) { + char src_str[100]; + pim_inet4_dump("<src?>", p->u.prefix4, src_str, sizeof(src_str)); + zlog_warn("%s: IPv4 bad source address mask: %s/%d", + __PRETTY_FUNCTION__, src_str, p->prefixlen); + return -4; + } + addr += sizeof(struct in_addr); break; @@ -569,7 +587,7 @@ int pim_parse_addr_source(const char *ifname, zlog_warn("%s: unknown source address encoding family=%d from %s on %s", __PRETTY_FUNCTION__, family, src_str, ifname); - return -4; + return -5; } } |