summaryrefslogtreecommitdiffstats
path: root/pimd/pim_tlv.c
diff options
context:
space:
mode:
authorEverton Marques <everton.marques@gmail.com>2009-08-12 10:52:22 -0300
committerEverton Marques <everton.marques@gmail.com>2009-10-02 10:44:31 -0300
commit638f9840dc9650777a6d1902bf44a37aa318bd87 (patch)
tree769967dbf5e4fa3eaf05880b35e94e8043a43ba6 /pimd/pim_tlv.c
parent834200830bd0a27c09465b6e23941364a149b9a3 (diff)
downloadquagga-638f9840dc9650777a6d1902bf44a37aa318bd87.tar.bz2
quagga-638f9840dc9650777a6d1902bf44a37aa318bd87.tar.xz
[pim] Move encoded source address length check to pim_parse_addr_source
Diffstat (limited to 'pimd/pim_tlv.c')
-rw-r--r--pimd/pim_tlv.c20
1 files changed, 19 insertions, 1 deletions
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;
}
}