]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/igmp.h
cfg80211/mac80211: make ieee80211_send_layer2_update a public function
[mirror_ubuntu-bionic-kernel.git] / include / linux / igmp.h
CommitLineData
1da177e4
LT
1/*
2 * Linux NET3: Internet Group Management Protocol [IGMP]
3 *
4 * Authors:
113aa838 5 * Alan Cox <alan@lxorguk.ukuu.org.uk>
1da177e4
LT
6 *
7 * 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 */
1da177e4
LT
15#ifndef _LINUX_IGMP_H
16#define _LINUX_IGMP_H
17
1da177e4 18#include <linux/skbuff.h>
d7fe0f24 19#include <linux/timer.h>
1da177e4 20#include <linux/in.h>
8851ab52 21#include <linux/refcount.h>
607ca46e 22#include <uapi/linux/igmp.h>
1da177e4 23
cc32e054
JP
24static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
25{
26 return (struct igmphdr *)skb_transport_header(skb);
27}
28
29static inline struct igmpv3_report *
30 igmpv3_report_hdr(const struct sk_buff *skb)
31{
32 return (struct igmpv3_report *)skb_transport_header(skb);
33}
34
35static inline struct igmpv3_query *
36 igmpv3_query_hdr(const struct sk_buff *skb)
37{
38 return (struct igmpv3_query *)skb_transport_header(skb);
39}
40
d94d9fee 41struct ip_sf_socklist {
1da177e4
LT
42 unsigned int sl_max;
43 unsigned int sl_count;
c85bb41e 44 struct rcu_head rcu;
ea4d9e72 45 __be32 sl_addr[0];
1da177e4
LT
46};
47
48#define IP_SFLSIZE(count) (sizeof(struct ip_sf_socklist) + \
63007727 49 (count) * sizeof(__be32))
1da177e4
LT
50
51#define IP_SFBLOCK 10 /* allocate this many at once */
52
53/* ip_mc_socklist is real list now. Speed is not argument;
54 this list never used in fast path code
55 */
56
d94d9fee 57struct ip_mc_socklist {
1d7138de 58 struct ip_mc_socklist __rcu *next_rcu;
1da177e4
LT
59 struct ip_mreqn multi;
60 unsigned int sfmode; /* MCAST_{INCLUDE,EXCLUDE} */
1d7138de 61 struct ip_sf_socklist __rcu *sflist;
c85bb41e 62 struct rcu_head rcu;
1da177e4
LT
63};
64
d94d9fee 65struct ip_sf_list {
1da177e4 66 struct ip_sf_list *sf_next;
ea4d9e72 67 __be32 sf_inaddr;
1da177e4
LT
68 unsigned long sf_count[2]; /* include/exclude counts */
69 unsigned char sf_gsresp; /* include in g & s response? */
70 unsigned char sf_oldin; /* change state */
71 unsigned char sf_crcount; /* retrans. left to send */
72};
73
d94d9fee 74struct ip_mc_list {
1da177e4 75 struct in_device *interface;
338fcf98 76 __be32 multiaddr;
1d7138de 77 unsigned int sfmode;
1da177e4
LT
78 struct ip_sf_list *sources;
79 struct ip_sf_list *tomb;
1da177e4 80 unsigned long sfcount[2];
1d7138de
ED
81 union {
82 struct ip_mc_list *next;
83 struct ip_mc_list __rcu *next_rcu;
84 };
e9897071 85 struct ip_mc_list __rcu *next_hash;
1da177e4
LT
86 struct timer_list timer;
87 int users;
8851ab52 88 refcount_t refcnt;
1da177e4
LT
89 spinlock_t lock;
90 char tm_running;
91 char reporter;
92 char unsolicit_count;
93 char loaded;
94 unsigned char gsquery; /* check source marks? */
95 unsigned char crcount;
1d7138de 96 struct rcu_head rcu;
1da177e4
LT
97};
98
99/* V3 exponential field decoding */
100#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
101#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
102 ((value) < (thresh) ? (value) : \
fb47ddb2 103 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
1da177e4
LT
104 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
105
106#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
107#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
108
2094acbb 109extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u8 proto);
1da177e4
LT
110extern int igmp_rcv(struct sk_buff *);
111extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
112extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
113extern void ip_mc_drop_socket(struct sock *sk);
114extern int ip_mc_source(int add, int omode, struct sock *sk,
115 struct ip_mreq_source *mreqs, int ifindex);
116extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
117extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
118 struct ip_msfilter __user *optval, int __user *optlen);
119extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
120 struct group_filter __user *optval, int __user *optlen);
60d9b031
DA
121extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt,
122 int dif, int sdif);
1da177e4
LT
123extern void ip_mc_init_dev(struct in_device *);
124extern void ip_mc_destroy_dev(struct in_device *);
125extern void ip_mc_up(struct in_device *);
126extern void ip_mc_down(struct in_device *);
75c78500
MS
127extern void ip_mc_unmap(struct in_device *);
128extern void ip_mc_remap(struct in_device *);
8f935bbd
AV
129extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
130extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
9afd85c9 131int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed);
a816c7c7 132
1da177e4 133#endif