aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-08-20 06:22:02 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-21 02:52:02 -0400
commit9fd0784164047583fa856c9a5aeda1d6c6fb0399 (patch)
tree7abd08ebf9844426176ab957c6cd0d75feee8d4d /net/ipv6
parentc2cef4e88808cc566956605a39a96080912c0566 (diff)
net: ipv6: mcast: minor: use defines for rfc3810/8.1 lengths
Instead of hard-coding length values, use a define to make it clear where those lengths come from. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/mcast.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 33f98d9ac376..98ead2b1a669 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -107,9 +107,12 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
107static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml, 107static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
108 struct inet6_dev *idev); 108 struct inet6_dev *idev);
109 109
110
111#define MLD_QRV_DEFAULT 2 110#define MLD_QRV_DEFAULT 2
112 111
112/* RFC3810, 8.1 Query Version Distinctions */
113#define MLD_V1_QUERY_LEN 24
114#define MLD_V2_QUERY_LEN_MIN 28
115
113#define MLD_V1_SEEN(idev) (dev_net((idev)->dev)->ipv6.devconf_all->force_mld_version == 1 || \ 116#define MLD_V1_SEEN(idev) (dev_net((idev)->dev)->ipv6.devconf_all->force_mld_version == 1 || \
114 (idev)->cnf.force_mld_version == 1 || \ 117 (idev)->cnf.force_mld_version == 1 || \
115 ((idev)->mc_v1_seen && \ 118 ((idev)->mc_v1_seen && \
@@ -1146,7 +1149,7 @@ int igmp6_event_query(struct sk_buff *skb)
1146 !(group_type&IPV6_ADDR_MULTICAST)) 1149 !(group_type&IPV6_ADDR_MULTICAST))
1147 return -EINVAL; 1150 return -EINVAL;
1148 1151
1149 if (len == 24) { 1152 if (len == MLD_V1_QUERY_LEN) {
1150 int switchback; 1153 int switchback;
1151 /* MLDv1 router present */ 1154 /* MLDv1 router present */
1152 1155
@@ -1160,7 +1163,7 @@ int igmp6_event_query(struct sk_buff *skb)
1160 __in6_dev_put(idev); 1163 __in6_dev_put(idev);
1161 /* clear deleted report items */ 1164 /* clear deleted report items */
1162 mld_clear_delrec(idev); 1165 mld_clear_delrec(idev);
1163 } else if (len >= 28) { 1166 } else if (len >= MLD_V2_QUERY_LEN_MIN) {
1164 int srcs_offset = sizeof(struct mld2_query) - 1167 int srcs_offset = sizeof(struct mld2_query) -
1165 sizeof(struct icmp6hdr); 1168 sizeof(struct icmp6hdr);
1166 if (!pskb_may_pull(skb, srcs_offset)) 1169 if (!pskb_may_pull(skb, srcs_offset))