aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/mcast.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/mcast.c')
-rw-r--r--net/ipv6/mcast.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 882cde4b4047..a8d6625ec782 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1,13 +1,13 @@
1/* 1/*
2 * Multicast support for IPv6 2 * Multicast support for IPv6
3 * Linux INET6 implementation 3 * Linux INET6 implementation
4 * 4 *
5 * Authors: 5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt> 6 * Pedro Roque <roque@di.fc.ul.pt>
7 * 7 *
8 * $Id: mcast.c,v 1.40 2002/02/08 03:57:19 davem Exp $ 8 * $Id: mcast.c,v 1.40 2002/02/08 03:57:19 davem Exp $
9 * 9 *
10 * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c 10 * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -644,7 +644,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
644 memset(&ss, 0, sizeof(ss)); 644 memset(&ss, 0, sizeof(ss));
645 psin6->sin6_family = AF_INET6; 645 psin6->sin6_family = AF_INET6;
646 psin6->sin6_addr = psl->sl_addr[i]; 646 psin6->sin6_addr = psl->sl_addr[i];
647 if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss))) 647 if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss)))
648 return -EFAULT; 648 return -EFAULT;
649 } 649 }
650 return 0; 650 return 0;
@@ -1168,7 +1168,7 @@ int igmp6_event_query(struct sk_buff *skb)
1168 1168
1169 /* compute payload length excluding extension headers */ 1169 /* compute payload length excluding extension headers */
1170 len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); 1170 len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
1171 len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; 1171 len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h;
1172 1172
1173 /* Drop queries with not link local source */ 1173 /* Drop queries with not link local source */
1174 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL)) 1174 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL))
@@ -1206,7 +1206,7 @@ int igmp6_event_query(struct sk_buff *skb)
1206 /* clear deleted report items */ 1206 /* clear deleted report items */
1207 mld_clear_delrec(idev); 1207 mld_clear_delrec(idev);
1208 } else if (len >= 28) { 1208 } else if (len >= 28) {
1209 int srcs_offset = sizeof(struct mld2_query) - 1209 int srcs_offset = sizeof(struct mld2_query) -
1210 sizeof(struct icmp6hdr); 1210 sizeof(struct icmp6hdr);
1211 if (!pskb_may_pull(skb, srcs_offset)) { 1211 if (!pskb_may_pull(skb, srcs_offset)) {
1212 in6_dev_put(idev); 1212 in6_dev_put(idev);
@@ -1230,7 +1230,7 @@ int igmp6_event_query(struct sk_buff *skb)
1230 } 1230 }
1231 /* mark sources to include, if group & source-specific */ 1231 /* mark sources to include, if group & source-specific */
1232 if (mlh2->nsrcs != 0) { 1232 if (mlh2->nsrcs != 0) {
1233 if (!pskb_may_pull(skb, srcs_offset + 1233 if (!pskb_may_pull(skb, srcs_offset +
1234 ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) { 1234 ntohs(mlh2->nsrcs) * sizeof(struct in6_addr))) {
1235 in6_dev_put(idev); 1235 in6_dev_put(idev);
1236 return -EINVAL; 1236 return -EINVAL;
@@ -1304,7 +1304,7 @@ int igmp6_event_report(struct sk_buff *skb)
1304 1304
1305 /* Drop reports with not link local source */ 1305 /* Drop reports with not link local source */
1306 addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr); 1306 addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr);
1307 if (addr_type != IPV6_ADDR_ANY && 1307 if (addr_type != IPV6_ADDR_ANY &&
1308 !(addr_type&IPV6_ADDR_LINKLOCAL)) 1308 !(addr_type&IPV6_ADDR_LINKLOCAL))
1309 return -EINVAL; 1309 return -EINVAL;
1310 1310
@@ -1413,7 +1413,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
1413 1413
1414 if (ipv6_get_lladdr(dev, &addr_buf)) { 1414 if (ipv6_get_lladdr(dev, &addr_buf)) {
1415 /* <draft-ietf-magma-mld-source-05.txt>: 1415 /* <draft-ietf-magma-mld-source-05.txt>:
1416 * use unspecified address as the source address 1416 * use unspecified address as the source address
1417 * when a valid link-local address is not available. 1417 * when a valid link-local address is not available.
1418 */ 1418 */
1419 memset(&addr_buf, 0, sizeof(addr_buf)); 1419 memset(&addr_buf, 0, sizeof(addr_buf));
@@ -1454,7 +1454,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
1454static inline int mld_dev_queue_xmit(struct sk_buff *skb) 1454static inline int mld_dev_queue_xmit(struct sk_buff *skb)
1455{ 1455{
1456 return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev, 1456 return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb, NULL, skb->dev,
1457 mld_dev_queue_xmit2); 1457 mld_dev_queue_xmit2);
1458} 1458}
1459 1459
1460static void mld_sendpack(struct sk_buff *skb) 1460static void mld_sendpack(struct sk_buff *skb)
@@ -1582,6 +1582,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
1582 skb = add_grhead(skb, pmc, type, &pgr); 1582 skb = add_grhead(skb, pmc, type, &pgr);
1583 first = 0; 1583 first = 0;
1584 } 1584 }
1585 if (!skb)
1586 return NULL;
1585 psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc)); 1587 psrc = (struct in6_addr *)skb_put(skb, sizeof(*psrc));
1586 *psrc = psf->sf_addr; 1588 *psrc = psf->sf_addr;
1587 scount++; stotal++; 1589 scount++; stotal++;
@@ -1752,8 +1754,8 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1752{ 1754{
1753 struct sock *sk = igmp6_socket->sk; 1755 struct sock *sk = igmp6_socket->sk;
1754 struct inet6_dev *idev; 1756 struct inet6_dev *idev;
1755 struct sk_buff *skb; 1757 struct sk_buff *skb;
1756 struct icmp6hdr *hdr; 1758 struct icmp6hdr *hdr;
1757 struct in6_addr *snd_addr; 1759 struct in6_addr *snd_addr;
1758 struct in6_addr *addrp; 1760 struct in6_addr *addrp;
1759 struct in6_addr addr_buf; 1761 struct in6_addr addr_buf;
@@ -1791,7 +1793,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1791 1793
1792 if (ipv6_get_lladdr(dev, &addr_buf)) { 1794 if (ipv6_get_lladdr(dev, &addr_buf)) {
1793 /* <draft-ietf-magma-mld-source-05.txt>: 1795 /* <draft-ietf-magma-mld-source-05.txt>:
1794 * use unspecified address as the source address 1796 * use unspecified address as the source address
1795 * when a valid link-local address is not available. 1797 * when a valid link-local address is not available.
1796 */ 1798 */
1797 memset(&addr_buf, 0, sizeof(addr_buf)); 1799 memset(&addr_buf, 0, sizeof(addr_buf));
@@ -2328,7 +2330,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq)
2328 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2330 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2329 2331
2330 for (state->dev = dev_base, state->idev = NULL; 2332 for (state->dev = dev_base, state->idev = NULL;
2331 state->dev; 2333 state->dev;
2332 state->dev = state->dev->next) { 2334 state->dev = state->dev->next) {
2333 struct inet6_dev *idev; 2335 struct inet6_dev *idev;
2334 idev = in6_dev_get(state->dev); 2336 idev = in6_dev_get(state->dev);
@@ -2411,7 +2413,7 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
2411 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2413 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2412 2414
2413 seq_printf(seq, 2415 seq_printf(seq,
2414 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", 2416 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n",
2415 state->dev->ifindex, state->dev->name, 2417 state->dev->ifindex, state->dev->name,
2416 NIP6(im->mca_addr), 2418 NIP6(im->mca_addr),
2417 im->mca_users, im->mca_flags, 2419 im->mca_users, im->mca_flags,
@@ -2449,7 +2451,7 @@ out_kfree:
2449 goto out; 2451 goto out;
2450} 2452}
2451 2453
2452static struct file_operations igmp6_mc_seq_fops = { 2454static const struct file_operations igmp6_mc_seq_fops = {
2453 .owner = THIS_MODULE, 2455 .owner = THIS_MODULE,
2454 .open = igmp6_mc_seq_open, 2456 .open = igmp6_mc_seq_open,
2455 .read = seq_read, 2457 .read = seq_read,
@@ -2472,7 +2474,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq)
2472 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2474 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2473 2475
2474 for (state->dev = dev_base, state->idev = NULL, state->im = NULL; 2476 for (state->dev = dev_base, state->idev = NULL, state->im = NULL;
2475 state->dev; 2477 state->dev;
2476 state->dev = state->dev->next) { 2478 state->dev = state->dev->next) {
2477 struct inet6_dev *idev; 2479 struct inet6_dev *idev;
2478 idev = in6_dev_get(state->dev); 2480 idev = in6_dev_get(state->dev);
@@ -2577,7 +2579,7 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
2577 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); 2579 struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
2578 2580
2579 if (v == SEQ_START_TOKEN) { 2581 if (v == SEQ_START_TOKEN) {
2580 seq_printf(seq, 2582 seq_printf(seq,
2581 "%3s %6s " 2583 "%3s %6s "
2582 "%32s %32s %6s %6s\n", "Idx", 2584 "%32s %32s %6s %6s\n", "Idx",
2583 "Device", "Multicast Address", 2585 "Device", "Multicast Address",
@@ -2606,7 +2608,7 @@ static int igmp6_mcf_seq_open(struct inode *inode, struct file *file)
2606 struct seq_file *seq; 2608 struct seq_file *seq;
2607 int rc = -ENOMEM; 2609 int rc = -ENOMEM;
2608 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); 2610 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2609 2611
2610 if (!s) 2612 if (!s)
2611 goto out; 2613 goto out;
2612 2614
@@ -2623,7 +2625,7 @@ out_kfree:
2623 goto out; 2625 goto out;
2624} 2626}
2625 2627
2626static struct file_operations igmp6_mcf_seq_fops = { 2628static const struct file_operations igmp6_mcf_seq_fops = {
2627 .owner = THIS_MODULE, 2629 .owner = THIS_MODULE,
2628 .open = igmp6_mcf_seq_open, 2630 .open = igmp6_mcf_seq_open,
2629 .read = seq_read, 2631 .read = seq_read,