diff options
author | David Stevens <dlstevens@us.ibm.com> | 2010-09-30 10:29:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-04 00:58:47 -0400 |
commit | 5b7c84066733c5dfb0e4016d939757b38de189e4 (patch) | |
tree | fe7edf2d6327abfc1c4abdab5121e73cce52b693 | |
parent | 10ccff62bd3de7a64cf98f4c37ec0414b8affd4f (diff) |
ipv4: correct IGMP behavior on v3 query during v2-compatibility mode
A recent patch to allow IGMPv2 responses to IGMPv3 queries
bypasses length checks for valid query lengths, incorrectly
resets the v2_seen timer, and does not support IGMPv1.
The following patch responds with a v2 report as required
by IGMPv2 while correcting the other problems introduced
by the patch.
Signed-Off-By: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/igmp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 1fdcacd36ce7..2a4bb76f2132 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -834,7 +834,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
834 | int mark = 0; | 834 | int mark = 0; |
835 | 835 | ||
836 | 836 | ||
837 | if (len == 8 || IGMP_V2_SEEN(in_dev)) { | 837 | if (len == 8) { |
838 | if (ih->code == 0) { | 838 | if (ih->code == 0) { |
839 | /* Alas, old v1 router presents here. */ | 839 | /* Alas, old v1 router presents here. */ |
840 | 840 | ||
@@ -856,6 +856,18 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
856 | igmpv3_clear_delrec(in_dev); | 856 | igmpv3_clear_delrec(in_dev); |
857 | } else if (len < 12) { | 857 | } else if (len < 12) { |
858 | return; /* ignore bogus packet; freed by caller */ | 858 | return; /* ignore bogus packet; freed by caller */ |
859 | } else if (IGMP_V1_SEEN(in_dev)) { | ||
860 | /* This is a v3 query with v1 queriers present */ | ||
861 | max_delay = IGMP_Query_Response_Interval; | ||
862 | group = 0; | ||
863 | } else if (IGMP_V2_SEEN(in_dev)) { | ||
864 | /* this is a v3 query with v2 queriers present; | ||
865 | * Interpretation of the max_delay code is problematic here. | ||
866 | * A real v2 host would use ih_code directly, while v3 has a | ||
867 | * different encoding. We use the v3 encoding as more likely | ||
868 | * to be intended in a v3 query. | ||
869 | */ | ||
870 | max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE); | ||
859 | } else { /* v3 */ | 871 | } else { /* v3 */ |
860 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) | 872 | if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) |
861 | return; | 873 | return; |