| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux NET3: Internet Group Management Protocol [IGMP] |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 |
|---|
| 8 | | - * |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License |
|---|
| 12 | | - * as published by the Free Software Foundation; either version |
|---|
| 13 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 14 | 9 | */ |
|---|
| 15 | 10 | #ifndef _LINUX_IGMP_H |
|---|
| 16 | 11 | #define _LINUX_IGMP_H |
|---|
| .. | .. |
|---|
| 18 | 13 | #include <linux/skbuff.h> |
|---|
| 19 | 14 | #include <linux/timer.h> |
|---|
| 20 | 15 | #include <linux/in.h> |
|---|
| 16 | +#include <linux/ip.h> |
|---|
| 21 | 17 | #include <linux/refcount.h> |
|---|
| 22 | 18 | #include <uapi/linux/igmp.h> |
|---|
| 23 | 19 | |
|---|
| .. | .. |
|---|
| 42 | 38 | unsigned int sl_max; |
|---|
| 43 | 39 | unsigned int sl_count; |
|---|
| 44 | 40 | struct rcu_head rcu; |
|---|
| 45 | | - __be32 sl_addr[0]; |
|---|
| 41 | + __be32 sl_addr[]; |
|---|
| 46 | 42 | }; |
|---|
| 47 | 43 | |
|---|
| 48 | 44 | #define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \ |
|---|
| .. | .. |
|---|
| 64 | 60 | |
|---|
| 65 | 61 | struct ip_sf_list { |
|---|
| 66 | 62 | struct ip_sf_list *sf_next; |
|---|
| 67 | | - __be32 sf_inaddr; |
|---|
| 68 | 63 | unsigned long sf_count[2]; /* include/exclude counts */ |
|---|
| 64 | + __be32 sf_inaddr; |
|---|
| 69 | 65 | unsigned char sf_gsresp; /* include in g & s response? */ |
|---|
| 70 | 66 | unsigned char sf_oldin; /* change state */ |
|---|
| 71 | 67 | unsigned char sf_crcount; /* retrans. left to send */ |
|---|
| .. | .. |
|---|
| 106 | 102 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) |
|---|
| 107 | 103 | #define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) |
|---|
| 108 | 104 | |
|---|
| 105 | +static inline int ip_mc_may_pull(struct sk_buff *skb, unsigned int len) |
|---|
| 106 | +{ |
|---|
| 107 | + if (skb_transport_offset(skb) + ip_transport_len(skb) < len) |
|---|
| 108 | + return 0; |
|---|
| 109 | + |
|---|
| 110 | + return pskb_may_pull(skb, len); |
|---|
| 111 | +} |
|---|
| 112 | + |
|---|
| 109 | 113 | extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u8 proto); |
|---|
| 110 | 114 | extern int igmp_rcv(struct sk_buff *); |
|---|
| 111 | 115 | extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); |
|---|
| .. | .. |
|---|
| 119 | 123 | extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, |
|---|
| 120 | 124 | struct ip_msfilter __user *optval, int __user *optlen); |
|---|
| 121 | 125 | extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, |
|---|
| 122 | | - struct group_filter __user *optval, int __user *optlen); |
|---|
| 126 | + struct sockaddr_storage __user *p); |
|---|
| 123 | 127 | extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, |
|---|
| 124 | 128 | int dif, int sdif); |
|---|
| 125 | 129 | extern void ip_mc_init_dev(struct in_device *); |
|---|
| .. | .. |
|---|
| 128 | 132 | extern void ip_mc_down(struct in_device *); |
|---|
| 129 | 133 | extern void ip_mc_unmap(struct in_device *); |
|---|
| 130 | 134 | extern void ip_mc_remap(struct in_device *); |
|---|
| 131 | | -extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); |
|---|
| 135 | +extern void __ip_mc_dec_group(struct in_device *in_dev, __be32 addr, gfp_t gfp); |
|---|
| 136 | +static inline void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) |
|---|
| 137 | +{ |
|---|
| 138 | + return __ip_mc_dec_group(in_dev, addr, GFP_KERNEL); |
|---|
| 139 | +} |
|---|
| 140 | +extern void __ip_mc_inc_group(struct in_device *in_dev, __be32 addr, |
|---|
| 141 | + gfp_t gfp); |
|---|
| 132 | 142 | extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); |
|---|
| 133 | | -int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed); |
|---|
| 143 | +int ip_mc_check_igmp(struct sk_buff *skb); |
|---|
| 134 | 144 | |
|---|
| 135 | 145 | #endif |
|---|